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