xref: /netbsd-src/external/bsd/ppp/dist/configure.ac (revision f12839c5f795a8def46f685de6698463dbd213a9)
1AC_PREREQ([2.69])
2AC_INIT([ppp],
3        [2.5.2],
4        [https://github.com/ppp-project/ppp])
5
6m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
7AC_CONFIG_MACRO_DIR([m4])
8
9AM_INIT_AUTOMAKE
10AM_MAINTAINER_MODE([enable])
11
12AC_LANG(C)
13AC_CONFIG_SRCDIR([pppd/main.c])
14AC_CONFIG_HEADERS([pppd/config.h pppd/pppdconf.h pppd/plugins/pppoe/config.h])
15AC_ENABLE_STATIC(no)
16
17# Checks for programs.
18AC_PROG_CC
19AM_PROG_CC_C_O
20AC_PROG_INSTALL
21AC_PROG_LN_S
22LT_INIT
23
24PKG_PROG_PKG_CONFIG
25
26AC_CANONICAL_HOST
27build_linux=no
28build_sunos=no
29
30case "${host_os}" in
31    linux*)
32	build_linux=yes
33	;;
34    solaris2*)
35	build_sunos=yes
36	;;
37    netbsd*)
38	build_netbsd=yes
39	;;
40    *)
41	AC_MSG_ERROR(["OS ${host_os} not supported"])
42	;;
43esac
44
45AM_CONDITIONAL([LINUX], [test "x${build_linux}" = "xyes" ])
46AM_CONDITIONAL([SUNOS], [test "x${build_sunos}" = "xyes" ])
47AM_CONDITIONAL([NETBSD], [test "x${build_netbsd}" = "xyes" ])
48AM_COND_IF([SUNOS],
49      CFLAGS="$CFLAGS -DSOL2 -DSRV4")
50
51#
52# Checks for header files, these will set the HAVE_[FILE]_H macros in config.h
53AC_HEADER_STDBOOL
54AC_CHECK_HEADERS([  \
55    asm/types.h     \
56    crypt.h         \
57    paths.h         \
58    shadow.h        \
59    stddef.h        \
60    stdarg.h        \
61    sys/dlpi.h      \
62    sys/ioctl.h     \
63    sys/socket.h    \
64    sys/time.h      \
65    sys/uio.h       \
66    time.h          \
67    unistd.h        \
68    utmp.h])
69
70#
71# Check for linux specific headers, required by pppoe, or pppol2tp
72AM_COND_IF([LINUX], [
73    AC_CHECK_HEADERS([          \
74        net/bpf.h               \
75        net/if.h                \
76        net/if_types.h          \
77        net/if_arp.h            \
78        linux/if.h              \
79        linux/if_ether.h        \
80        linux/if_packet.h       \
81        netinet/if_ether.h      \
82        netpacket/packet.h])
83
84    AC_MSG_CHECKING([for struct sockaddr_ll in <linux/if_packet.h>])
85    AC_COMPILE_IFELSE(
86	[AC_LANG_PROGRAM([@%:@include <linux/if_packet.h>], [sizeof(struct sockaddr_ll)])],
87	[AC_MSG_RESULT([yes])
88	 AC_DEFINE(HAVE_STRUCT_SOCKADDR_LL, 1, [Struct sockaddr_ll is present on system])
89	],
90	AC_MSG_RESULT([no]))
91])
92
93
94AC_CHECK_SIZEOF(unsigned int)
95AC_CHECK_SIZEOF(unsigned long)
96AC_CHECK_SIZEOF(unsigned short)
97
98# Checks for library functions.
99AC_CHECK_FUNCS([    \
100    mmap            \
101    logwtmp         \
102    strerror])
103
104#
105# If libc doesn't provide logwtmp, check if libutil provides logwtmp(), and if so link to it.
106AS_IF([test "x${ac_cv_func_logwtmp}" != "xyes"], [
107    AC_CHECK_LIB([util], [logwtmp], [
108        AC_DEFINE(HAVE_LOGWTMP, 1, [System provides the logwtmp() function])
109        AC_SUBST([UTIL_LIBS], ["-lutil"])
110    ])
111])
112
113#
114# Check if libcrypt have crypt() function
115AC_CHECK_LIB([crypt], [crypt],
116    AC_SUBST([CRYPT_LIBS], ["-lcrypt"]))
117
118#
119# Should pppd link with -lsystemd (Linux only)
120AC_ARG_ENABLE([systemd],
121    AS_HELP_STRING([--enable-systemd], [Enable support for systemd notification]))
122AM_CONDITIONAL(WITH_SYSTEMD, test "x${enable_systemd}" = "xyes")
123AM_COND_IF([WITH_SYSTEMD],
124    AC_DEFINE([SYSTEMD], 1, [Enable support for systemd notifications]))
125AS_IF([test "x${enable_systemd}" = "xyes"], [
126	PKG_CHECK_MODULES([SYSTEMD], [libsystemd])])
127
128#
129# Enable Callback Protocol Support, disabled by default
130AC_ARG_ENABLE([cbcp],
131    AS_HELP_STRING([--enable-cbcp], [Enable Callback Protocol]))
132AM_CONDITIONAL(PPP_WITH_CBCP, test "x${enable_cbcp}" = "xyes")
133AM_COND_IF([PPP_WITH_CBCP],
134    AC_DEFINE([PPP_WITH_CBCP], 1, [Have Callback Protocol support]))
135
136#
137# Disable Microsoft extensions will remove CHAP, MPPE and PEAP support
138AC_ARG_ENABLE([microsoft-extensions],
139    AS_HELP_STRING([--disable-microsoft-extensions], [Disable Microsoft CHAP / MPPE / PEAP extensions]))
140
141AM_CONDITIONAL(PPP_WITH_CHAPMS, test "x${enable_microsoft_extensions}" != "xno")
142AM_COND_IF([PPP_WITH_CHAPMS],
143    AC_DEFINE([PPP_WITH_CHAPMS], 1, [Have Microsoft CHAP support]))
144
145AM_CONDITIONAL(PPP_WITH_MPPE, test "x${build_sunos}" != "xyes" && test "x${enable_microsoft_extensions}" != "xno")
146AM_COND_IF([PPP_WITH_MPPE],
147    AC_DEFINE([PPP_WITH_MPPE], 1, [Have Microsoft MPPE support]))
148
149#
150# Enable Microsoft LAN Manager support, depends on Microsoft Extensions
151AC_ARG_ENABLE([mslanman],
152    AS_HELP_STRING([--enable-mslanman], [Enable Microsoft LAN Manager support]))
153AS_IF([test "x${enable_mslanman}" = "xyes" && test "x${enable_microsoft_extensions}" != "xno"],
154    AC_DEFINE([PPP_WITH_MSLANMAN], 1, [Have Microsoft LAN Manager support]))
155
156#
157# Disable IPv6 support
158AC_ARG_ENABLE([ipv6cp],
159    AS_HELP_STRING([--disable-ipv6cp], [Disable IPv6 Control Protocol]))
160AM_CONDITIONAL(PPP_WITH_IPV6CP, test "x${enable_ipv6cp}" != "xno")
161AM_COND_IF([PPP_WITH_IPV6CP],
162    AC_DEFINE(PPP_WITH_IPV6CP, 1, [Have IPv6 Control Protocol]))
163
164#
165# Disable Multilink support
166AC_ARG_ENABLE([multilink],
167    AS_HELP_STRING([--enable-multilink], [Enable multilink support]))
168AM_CONDITIONAL(PPP_WITH_MULTILINK, test "x${enable_multilink}" = "xyes")
169AM_COND_IF([PPP_WITH_MULTILINK],
170    AC_DEFINE([PPP_WITH_MULTILINK], 1, [Have multilink support]))
171AS_IF([test "x${build_sunos}" = "xyes" && test "x${enable_multilink}" = "xyes"],
172    [AC_MSG_ERROR([Multilink is not supported on SunOS])])
173
174#
175# Multilink require Trivial Database Support
176AM_CONDITIONAL(PPP_WITH_TDB, test "x${enable_multilink}" = "xyes")
177AM_COND_IF([PPP_WITH_TDB],
178    AC_DEFINE([PPP_WITH_TDB], 1, [Include TDB support]))
179
180#
181# Enable support for loadable plugins
182AC_ARG_ENABLE([plugins],
183    AS_HELP_STRING([--disable-plugins], [Disable support for loadable plugins]))
184AS_IF([test "x$enable_plugins" != "xno"],
185    AC_DEFINE([PPP_WITH_PLUGINS], 1, [Have support for loadable plugins]))
186AM_CONDITIONAL(PPP_WITH_PLUGINS, test "x${enable_plugins}" != "xno")
187
188#
189# Disable EAP-TLS support
190AC_ARG_ENABLE([eaptls],
191    AS_HELP_STRING([--disable-eaptls], [Disable EAP-TLS authentication support]))
192AS_IF([test "x$enable_eaptls" != "xno"],
193    AC_DEFINE([PPP_WITH_EAPTLS], 1, [Have EAP-TLS authentication support]))
194AM_CONDITIONAL(PPP_WITH_EAPTLS, test "x${enable_eaptls}" != "xno")
195
196#
197# Disable PEAP support
198AC_ARG_ENABLE([peap],
199    AS_HELP_STRING([--disable-peap], [Disable PEAP authentication support]))
200AS_IF([test "x${enable_peap}" != "xno" && test "x${enable_microsoft_extensions}" != "xno"],
201    AC_DEFINE([PPP_WITH_PEAP], 1, [Have PEAP authentication support]))
202AM_CONDITIONAL([PPP_WITH_PEAP], test "x${enable_peap}" != "xno" && test "x${enable_microsoft_extensions}" != "xno")
203
204#
205# Disable OpenSSL engine support
206AC_ARG_ENABLE([openssl-engine],
207    AS_HELP_STRING([--disable-openssl-engine], [Disable OpenSSL engine support]))
208AS_IF([test "x$enable_openssl_engine" != "xno"], [],
209    AC_DEFINE([OPENSSL_NO_ENGINE], 1, [OpenSSL engine support]))
210
211#
212# Specify runtime directory
213AC_ARG_WITH([plugin-dir],
214	AS_HELP_STRING([--with-plugin-dir=DIR],[Specify the plugin directory for pppd]))
215AS_IF([test -n "$with_plugin_dir"],
216	[PPPD_PLUGIN_DIR="$with_plugin_dir"],
217	[PPPD_PLUGIN_DIR="${libdir}/pppd/$VERSION"])
218AC_SUBST(PPPD_PLUGIN_DIR, "$PPPD_PLUGIN_DIR", [The pppd plugin directory])
219
220#
221# Specify runtime directory
222AC_ARG_WITH([runtime-dir],
223	AS_HELP_STRING([--with-runtime-dir=DIR],[Specify the runtime directory for pppd]))
224AS_IF([test -n "$with_runtime_dir"],
225	[PPPD_RUNTIME_DIR="$with_runtime_dir"],
226	[PPPD_RUNTIME_DIR="${runstatedir}/pppd"])
227AC_SUBST(PPPD_RUNTIME_DIR)
228
229#
230# Specify runtime directory
231AC_ARG_WITH([logfile-dir],
232	AS_HELP_STRING([--with-logfile-dir=DIR],[Specify the log directory for pppd]))
233AS_IF([test -n "$with_logfile_dir"],
234	[PPPD_LOGFILE_DIR="$with_logfile_dir"],
235	[PPPD_LOGFILE_DIR="${localstatedir}/log/ppp"])
236AC_SUBST(PPPD_LOGFILE_DIR)
237
238#
239# System CA certificates path
240AC_ARG_WITH(system-ca-path,
241    AS_HELP_STRING([--with-system-ca-path=/path/to/ssl/certs], [path to system CA certificates]),
242    [
243       case "$withval" in
244       "" | y | ye | yes)
245            with_system_ca_path="${sysconfdir}/ssl/certs"
246            ;;
247       n | no)
248            ;;
249       *)
250            with_system_ca_path="$withval"
251            ;;
252       esac
253    ],[with_system_ca_path="${sysconfdir}/ssl/certs"])
254AM_CONDITIONAL(PPP_WITH_SYSTEM_CA_PATH, [test "$with_system_ca_path" != "no"])
255AM_COND_IF(PPP_WITH_SYSTEM_CA_PATH, [
256    SYSTEM_CA_PATH="$with_system_ca_path"
257])
258AC_SUBST(SYSTEM_CA_PATH)
259
260#
261# Check for OpenSSL
262AX_CHECK_OPENSSL
263AM_CONDITIONAL(PPP_WITH_OPENSSL, test "x${with_openssl}" != "xno")
264AM_COND_IF([PPP_WITH_OPENSSL],
265    AC_DEFINE([PPP_WITH_OPENSSL], 1, [PPP is compiled with openssl support]))
266
267#
268# Check if OpenSSL has compiled in support for various ciphers
269AS_IF([test "x${with_openssl}" != "xno" ], [
270    AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_MD4], [md4])
271    AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_MD5], [md5])
272    AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_DES], [des])
273    AX_CHECK_OPENSSL_DEFINE([OPENSSL_NO_SHA], [sha])
274], [
275    AS_IF([test "x${enable_eaptls}" != "xno" || test "x${enable_peap}" != "xno"],
276        [AC_MSG_ERROR([OpenSSL not found, and if this is your intention then run configure --disable-eaptls and --disable-peap])])
277])
278
279AM_CONDITIONAL([OPENSSL_HAVE_MD4], test "x${ac_cv_openssl_md4}" = "xyes")
280AM_COND_IF([OPENSSL_HAVE_MD4],
281    AC_DEFINE([OPENSSL_HAVE_MD4], 1, [Use MD4 included with openssl]))
282
283AM_CONDITIONAL([OPENSSL_HAVE_MD5], test "x${ac_cv_openssl_md5}" = "xyes")
284AM_COND_IF([OPENSSL_HAVE_MD5],
285    AC_DEFINE([OPENSSL_HAVE_MD5], 1, [Use MD5 included with openssl]))
286
287AM_CONDITIONAL([OPENSSL_HAVE_SHA], test "x${ac_cv_openssl_sha}" = "xyes")
288AM_COND_IF([OPENSSL_HAVE_SHA],
289    AC_DEFINE([OPENSSL_HAVE_SHA], 1, [Use SHA included with openssl]))
290
291AM_CONDITIONAL([OPENSSL_HAVE_DES], test "x${ac_cv_openssl_des}" = "xyes")
292AM_COND_IF([OPENSSL_HAVE_DES],
293    AC_DEFINE([OPENSSL_HAVE_DES], 1, [Use DES included with openssl]))
294
295#
296# With libsrp support
297AX_CHECK_SRP([
298    AC_DEFINE([PPP_WITH_SRP], 1, [Support for libsrp authentication module])])
299
300#
301# With libatm support
302AX_CHECK_ATM
303
304#
305# With libpam support
306AX_CHECK_PAM(AC_DEFINE([PPP_WITH_PAM], 1, [Support for Pluggable Authentication Modules]))
307AM_CONDITIONAL(PPP_WITH_PAM, test "x${with_pam}" = "xyes")
308
309#
310# With libpcap support, activate pppd on network activity
311AX_CHECK_PCAP
312
313#
314# SunOS provides a version of libpcap that would work, but SunOS has no support for activity filter
315AM_CONDITIONAL([PPP_WITH_FILTER], [ test "x${with_pcap}" = "xyes" && test "x${build_sunos}" != "xyes" ])
316AM_COND_IF([PPP_WITH_FILTER], [
317    AC_DEFINE([PPP_WITH_FILTER], 1, [Have packet activity filter support])], [
318    AS_IF([test "x${build_sunos}" = "xyes"], [
319        AC_MSG_WARN([Packet activity filter not supported on SunOS])
320        with_pcap="no"
321        ])
322    ])
323
324AC_DEFINE_UNQUOTED(PPPD_VERSION, "$VERSION", [Version of pppd])
325
326AC_CONFIG_FILES([
327    Makefile
328    chat/Makefile
329    include/Makefile
330    pppd/Makefile
331    pppd/pppd.pc
332    pppd/plugins/Makefile
333    pppd/plugins/pppoe/Makefile
334    pppd/plugins/pppoatm/Makefile
335    pppd/plugins/pppol2tp/Makefile
336    pppd/plugins/radius/Makefile
337    pppdump/Makefile
338    pppstats/Makefile
339    scripts/Makefile
340    ])
341AC_OUTPUT
342
343
344echo "
345$PACKAGE_NAME version $PACKAGE_VERSION
346    Prefix...............: $prefix
347    Runtime Dir..........: $PPPD_RUNTIME_DIR
348    Logfile Dir..........: $PPPD_LOGFILE_DIR
349    Plugin Dir...........: $PPPD_PLUGIN_DIR
350    System CA Path ......: ${SYSTEM_CA_PATH:-not set}
351    With OpenSSL.........: ${with_openssl:-yes}
352    With libatm..........: ${with_atm:-no}
353    With libpam..........: ${with_pam:-no}
354    With libpcap.........: ${with_pcap:-no}
355    With libsrp..........: ${with_srp:-no}
356    C Compiler...........: $CC $CFLAGS
357    Linker...............: $LD $LDFLAGS $LIBS
358
359Features enabled
360    Microsoft Extensions.: ${enable_microsoft_extensions:-yes}
361    Multilink............: ${enable_multilink:-no}
362    Plugins..............: ${enable_plugins:-yes}
363    CBCP.................: ${enable_cbcp:-no}
364    IPV6CP...............: ${enable_ipv6cp:-yes}
365    EAP-TLS..............: ${enable_eaptls:-yes}
366    systemd notifications: ${enable_systemd:-no}
367"
368