]> git.ozlabs.org Git - ppp.git/blob - configure.ac
Merge branch 'pppoe-discovery' of https://github.com/pali/ppp
[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])
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 "${build_linux}" = "yes" ])
42 AM_CONDITIONAL([SUNOS], [test "${build_sunos}" = "yes" ])
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
109 #
110 # Enable Callback Protocol Support, disabled by default
111 AC_ARG_ENABLE([cbcp],
112     AS_HELP_STRING([--enable-cbcp], [Enable Callback Protocol]))
113 AM_CONDITIONAL(WITH_CBCP, test "x${enable_cbcp}" = "xyes")
114 AM_COND_IF([WITH_CBCP],
115     AC_DEFINE([CBCP_SUPPORT], 1, [Have Callback Protocol support]))
116
117 #
118 # Disable support for IPX control protocol
119 AC_ARG_ENABLE([ipxcp],
120     AS_HELP_STRING([--enable-ipxcp], [Enable IPX Control Protocol support]))
121 AM_CONDITIONAL(WITH_IPXCP, test "x${enable_ipxcp}" = "xyes")
122 AM_COND_IF(WITH_IPXCP,
123     AC_DEFINE([IPX_CHANGE], 1, ["Have IPX Control Protocol"]))
124 AS_IF([test "x${build_sunos}" = "xyes" && test "x${enable_ipxcp}" = "xyes"],
125     [AC_MSG_ERROR([IPXCP is not supported on SunOS, disable using --disable-ipxcp])])
126
127 #
128 # Disable support for limiting session duration by maximum octets
129 AC_ARG_ENABLE([maxoctets],
130     AS_HELP_STRING([--disable-maxoctets], [Disable support for limiting session by maximum octets]))
131 AS_IF([test "x$enable_maxoctets" != "xno"],
132     AC_DEFINE([MAXOCTETS], 1, ["Limit sessions by maximum number of octets"]))
133
134 #
135 # Disable Microsoft extensions will remove CHAP and MPPE support
136 AC_ARG_ENABLE([microsoft-extensions],
137     AS_HELP_STRING([--disable-microsoft-extensions], [Disable Microsoft CHAP / MPPE extensions]))
138
139 AM_CONDITIONAL(WITH_CHAPMS, test "x${enable_microsoft_extensions}" != "xno")
140 AM_COND_IF([WITH_CHAPMS],
141     AC_DEFINE([CHAPMS], 1, ["Have Microsoft CHAP support"]))
142
143 AM_CONDITIONAL(WITH_MPPE, test "x${enable_microsoft_extensions}" != "xno")
144 AM_COND_IF([WITH_MPPE],
145     AC_DEFINE([MPPE], 1, ["Have Microsoft MPPE support"]))
146
147 #
148 # Enable Microsoft LAN Manager support, depends on Microsoft Extensions
149 AC_ARG_ENABLE([mslanman],
150     AS_HELP_STRING([--enable-mslanman], [Enable Microsoft LAN Manager support]))
151 AS_IF([test "x${enable_mslanman}" = "xyes" && test "x${enable_microsoft_extensions}" != "xno"],
152     AC_DEFINE([MSLANMAN], 1, ["Have Microsoft LAN Manager support"]))
153
154 #
155 # Disable IPv6 support
156 AC_ARG_ENABLE([ipv6-support],
157     AS_HELP_STRING([--disable-ipv6-support], [Disable IPv6 support]))
158 AM_CONDITIONAL(WITH_INET6, test "x${enable_ipv6_support}" != "xno")
159 AM_COND_IF([WITH_INET6],
160     AC_DEFINE(INET6, 1, ["Have IPv6 support"]))
161
162 #
163 # Disable Multilink support
164 AC_ARG_ENABLE([multilink],
165     AS_HELP_STRING([--enable-multilink], [Enable multilink support]))
166 AM_CONDITIONAL(WITH_MULTILINK, test "x${enable_multilink}" = "xyes")
167 AM_COND_IF([WITH_MULTILINK],
168     AC_DEFINE([HAVE_MULTILINK], 1, ["Have multilink support"]))
169 AS_IF([test "x${build_sunos}" = "xyes" && test "x${enable_multilink}" = "xyes"],
170     [AC_MSG_ERROR([Multilink is not supported on SunOS])])
171
172 #
173 # Multilink require Trivial Database Support
174 AM_CONDITIONAL(WITH_TDB, test "x${enable_multilink}" = "xyes")
175 AM_COND_IF([WITH_TDB],
176     AC_DEFINE([USE_TDB], 1, ["Include TDB support"]))
177
178 #
179 # Enable support for loadable plugins
180 AC_ARG_ENABLE([plugins],
181     AS_HELP_STRING([--disable-plugins], [Disable support for loadable plugins]))
182 AS_IF([test "x$enable_plugins" != "xno"],
183     AC_DEFINE([PLUGIN], 1, ["Have support for loadable plugins"]))
184 AM_CONDITIONAL(WITH_PLUGINS, test "${enable_plugins}" != "no")
185
186 #
187 # Disable EAP-TLS support
188 AC_ARG_ENABLE([eaptls],
189     AS_HELP_STRING([--disable-eaptls], [Disable EAP-TLS authentication support]))
190 AS_IF([test "x$enable_eaptls" != "xno"],
191     AC_DEFINE([USE_EAPTLS], 1, ["Have EAP-TLS authentication support"]))
192 AM_CONDITIONAL(WITH_EAPTLS, test "x${enable_eaptls}" != "xno")
193
194 #
195 # Disable PEAP support
196 AC_ARG_ENABLE([peap],
197     AS_HELP_STRING([--disable-peap], [Disable PEAP authentication support]))
198 AS_IF([test "x${enable_peap}" != "xno"],
199     AC_DEFINE([USE_PEAP], 1, ["Have PEAP authentication support"]))
200 AM_CONDITIONAL([WITH_PEAP], test "x${enable_peap}" != "xno")
201
202 #
203 # Disable OpenSSL engine support
204 AC_ARG_ENABLE([openssl-engine],
205     AS_HELP_STRING([--disable-openssl-engine], [Disable OpenSSL engine support]))
206 AS_IF([test "x$enable_openssl_engine" != "xno"], [],
207     AC_DEFINE([OPENSSL_NO_ENGINE], 1, ["OpenSSL engine support"]))
208
209 #
210 # Specify runtime directory
211 AC_ARG_WITH([plugin-dir],
212         AC_HELP_STRING([--with-plugin-dir=DIR], [Specify the plugin directory for pppd]))
213 AS_IF([test -n "$with_plugin_dir"],
214         [PPPD_PLUGIN_DIR="$with_plugin_dir"],
215         [PPPD_PLUGIN_DIR="${libdir}/pppd/$VERSION"])
216 AC_SUBST(PPPD_PLUGIN_DIR, "$PPPD_PLUGIN_DIR", [The pppd plugin directory])
217
218 #
219 # Specify runtime directory
220 AC_ARG_WITH([runtime-dir],
221         AC_HELP_STRING([--with-runtime-dir=DIR], [Specify the runtime directory for pppd]))
222 AS_IF([test -n "$with_runtime_dir"],
223         [PPPD_RUNTIME_DIR="$with_runtime_dir"],
224         [PPPD_RUNTIME_DIR="${localstatedir}/run/pppd"])
225 AC_SUBST(PPPD_RUNTIME_DIR)
226
227 #
228 # Specify runtime directory
229 AC_ARG_WITH([logfile-dir],
230         AC_HELP_STRING([--with-logfile-dir=DIR], [Specify the log directory for pppd]))
231 AS_IF([test -n "$with_logfile_dir"],
232         [PPPD_LOGFILE_DIR="$with_logfile_dir"],
233         [PPPD_LOGFILE_DIR="${localstatedir}/log/pppd"])
234 AC_SUBST(PPPD_LOGFILE_DIR)
235
236 #
237 # Check for OpenSSL
238 AX_CHECK_OPENSSL
239 AM_CONDITIONAL(WITH_OPENSSL, test "${with_openssl}" != "no")
240
241 #
242 # Check if OpenSSL has compiled in support for various ciphers
243 AS_IF([test "x${with_openssl}" != "xno" ], [
244     AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_MD4], [md4])
245     AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_MD5], [md5])
246     AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_DES], [des])
247     AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_SHA], [sha])
248 ], [
249     AS_IF([test "x${enable_eaptls}" != "xno" || test "x${enable_peap}" != "xno"],
250         [AC_MSG_ERROR([OpenSSL not found, and if this is your intention then run configure --disable-eaptls and --disable-peap])])
251 ])
252
253 AM_CONDITIONAL([OPENSSL_HAVE_MD4], test "x${ac_cv_openssl_md4}" = "xyes")
254 AM_COND_IF([OPENSSL_HAVE_MD4],,
255     AC_DEFINE([USE_MD4], 1, [Use included md4 included with pppd]))
256
257 AM_CONDITIONAL([OPENSSL_HAVE_MD5], test "x${ac_cv_openssl_md5}" = "xyes")
258 AM_COND_IF([OPENSSL_HAVE_MD5],,
259     AC_DEFINE([USE_MD5], 1, [Use included md5 included with pppd]))
260
261 AM_CONDITIONAL([OPENSSL_HAVE_SHA], test "x${ac_cv_openssl_sha}" = "xyes")
262 AM_COND_IF([OPENSSL_HAVE_SHA],,
263     AC_DEFINE([USE_SHA], 1, [Use included sha included with pppd]))
264
265 AM_CONDITIONAL([OPENSSL_HAVE_DES], test "x${ac_cv_openssl_des}" = "xyes")
266 AM_COND_IF([OPENSSL_HAVE_DES],,
267     AC_DEFINE([USE_CRYPT], 1, [Use included des included with pppd]))
268
269 #
270 # If OpenSSL doesn't support DES, then use the one from libcrypt (glibc dropped support for this in 2.27).
271 AS_IF([test "${ac_cv_openssl_des}" = "no" ], [
272     AC_CHECK_LIB([crypt], [encrypt],
273         [LIBS="$LIBS -lcrypt"],
274         [AC_MSG_ERROR([OpenSSL not found or does not support DES, and libcrypt also doesn't support encrypt])]
275     )
276 ])
277
278 #
279 # With libsrp support
280 AX_CHECK_SRP
281
282 #
283 # With libatm support
284 AX_CHECK_ATM
285
286 #
287 # With libpam support
288 AX_CHECK_PAM(AC_DEFINE([USE_PAM], 1, ["Support for Pluggable Authentication Modules"]))
289 AM_CONDITIONAL(WITH_PAM, test "x${with_pam}" = "xyes")
290
291 #
292 # With libpcap support, activate pppd on network activity
293 AX_CHECK_PCAP
294
295 #
296 # SunOS provides a version of libpcap that would work, but SunOS has no support for activity filter
297 AM_CONDITIONAL([WITH_FILTER], [ test "x${with_pcap}" = "xyes" && test "x${build_sunos}" != "xyes" ])
298 AM_COND_IF([WITH_FILTER], [
299     AC_DEFINE([PPP_FILTER], 1, ["Have packet activity filter support"])], [
300     AS_IF([test "x${build_sunos}" = "xyes"], [
301         AC_MSG_WARN([Packet activity filter not supported on SunOS])
302         with_pcap="no"
303         ])
304     ])
305
306 #
307 # Some contributions require GTK/GLIB
308 AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk], [Build contributions with the GTK+ interface]))
309 if test "x${with_gtk}" = "xyes"; then
310     PKG_CHECK_MODULES([GTK], [gtk+-2.0])
311     PKG_CHECK_MODULES([GLIB], [glib-2.0])
312 fi
313 AM_CONDITIONAL([WITH_GTK], test "x${with_gtk}" = "xyes")
314
315
316 AC_CONFIG_FILES([
317     Makefile
318     chat/Makefile
319     contrib/Makefile
320     contrib/pppgetpass/Makefile
321     common/Makefile
322     include/Makefile
323     modules/Makefile
324     pppd/Makefile
325     pppd/pppd.pc
326     pppd/plugins/Makefile
327     pppd/plugins/pppoe/Makefile
328     pppd/plugins/pppoatm/Makefile
329     pppd/plugins/pppol2tp/Makefile
330     pppd/plugins/radius/Makefile
331     pppdump/Makefile
332     pppstats/Makefile
333     scripts/Makefile
334     ])
335 AC_OUTPUT
336
337
338 AS_IF([test "x${build_sunos}" = "xyes" ], [[
339     echo "
340 Setting up SunOS kernel module(s)"
341     mkmkf() {
342         rm -f $2
343         if [ -f $1 ]; then
344             echo "  $2 <= $1"
345             sed -e "s,@DESTDIR@,$prefix,g" \
346                 -e "s,@SYSCONF@,$sysconfdir,g" \
347                 -e "s,@CC@,$CC,g" \
348                 -e "s|@CFLAGS@|$CFLAGS|g" $1 > $2
349         fi
350     }
351
352     release=`uname -r`
353     karch=`/usr/bin/isainfo -k`
354     makext="sol2"
355     archvariant=
356
357     case "$karch" in
358         amd64)
359             archvariant='-64x'
360             ;;
361         sparcv9)
362             archvariant='-64'
363             ;;
364         *)
365             ;;
366     esac
367
368     usegcc=$CC
369     if [ -x /opt/SUNWspro/bin/cc -a "$usegcc" != gcc ] &&
370        /opt/SUNWspro/bin/cc -flags >/dev/null 2>&1; then
371       if [ "$archvariant" = "-64x" ]; then
372         ( cd /tmp; echo "int x;" > ppp$$.c
373           /opt/SUNWspro/bin/cc -c -errwarn -xchip=opteron -m64 ppp$$.c >/dev/null 2>&1 || (
374             echo "WorkShop C is unable to make 64 bit modules, and your $karch system needs"
375             echo "them.  Consider upgrading cc on this machine."
376             rm -f ppp$$.c
377             exit 1
378           ) || exit 1
379           rm -f ppp$$.c ppp$$.o
380         ) || exit 1
381       fi
382     elif gcc --version >/dev/null 2>&1; then
383       archvariant=gcc$archvariant
384       compiletype=.gcc
385       if [ "$archvariant" = "gcc-64" -o"$archvariant" = "gcc-64x" ]; then
386         ( cd /tmp; touch ppp$$.c
387           gcc -c -m64 ppp$$.c >/dev/null 2>&1 || (
388             echo "gcc is unable to make 64 bit modules, and your $karch system needs them."
389             echo "Consider upgrading gcc on this machine, or switching to Sun WorkShop."
390             rm -f ppp$$.c
391             exit 1
392           ) || exit 1
393           rm -f ppp$$.c ppp$$.o
394         ) || exit 1
395       fi
396     else
397       echo "C compiler not found; hoping for the best."
398     fi
399
400     mkmkf solaris/Makedefs$compiletype Makedefs.com
401     mkmkf solaris/Makefile.sol2$archvariant solaris/Makefile
402 ]])
403
404 echo "
405 $PACKAGE_NAME version $PACKAGE_VERSION
406     Prefix...............: $prefix
407     Runtime Dir..........: $PPPD_RUNTIME_DIR
408     Logfile Dir..........: $PPPD_LOGFILE_DIR
409     Plugin Dir...........: $PPPD_PLUGIN_DIR
410     With OpenSSL.........: ${with_openssl:-yes}
411     With libatm..........: ${with_atm:-no}
412     With libpam..........: ${with_pam:-no}
413     With libpcap.........: ${with_pcap:-no}
414     With libsrp..........: ${with_srp:-no}
415     C Compiler...........: $CC $CFLAGS
416     Linker...............: $LD $LDFLAGS $LIBS
417
418 Features enabled
419     Microsoft Extensions.: ${enable_microsoft_extensions:-yes}
420     Multilink............: ${enable_multilink:-no}
421     Plugins..............: ${enable_plugins:-yes}
422     CBCP.................: ${enable_cbcp:-no}
423     IPXCP................: ${enable_ipxcp:-no}
424     EAP-TLS..............: ${enable_eaptls:-yes}
425     PEAP.................: ${enable_peap:-yes}
426 "