summaryrefslogtreecommitdiff
path: root/configure.in
blob: 39e26e81fd4e7dafd0ab7e4b48407b5c9b6a1a69 (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
AC_PREREQ(2.50)
AC_INIT([WiMAX low level tools], [1.3.96],
        [linux-wimax@intel.com], [wimax-tools])
AC_CONFIG_SRCDIR([lib/internal.h])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(lib/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)

# i2400m driver and wimax stack
AC_ARG_WITH(i2400m,
            AC_HELP_STRING([--with-i2400m],
			   [path to the Linux kernel WiMAX stack and i2400m driver
                            sources; defaults to whatever is specified in the environment
                            variable I2400M (will be deprecated). USE ABSOLUTE PATHS.]),
            [
                I2400M="$withval"
            ],
            [
                if test -z "$I2400M"
                then
                        AC_MSG_ERROR([WiMAX stack and i2400m driver are required, please install
                                     and specify location with --with-i2400m])
                fi
            ])
AC_MSG_RESULT(Using WiMAX stack and i2400m driver from $withval)


AC_CHECK_FILE([$I2400M/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 the path specified with --with-i2400m])])

# 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=${I2400M}/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${I2400M}/include")


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