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