]> git.ozlabs.org Git - ppp.git/blob - configure.ac
pppd: Fix compilation on Linux when IPV6 is disabled (#360)
[ppp.git] / configure.ac
1 AC_PREREQ([2.69])
2 AC_INIT([ppp],
3         [2.4.10-dev],
4         [https://github.com/ppp-project/ppp])
5
6 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
7 AC_CONFIG_MACRO_DIR([m4])
8
9 AM_INIT_AUTOMAKE
10 AM_MAINTAINER_MODE([enable])
11
12 AC_LANG(C)
13 AC_CONFIG_SRCDIR([pppd/main.c])
14 AC_CONFIG_HEADERS([pppd/config.h pppd/pppdconf.h pppd/plugins/pppoe/config.h])
15
16 # Checks for programs.
17 AC_PROG_CC
18 AM_PROG_CC_C_O
19 AC_PROG_INSTALL
20 AC_PROG_LIBTOOL
21 AC_PROG_LN_S
22
23 PKG_PROG_PKG_CONFIG
24
25 AC_CANONICAL_HOST
26 build_linux=no
27 build_sunos=no
28
29 case "${host_os}" in
30     linux*)
31         build_linux=yes
32         ;;
33     solaris2*)
34         build_sunos=yes
35         ;;
36     *)
37         AC_MSG_ERROR(["OS ${host_os} not supported"])
38         ;;
39 esac
40
41 AM_CONDITIONAL([LINUX], [test "x${build_linux}" = "xyes" ])
42 AM_CONDITIONAL([SUNOS], [test "x${build_sunos}" = "xyes" ])
43 AM_COND_IF([SUNOS],
44       CFLAGS="$CFLAGS -DSOL2 -DSRV4")
45
46 #
47 # Checks for header files, these will set the HAVE_[FILE]_H macros in config.h
48 AC_HEADER_STDBOOL
49 AC_CHECK_HEADERS([  \
50     asm/types.h     \
51     crypt.h         \
52     paths.h         \
53     shadow.h        \
54     sys/dlpi.h      \
55     sys/ioctl.h     \
56     sys/socket.h    \
57     sys/time.h      \
58     sys/uio.h       \
59     time.h          \
60     unistd.h        \
61     utmp.h])
62
63 #
64 # Check for linux specific headers, required by pppoe, or pppol2tp
65 AM_COND_IF([LINUX], [
66     AC_CHECK_HEADERS([          \
67         net/bpf.h               \
68         net/if.h                \
69         net/if_types.h          \
70         net/if_arp.h            \
71         linux/if.h              \
72         linux/if_ether.h        \
73         linux/if_packet.h       \
74         netinet/if_ether.h      \
75         netpacket/packet.h])])
76
77 AC_CHECK_SIZEOF(unsigned int)
78 AC_CHECK_SIZEOF(unsigned long)
79 AC_CHECK_SIZEOF(unsigned short)
80
81 # Checks for library functions.
82 AC_CHECK_FUNCS([    \
83     mmap            \
84     logwtmp         \
85     strerror])
86
87 #
88 # If libc doesn't provide logwtmp, check if libutil provides logwtmp(), and if so link to it.
89 AS_IF([test "x${ac_cv_func_logwtmp}" != "xyes"], [
90     AC_CHECK_LIB([util], [logwtmp], [
91         AC_DEFINE(HAVE_LOGWTMP, 1, [System provides the logwtmp() function])
92         AC_SUBST([UTIL_LIBS], ["-lutil"])
93     ])
94 ])
95
96 #
97 # Check if libcrypt have crypt() function
98 AC_CHECK_LIB([crypt], [crypt],
99     AC_SUBST([CRYPT_LIBS], ["-lcrypt"]))
100
101 #
102 # Should pppd link with -lsystemd (Linux only)
103 AC_ARG_ENABLE([systemd],
104     AS_HELP_STRING([--enable-systemd], [Enable support for systemd notification]))
105 AM_CONDITIONAL(WITH_SYSTEMD, test "x${enable_systemd}" = "xyes")
106 AM_COND_IF([WITH_SYSTEMD],
107     AC_DEFINE([SYSTEMD], 1, [Enable support for systemd notifications]))
108 AS_IF([test "x${enable_systemd}" = "xyes"], [
109         PKG_CHECK_MODULES([systemd], [systemd])])
110
111 #
112 # Enable Callback Protocol Support, disabled by default
113 AC_ARG_ENABLE([cbcp],
114     AS_HELP_STRING([--enable-cbcp], [Enable Callback Protocol]))
115 AM_CONDITIONAL(PPP_WITH_CBCP, test "x${enable_cbcp}" = "xyes")
116 AM_COND_IF([PPP_WITH_CBCP],
117     AC_DEFINE([PPP_WITH_CBCP], 1, [Have Callback Protocol support]))
118
119 #
120 # Disable Microsoft extensions will remove CHAP and MPPE support
121 AC_ARG_ENABLE([microsoft-extensions],
122     AS_HELP_STRING([--disable-microsoft-extensions], [Disable Microsoft CHAP / MPPE extensions]))
123
124 AM_CONDITIONAL(PPP_WITH_CHAPMS, test "x${enable_microsoft_extensions}" != "xno")
125 AM_COND_IF([PPP_WITH_CHAPMS],
126     AC_DEFINE([PPP_WITH_CHAPMS], 1, [Have Microsoft CHAP support]))
127
128 AM_CONDITIONAL(PPP_WITH_MPPE, test "x${enable_microsoft_extensions}" != "xno")
129 AM_COND_IF([PPP_WITH_MPPE],
130     AC_DEFINE([PPP_WITH_MPPE], 1, [Have Microsoft MPPE support]))
131
132 #
133 # Enable Microsoft LAN Manager support, depends on Microsoft Extensions
134 AC_ARG_ENABLE([mslanman],
135     AS_HELP_STRING([--enable-mslanman], [Enable Microsoft LAN Manager support]))
136 AS_IF([test "x${enable_mslanman}" = "xyes" && test "x${enable_microsoft_extensions}" != "xno"],
137     AC_DEFINE([PPP_WITH_MSLANMAN], 1, [Have Microsoft LAN Manager support]))
138
139 #
140 # Disable IPv6 support
141 AC_ARG_ENABLE([ipv6cp],
142     AS_HELP_STRING([--disable-ipv6cp], [Disable IPv6 Control Protocol]))
143 AM_CONDITIONAL(PPP_WITH_IPV6CP, test "x${enable_ipv6cp}" != "xno")
144 AM_COND_IF([PPP_WITH_IPV6CP],
145     AC_DEFINE(PPP_WITH_IPV6CP, 1, [Have IPv6 Control Protocol]))
146
147 #
148 # Disable Multilink support
149 AC_ARG_ENABLE([multilink],
150     AS_HELP_STRING([--enable-multilink], [Enable multilink support]))
151 AM_CONDITIONAL(PPP_WITH_MULTILINK, test "x${enable_multilink}" = "xyes")
152 AM_COND_IF([PPP_WITH_MULTILINK],
153     AC_DEFINE([PPP_WITH_MULTILINK], 1, [Have multilink support]))
154 AS_IF([test "x${build_sunos}" = "xyes" && test "x${enable_multilink}" = "xyes"],
155     [AC_MSG_ERROR([Multilink is not supported on SunOS])])
156
157 #
158 # Multilink require Trivial Database Support
159 AM_CONDITIONAL(PPP_WITH_TDB, test "x${enable_multilink}" = "xyes")
160 AM_COND_IF([PPP_WITH_TDB],
161     AC_DEFINE([PPP_WITH_TDB], 1, [Include TDB support]))
162
163 #
164 # Enable support for loadable plugins
165 AC_ARG_ENABLE([plugins],
166     AS_HELP_STRING([--disable-plugins], [Disable support for loadable plugins]))
167 AS_IF([test "x$enable_plugins" != "xno"],
168     AC_DEFINE([PPP_WITH_PLUGINS], 1, [Have support for loadable plugins]))
169 AM_CONDITIONAL(PPP_WITH_PLUGINS, test "x${enable_plugins}" != "xno")
170
171 #
172 # Disable EAP-TLS support
173 AC_ARG_ENABLE([eaptls],
174     AS_HELP_STRING([--disable-eaptls], [Disable EAP-TLS authentication support]))
175 AS_IF([test "x$enable_eaptls" != "xno"],
176     AC_DEFINE([PPP_WITH_EAPTLS], 1, [Have EAP-TLS authentication support]))
177 AM_CONDITIONAL(PPP_WITH_EAPTLS, test "x${enable_eaptls}" != "xno")
178
179 #
180 # Disable PEAP support
181 AC_ARG_ENABLE([peap],
182     AS_HELP_STRING([--disable-peap], [Disable PEAP authentication support]))
183 AS_IF([test "x${enable_peap}" != "xno"],
184     AC_DEFINE([PPP_WITH_PEAP], 1, [Have PEAP authentication support]))
185 AM_CONDITIONAL([PPP_WITH_PEAP], test "x${enable_peap}" != "xno")
186
187 #
188 # Disable OpenSSL engine support
189 AC_ARG_ENABLE([openssl-engine],
190     AS_HELP_STRING([--disable-openssl-engine], [Disable OpenSSL engine support]))
191 AS_IF([test "x$enable_openssl_engine" != "xno"], [],
192     AC_DEFINE([OPENSSL_NO_ENGINE], 1, [OpenSSL engine support]))
193
194 #
195 # Specify runtime directory
196 AC_ARG_WITH([plugin-dir],
197         AC_HELP_STRING([--with-plugin-dir=DIR], [Specify the plugin directory for pppd]))
198 AS_IF([test -n "$with_plugin_dir"],
199         [PPPD_PLUGIN_DIR="$with_plugin_dir"],
200         [PPPD_PLUGIN_DIR="${libdir}/pppd/$VERSION"])
201 AC_SUBST(PPPD_PLUGIN_DIR, "$PPPD_PLUGIN_DIR", [The pppd plugin directory])
202
203 #
204 # Specify runtime directory
205 AC_ARG_WITH([runtime-dir],
206         AC_HELP_STRING([--with-runtime-dir=DIR], [Specify the runtime directory for pppd]))
207 AS_IF([test -n "$with_runtime_dir"],
208         [PPPD_RUNTIME_DIR="$with_runtime_dir"],
209         [PPPD_RUNTIME_DIR="${localstatedir}/run/pppd"])
210 AC_SUBST(PPPD_RUNTIME_DIR)
211
212 #
213 # Specify runtime directory
214 AC_ARG_WITH([logfile-dir],
215         AC_HELP_STRING([--with-logfile-dir=DIR], [Specify the log directory for pppd]))
216 AS_IF([test -n "$with_logfile_dir"],
217         [PPPD_LOGFILE_DIR="$with_logfile_dir"],
218         [PPPD_LOGFILE_DIR="${localstatedir}/log/pppd"])
219 AC_SUBST(PPPD_LOGFILE_DIR)
220
221 #
222 # Check for OpenSSL
223 AX_CHECK_OPENSSL
224 AM_CONDITIONAL(WITH_OPENSSL, test "x${with_openssl}" != "xno")
225
226 #
227 # Check if OpenSSL has compiled in support for various ciphers
228 AS_IF([test "x${with_openssl}" != "xno" ], [
229     AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_MD4], [md4])
230     AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_MD5], [md5])
231     AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_DES], [des])
232     AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_SHA], [sha])
233 ], [
234     AS_IF([test "x${enable_eaptls}" != "xno" || test "x${enable_peap}" != "xno"],
235         [AC_MSG_ERROR([OpenSSL not found, and if this is your intention then run configure --disable-eaptls and --disable-peap])])
236 ])
237
238 AM_CONDITIONAL([OPENSSL_HAVE_MD4], test "x${ac_cv_openssl_md4}" = "xyes")
239 AM_COND_IF([OPENSSL_HAVE_MD4],,
240     AC_DEFINE([USE_MD4], 1, [Use MD4 included with pppd]))
241
242 AM_CONDITIONAL([OPENSSL_HAVE_MD5], test "x${ac_cv_openssl_md5}" = "xyes")
243 AM_COND_IF([OPENSSL_HAVE_MD5],,
244     AC_DEFINE([USE_MD5], 1, [Use MD5 included with pppd]))
245
246 AM_CONDITIONAL([OPENSSL_HAVE_SHA], test "x${ac_cv_openssl_sha}" = "xyes")
247 AM_COND_IF([OPENSSL_HAVE_SHA],,
248     AC_DEFINE([USE_SHA], 1, [Use SHA included with pppd]))
249
250 AM_CONDITIONAL([OPENSSL_HAVE_DES], test "x${ac_cv_openssl_des}" = "xyes")
251 AM_COND_IF([OPENSSL_HAVE_DES],,
252     AC_DEFINE([USE_CRYPT], 1, [Use DES included with pppd]))
253
254 #
255 # If OpenSSL doesn't support DES, then use the one from libcrypt (glibc dropped support for this in 2.27).
256 AS_IF([test "x${ac_cv_openssl_des}" = "xno" ], [
257     AC_CHECK_LIB([crypt], [encrypt],
258         [LIBS="$LIBS -lcrypt"],
259         [AC_MSG_ERROR([OpenSSL not found or does not support DES, and libcrypt also doesn't support encrypt])]
260     )
261 ])
262
263 #
264 # With libsrp support
265 AX_CHECK_SRP([
266     AC_DEFINE([PPP_WITH_SRP], 1, [Support for libsrp authentication module])])
267
268 #
269 # With libatm support
270 AX_CHECK_ATM
271
272 #
273 # With libpam support
274 AX_CHECK_PAM(AC_DEFINE([PPP_WITH_PAM], 1, [Support for Pluggable Authentication Modules]))
275 AM_CONDITIONAL(PPP_WITH_PAM, test "x${with_pam}" = "xyes")
276
277 #
278 # With libpcap support, activate pppd on network activity
279 AX_CHECK_PCAP
280
281 #
282 # SunOS provides a version of libpcap that would work, but SunOS has no support for activity filter
283 AM_CONDITIONAL([PPP_WITH_FILTER], [ test "x${with_pcap}" = "xyes" && test "x${build_sunos}" != "xyes" ])
284 AM_COND_IF([PPP_WITH_FILTER], [
285     AC_DEFINE([PPP_WITH_FILTER], 1, [Have packet activity filter support])], [
286     AS_IF([test "x${build_sunos}" = "xyes"], [
287         AC_MSG_WARN([Packet activity filter not supported on SunOS])
288         with_pcap="no"
289         ])
290     ])
291
292 #
293 # Some contributions require GTK/GLIB
294 AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk], [Build contributions with the GTK+ interface]))
295 if test "x${with_gtk}" = "xyes"; then
296     PKG_CHECK_MODULES([GTK], [gtk+-2.0])
297     PKG_CHECK_MODULES([GLIB], [glib-2.0])
298 fi
299 AM_CONDITIONAL([WITH_GTK], test "x${with_gtk}" = "xyes")
300
301 AC_DEFINE_UNQUOTED(PPPD_VERSION, "$VERSION", [Version of pppd])
302
303 AC_CONFIG_FILES([
304     Makefile
305     chat/Makefile
306     contrib/Makefile
307     contrib/pppgetpass/Makefile
308     common/Makefile
309     include/Makefile
310     modules/Makefile
311     pppd/Makefile
312     pppd/pppd.pc
313     pppd/plugins/Makefile
314     pppd/plugins/pppoe/Makefile
315     pppd/plugins/pppoatm/Makefile
316     pppd/plugins/pppol2tp/Makefile
317     pppd/plugins/radius/Makefile
318     pppdump/Makefile
319     pppstats/Makefile
320     scripts/Makefile
321     ])
322 AC_OUTPUT
323
324
325 AS_IF([test "x${build_sunos}" = "xyes" ], [[
326     echo "
327 Setting up SunOS kernel module(s)"
328     mkmkf() {
329         rm -f $2
330         if [ -f $1 ]; then
331             echo "  $2 <= $1"
332             sed -e "s,@DESTDIR@,$prefix,g" \
333                 -e "s,@SYSCONF@,$sysconfdir,g" \
334                 -e "s,@CC@,$CC,g" \
335                 -e "s|@CFLAGS@|$CFLAGS|g" $1 > $2
336         fi
337     }
338
339     release=`uname -r`
340     karch=`/usr/bin/isainfo -k`
341     makext="sol2"
342     archvariant=
343
344     case "$karch" in
345         amd64)
346             archvariant='-64x'
347             ;;
348         sparcv9)
349             archvariant='-64'
350             ;;
351         *)
352             ;;
353     esac
354
355     usegcc=$CC
356     if [ -x /opt/SUNWspro/bin/cc -a "$usegcc" != gcc ] &&
357        /opt/SUNWspro/bin/cc -flags >/dev/null 2>&1; then
358       if [ "$archvariant" = "-64x" ]; then
359         ( cd /tmp; echo "int x;" > ppp$$.c
360           /opt/SUNWspro/bin/cc -c -errwarn -xchip=opteron -m64 ppp$$.c >/dev/null 2>&1 || (
361             echo "WorkShop C is unable to make 64 bit modules, and your $karch system needs"
362             echo "them.  Consider upgrading cc on this machine."
363             rm -f ppp$$.c
364             exit 1
365           ) || exit 1
366           rm -f ppp$$.c ppp$$.o
367         ) || exit 1
368       fi
369     elif gcc --version >/dev/null 2>&1; then
370       archvariant=gcc$archvariant
371       compiletype=.gcc
372       if [ "$archvariant" = "gcc-64" -o"$archvariant" = "gcc-64x" ]; then
373         ( cd /tmp; touch ppp$$.c
374           gcc -c -m64 ppp$$.c >/dev/null 2>&1 || (
375             echo "gcc is unable to make 64 bit modules, and your $karch system needs them."
376             echo "Consider upgrading gcc on this machine, or switching to Sun WorkShop."
377             rm -f ppp$$.c
378             exit 1
379           ) || exit 1
380           rm -f ppp$$.c ppp$$.o
381         ) || exit 1
382       fi
383     else
384       echo "C compiler not found; hoping for the best."
385     fi
386
387     mkmkf solaris/Makedefs$compiletype Makedefs.com
388     mkmkf solaris/Makefile.sol2$archvariant solaris/Makefile
389 ]])
390
391 echo "
392 $PACKAGE_NAME version $PACKAGE_VERSION
393     Prefix...............: $prefix
394     Runtime Dir..........: $PPPD_RUNTIME_DIR
395     Logfile Dir..........: $PPPD_LOGFILE_DIR
396     Plugin Dir...........: $PPPD_PLUGIN_DIR
397     With OpenSSL.........: ${with_openssl:-yes}
398     With libatm..........: ${with_atm:-no}
399     With libpam..........: ${with_pam:-no}
400     With libpcap.........: ${with_pcap:-no}
401     With libsrp..........: ${with_srp:-no}
402     C Compiler...........: $CC $CFLAGS
403     Linker...............: $LD $LDFLAGS $LIBS
404
405 Features enabled
406     Microsoft Extensions.: ${enable_microsoft_extensions:-yes}
407     Multilink............: ${enable_multilink:-no}
408     Plugins..............: ${enable_plugins:-yes}
409     CBCP.................: ${enable_cbcp:-no}
410     IPV6CP...............: ${enable_ipv6cp:-yes}
411     EAP-TLS..............: ${enable_eaptls:-yes}
412     PEAP.................: ${enable_peap:-yes}
413     systemd notifications: ${enable_systemd:-no}
414 "