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