/
configure.ac
160 lines (143 loc) · 4.78 KB
/
configure.ac
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
158
159
160
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT([Userspace tools for Linux IEEE 802.15.4 stack],
[0.3-pre],[linux-zigbee-devel@lists.sourceforge.net],
[lowpan-tools], [http://linux-zigbee.sourceforge.net/])
m4_ifndef([AC_PACKAGE_URL],
[AC_SUBST([PACKAGE_URL], [http://linux-zigbee.sourceforge.net/])
AC_DEFINE_UNQUOTED([PACKAGE_URL], ["$PACKAGE_URL"],
[Define to the home page for this package.])])
AC_CONFIG_AUX_DIR([misc])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall -Werror gnu])
AM_MAINTAINER_MODE([enable])
AC_CONFIG_SRCDIR([src/serial.c])
AC_CONFIG_HEADER([config.h])
# Test for new silent rules and enable only if they are available
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_ARG_WITH(zbtestdir, [AC_HELP_STRING([--with-zbtestdir],
[directory where all test programs will be installed])],
[zbtestdir=$withval],
[zbtestdir='${libexecdir}/lowpan-tools'])
AC_SUBST(zbtestdir)
AC_ARG_WITH(iproutedir, [AC_HELP_STRING([--with-iproutedir],
[directory where iproute2 plugins will be installed])],
[iproutedir=$withval],
[iproutedir='${libdir}/ip'])
AC_SUBST(iproutedir)
AC_ARG_WITH(leasefile, [AC_HELP_STRING([--with-leasefile],
[file for persistent lease storage])],
[leasefile=$withval],
[leasefile='${localstatedir}/lib/lowpan-tools/izcoordinator.leases'])
AC_SUBST(leasefile)
AC_ARG_ENABLE([manpages],[AS_HELP_STRING([--disable-manpages],
[disable manpages generation and installation])],
[case "${enableval}" in
yes | true) manpages=yes ;;
no | fale) manpages=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-manpages]) ;;
esac], [manpages=yes])
AM_CONDITIONAL([MANPAGES], [test x$manpages = xyes])
AC_ARG_ENABLE([kernel-compat],[AS_HELP_STRING([--enable-kernel-compat],
[enable compatibility with older kernels])],
[case "${enableval}" in
yes | true) kernelcompat=yes ;;
no | false) kernelcompat=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-kernel-compat]) ;;
esac], [kernelcompat=no])
if test "x$kernelcompat" == "xyes"
then
AC_DEFINE([ENABLE_KERNEL_COMPAT], [1],
[Define to 1 if you want to enable compatibility with older kernels])
fi
AC_ARG_WITH(pidfile, [AC_HELP_STRING([--with-pidfile],
[pid file location])],
[pidfile=$withval],
[pidfile='${localstatedir}/run/izcoordinator.pid'])
AC_SUBST(pidfile)
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AM_PROG_LEX
AC_PROG_YACC
AC_SUBST(LIBTOOL_DEPS)
AM_PATH_PYTHON(,, [:])
AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
# Checks for libraries.
PKG_CHECK_MODULES([NL], [libnl-3.0, libnl-genl-3.0])
AC_MSG_CHECKING([whether libnl requires additional libraries])
_libnl_save_libs="$LIBS"
LIBS="$NL_LIBS $LIBS"
AC_LINK_IFELSE([AC_LANG_CALL([], [genl_connect])], libnl_add="none" , libnl_add="fail")
if test "$libnl_add" = fail
then
LIBS="$NL_LIBS -lm $_libnl_save_libs"
AC_LINK_IFELSE([AC_LANG_CALL([], [genl_connect])], libnl_add="-lm" , libnl_add="fail")
fi
LIBS="$_libnl_save_libs"
if test "$libnl_add" = fail
then
AC_MSG_RESULT(failure)
dnl AC_MSG_RESULT([failed])
AC_MSG_FAILURE([failed to link program with libnl])
else if test "$libnl_add" = none
then
AC_MSG_RESULT([none required])
else
AC_MSG_RESULT([$libnl_add])
NL_LIBS="$NL_LIBS $libnl_add"
fi
fi
# Checks for header files.
AC_HEADER_STDC
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h syslog.h termios.h unistd.h])
AC_CHECK_HEADERS([net/ieee802154.h net/af_ieee802154.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT8_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_TYPE(struct sockaddr_ieee802154,
[AC_DEFINE([HAVE_STRUCT_SOCKADDR_IEEE802154],[],
[Define to 1 if you have struct sockaddr_ieee802154]
)],[],
[#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_NET_IEEE802154_H
#include <net/ieee802154.h>
#endif
#ifdef HAVE_NET_AF_IEEE802154_H
#include <net/af_ieee802154.h>
#endif
])
# Checks for library functions.
AC_FUNC_FORK
AC_CHECK_FUNCS([malloc realloc memset socket getopt_long select strdup strtol])
# Handle this last so -Werror doesn't get in the way of compile tests
AC_ARG_ENABLE(werror, [AC_HELP_STRING([--disable-werror],
[do not compile with -Werror])])
if test "x$enable_werror" != "xno" ; then
CFLAGS="-Werror $CFLAGS"
fi
AC_CONFIG_FILES([
Makefile
lib/Makefile
addrdb/Makefile
src/Makefile
tests/Makefile
test-serial/Makefile
])
AC_OUTPUT