summaryrefslogtreecommitdiff
path: root/configure.in
blob: 01057c25d603c56c9ccdd806994c04adc70b1a1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
AC_PREREQ(2.50)
AC_INIT([WiMAX low level tools], [1.4.4],
        [linux-wimax@intel.com], [wimax-tools])
AC_CONFIG_SRCDIR([lib/internal.h])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(include/config.h)

AM_MAINTAINER_MODE

AC_PREFIX_DEFAULT(/usr/local)

if (test "${CFLAGS}" = ""); then
	CFLAGS="-g -Wall -O2"
fi

AC_LANG_C
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL

AC_ARG_ENABLE(doxygen-doc,
              AC_HELP_STRING([--enable-doxygen-doc],
                             [Generate documentation with Doxygen]),
              doxygen_doc=$enableval,doxygen_doc=auto)

AC_PATH_PROG(DOXYGEN, doxygen, no)
AC_MSG_CHECKING([if Doxygen documentation should be built])
if test zz$DOXYGEN = zzno
then
    doxygen=no
else
    doxygen=yes
fi

case zz$doxygen_doc in
     zzauto)
     	do_doxygen=$doxygen;;
     zzyes)
        if test zz$doxygen = zzno
        then
                AC_MSG_ERROR([Doxygen docs forced on with --enable-doxygen-doc, but can't find doxygen!])
        fi
     	do_doxygen=yes;;
     zzno)
        do_doxygen=no;;
     *)
        AC_MSG_ERROR([Unknown enable val "$doxygen_doc" to --enable-doxygen-doc])
esac

AM_CONDITIONAL(DOXYGEN_DOC, test zz$do_doxygen = zzyes)
AC_MSG_RESULT($do_doxygen)


AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
			[enable compiling with debugging information]), [
	if (test "${enableval}" = "yes" &&
				test "${ac_cv_prog_cc_g}" = "yes"); then
		CFLAGS="$CFLAGS -g"
	fi
])

# If libnl-1 is installed
AC_ARG_WITH(libnl1,
            AC_HELP_STRING([--with-libnl1],
			   [prefix to libnl (>=1.0-pre7) installation; defaults to
                            whichever is found in the system with pkg-config.
                            USE ABSOLUTE PATHS.]),
            export PKG_CONFIG_PATH="$withval:$withval/lib/pkgconfig")
PKG_CHECK_MODULES(LIBNL1, libnl-1 >= 1.0-pre7)
libnl1_prefix=`pkg-config "libnl-1 >= 1.0-pre7" --variable=prefix`
AC_MSG_RESULT(Using libnl1 from $libnl1_prefix)
AC_SUBST(LIBNL1_CFLAGS)
AC_SUBST(LIBNL1_LIBS)

# Linux WiMAX stack
LINUX_KERNEL=/usr
AC_ARG_WITH(linux,
            AC_HELP_STRING([--with-linux],
			   [path to the Linux kernel headers/source (containing the 
                            definitions for the WiMAX stack); defaults to what
                            is installed in your system's /usr/include/linux. 
                            USE ABSOLUTE PATHS.]),
            [
                LINUX_KERNEL="$withval"
            ])
# Old, for backwards compat
AC_ARG_WITH(i2400m,
            AC_HELP_STRING([--with-i2400m],
			   [path to the Linux kernel headers/source (containing the 
                            definitions for the WiMAX stack); defaults to what
                            is installed in your system's /usr/include/linux. 
                            DEPRECATED: this option will be removed soon.
                            USE ABSOLUTE PATHS.]),
            [
                LINUX_KERNEL="$withval"
            ])
AC_MSG_RESULT(Using Linux WiMAX stack from $LINUX_KERNEL)

AC_CHECK_FILE([$LINUX_KERNEL/include/linux/wimax.h],
                [AC_DEFINE([HAVE_WIMAX_H], 1, [Define to 1 if you have <linux/wimax.h>.])],
                [AC_MSG_ERROR([Can't locate include/linux/wimax.h in $LINUX_KERNEL])])

# Dirty (as in very dirty) version compatibility check
#
# To make sure it works during cross compiles, we extract by hand the
# value of WIMAX_GNL_VERSION.
wimax_h=${LINUX_KERNEL}/include/linux/wimax.h
wimax_gnl_version=[$(grep '^[[:space:]]*WIMAX_GNL_VERSION[[:space:]]*=[[:space:]]*[0-9]\+,$' $wimax_h \
     | sed 's/^[[:space:]]*WIMAX_GNL_VERSION[[:space:]]*=[[:space:]]*\([0-9]\+\),$/\1/')]
wimax_gnl_vmajor=$(($wimax_gnl_version / 10))
wimax_gnl_vminor=$(($wimax_gnl_version % 10))
need_vmajor=0
need_vminor=0
if test $wimax_gnl_vmajor != $need_vmajor
then
        AC_MSG_ERROR([WiMAX kernel support has major version $wimax_gnl_vmajor, this software needs $need_vmajor])
fi
if test $wimax_gnl_vminor -lt $need_vminor
then
        AC_MSG_ERROR([WiMAX kernel support has minor version $wimax_gnl_vminor, this software needs at least $need_vminor])
fi

AC_SUBST(I2400M_INCLUDES, "-I${LINUX_KERNEL}/include")
AC_SUBST(LINUX_INCLUDE_PATH, "${LINUX_KERNEL}/include")

AC_CHECK_DECL(WIMAX_GNL_OP_STATE_GET,
              AC_MSG_NOTICE([Kernel / WiMAX driver is ok (> 2.6.30); has WIMAX_GNL_OP_STATE_GET]),
              AC_MSG_ERROR([Kernel / WiMAX driver is too old (<= 2.6.30); missing WIMAX_GNL_OP_STATE_GET]), 
              [#include <$LINUX_INCLUDE_PATH/linux/wimax.h>])

AC_CHECK_LIB(dl, dlopen, dummy=yes,
			AC_MSG_ERROR(dynamic linking loader is required))

PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.14, dummy=yes,
                  AC_MSG_ERROR(GLib >= 2.14 is required))
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)


AC_OUTPUT(Makefile
          wimax-tools.spec
          wimax-tools.yaml
          doc/Makefile
          doc/doxygen.conf
          libwimaxll-0.pc
          libwimaxll-0-uninstalled.pc
          libwimaxll-i2400m-0.pc
          libwimaxll-i2400m-0-uninstalled.pc
          wimaxll-cmd-0.pc
          bin/Makefile
          bin/wimax-tools-version
          include/Makefile
          include/wimaxll-version.h
          include/wimaxll/Makefile
          include/wimaxll/version.h
          lib/Makefile
          src/Makefile)