Add --disable-openssl-version-check option
[freeradius.git] / configure.in
1 dnl #############################################################
2 dnl #
3 dnl #  For information about autoconf, see:
4 dnl #
5 dnl #  http://www.gnu.org/software/autoconf/
6 dnl #
7 dnl #  The recommended order is:
8 dnl #
9 dnl #  AC_INIT(file)
10 dnl #  0. checks for compiler, libtool, and command line options
11 dnl #  1. checks for programs
12 dnl #  2. checks for libraries
13 dnl #  3. checks for header files
14 dnl #  4. checks for typedefs
15 dnl #  5. checks for structures and functions
16 dnl #  6. checks for compiler characteristics
17 dnl #  7. checks for library functions
18 dnl #  8. checks for system services
19 dnl #  AC_OUTPUT([file...])
20 dnl #
21 dnl #############################################################
22
23 AC_PREREQ([2.59])
24 export CFLAGS LIBS LDFLAGS CPPFLAGS
25
26 m4_define(PACKAGE_MAIN, freeradius)
27
28 AC_INIT(src/main/radiusd.c)
29 AC_CONFIG_HEADER(src/include/autoconf.h)
30
31 dnl # The version of the software
32
33 RADIUSD_MAJOR_VERSION=`cat VERSION | sed 's/\..*//'`
34 RADIUSD_MINOR_VERSION=`cat VERSION | sed 's/^[[^\.]]*\.//' | sed 's/\..*$//'`
35 RADIUSD_INCRM_VERSION=`cat VERSION | sed 's/^.*\..*\.//' | sed 's/[[\.-]].*$//'`
36
37 RADIUSD_VERSION=`echo | awk -v major="$RADIUSD_MAJOR_VERSION" \
38 -v minor="$RADIUSD_MINOR_VERSION" \
39 -v incrm="$RADIUSD_INCRM_VERSION" \
40 '{ printf "%02i%02i%02i", major, minor, incrm }'`
41
42 dnl # Still useful for custom builds
43 RADIUSD_VERSION_STRING=`cat VERSION`
44 PACKAGE=PACKAGE_MAIN
45
46 dnl #############################################################
47 dnl #
48 dnl #  0. Checks for compiler, libtool, and command line options.
49 dnl #
50 dnl #############################################################
51
52 dnl Get system information
53 AC_CANONICAL_SYSTEM
54
55 dnl Check for GNU cc
56 AC_PROG_CC
57 AC_PROG_CXX
58
59 dnl #
60 dnl # check for AIX, to allow us to use some BSD functions
61 dnl # must be before macros that call the compiler.
62 dnl #
63 AC_AIX
64
65 AC_PROG_GCC_TRADITIONAL
66 AC_PROG_CC_SUNPRO
67 AC_PROG_RANLIB
68
69 dnl #
70 dnl # Set Default CFLAGS
71 dnl #
72 if test "x$GCC" = "xyes"; then
73     CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
74 fi
75
76 dnl Compile in large (2G+) file support.
77 AC_SYS_LARGEFILE
78
79 dnl # check for system bytesex
80 dnl # AC_DEFINES WORDS_BIGENDIAN
81 AC_C_BIGENDIAN
82
83 dnl Find GNU Make.
84 AC_CHECK_PROG(GMAKE, gmake, yes, no)
85 if test $GMAKE = no; then
86   AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
87 else
88   AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
89 fi
90 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
91 if test -z "$makever"; then
92   AC_MSG_ERROR(GNU Make is not installed.  Please download and install it
93                 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
94 fi
95
96 dnl See if we have Git.
97 AC_CHECK_PROG(GIT, git, yes, no)
98
99 AC_ARG_WITH(system-libltdl,
100 [  --with-system-libltdl   Use the libltdl installed in your system (default=use our own)],
101 [
102 LIBLTDL="-lltdl"
103 INCLTDL=-DWITH_SYSTEM_LTDL
104 LTDL_SUBDIRS=
105 ],
106 [
107 dnl If libltdl isn't installable, set it to be installable.
108 [test x"$enable_ltdl_install" = x && enable_ltdl_install=yes]
109 AC_LIBLTDL_INSTALLABLE
110
111 dnl tell Makefile to build ltdl if needed
112 if test x"$enable_ltdl_install" = x"yes"; then
113   LTDL_SUBDIRS=libltdl
114 fi
115 ])
116 AC_SUBST(LTDL_SUBDIRS)
117
118 dnl set this shit so it doesn't force CFLAGS...
119 LTCFLAGS=" "
120
121 dnl use system-wide libtool, if it exists
122 AC_ARG_WITH(system-libtool,
123 [  --with-system-libtool   Use the libtool installed in your system (default=use our own)],
124 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
125  AC_PROG_LIBTOOL],
126 [
127   LIBTOOL="`pwd`/libtool"
128   AC_SUBST(LIBTOOL)
129   dnl ensure that we're looking for dlopen
130   AC_LIBTOOL_DLOPEN
131
132   dnl Figure out how to build shared libraries
133   AC_PROG_LIBTOOL
134 ])
135
136
137 dnl Put this in later, when all distributed modules use autoconf.
138 dnl AC_ARG_WITH(disablemodulefoo,
139 dnl [  --without-rlm_foo       Disables module compilation.  Module list:]
140 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
141 dnl     sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
142 dnl     awk '{print "                            "$0}']))
143
144 AC_ARG_ENABLE(strict-dependencies,
145 [  --enable-strict-dependencies  Fail configure on lack of module dependancy.])
146
147 dnl extra argument: --with-docdir
148 docdir='${datadir}/doc/freeradius'
149 AC_MSG_CHECKING(docdir)
150 AC_ARG_WITH(docdir,
151 [  --with-docdir=DIR       Directory for documentation [DATADIR/doc/freeradius] ],
152 [ case "$withval" in
153     no)
154         docdir=no
155         ;;
156     yes)
157         ;;
158     [[\\/$]]* | ?:[[\\/]]* )
159         docdir="$withval"
160         ;;
161     *)
162         AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
163         ;;
164   esac ]
165 )
166 AC_SUBST(docdir)
167 AC_MSG_RESULT($docdir)
168 if test "x$docdir" = xno; then
169         AC_MSG_WARN(Documentation files will NOT be installed.)
170 fi
171
172 dnl extra argument: --with-logdir
173 logdir='${localstatedir}/log/radius'
174 AC_MSG_CHECKING(logdir)
175 AC_ARG_WITH(logdir,
176 [  --with-logdir=DIR       Directory for logfiles [LOCALSTATEDIR/log/radius] ],
177 [ case "$withval" in
178     no)
179         AC_MSG_ERROR(Need logdir)
180         ;;
181     yes)
182         ;;
183     [[\\/$]]* | ?:[[\\/]]* )
184         logdir="$withval"
185         ;;
186     *)
187         AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
188         ;;
189   esac ]
190 )
191 AC_SUBST(logdir)
192 AC_MSG_RESULT($logdir)
193
194 dnl extra argument: --with-radacctdir
195 radacctdir='${logdir}/radacct'
196 AC_MSG_CHECKING(radacctdir)
197 AC_ARG_WITH(radacctdir,
198 [  --with-radacctdir=DIR   Directory for detail files [LOGDIR/radacct] ],
199 [ case "$withval" in
200     no)
201         AC_MSG_ERROR(Need radacctdir)
202         ;;
203     yes)
204         ;;
205     [[\\/$]]* | ?:[[\\/]]* )
206         radacctdir="$withval"
207         ;;
208     *)
209         AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
210         ;;
211   esac ]
212 )
213 AC_SUBST(radacctdir)
214 AC_MSG_RESULT($radacctdir)
215
216 dnl extra argument: --with-raddbdir
217 raddbdir='${sysconfdir}/raddb'
218 AC_MSG_CHECKING(raddbdir)
219 AC_ARG_WITH(raddbdir,
220 [  --with-raddbdir=DIR     Directory for config files [SYSCONFDIR/raddb] ],
221 [ case "$withval" in
222     no)
223         AC_MSG_ERROR(Need raddbdir)
224         ;;
225     yes)
226         ;;
227     [[\\/$]]* | ?:[[\\/]]* )
228         raddbdir="$withval"
229         ;;
230     *)
231         AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
232         ;;
233   esac ]
234 )
235 AC_SUBST(raddbdir)
236 AC_MSG_RESULT($raddbdir)
237
238 dnl extra argument: --with-ascend-binary
239 ASCEND_BINARY=yes
240 AC_ARG_WITH(ascend-binary,
241 [  --with-ascend-binary    Include support for Ascend binary filter attributes (default=yes)],
242 [ case "$withval" in
243     yes)
244         ;;
245     *)
246         ASCEND_BINARY=""
247   esac ]
248 )
249 if test "X$ASCEND_BINARY" = "Xyes"; then
250   AC_DEFINE(ASCEND_BINARY, [], [Include support for Ascend binary filter attributes])
251 fi
252
253 dnl extra argument: --with-threads
254 WITH_THREADS=yes
255 AC_ARG_WITH(threads,
256 [  --with-threads          Use threads, if available.  (default=yes) ],
257 [ case "$withval" in
258     yes)
259         ;;
260     *)
261         WITH_THREADS=""
262   esac ]
263 )
264
265 dnl extra argument: --with-vmps
266 WITH_VMPS=yes
267 AC_ARG_WITH(vmps,
268 [  --with-vmps             Compile in VMPS support. (default=yes)],
269 [ case "$withval" in
270     yes)
271         ;;
272     *)
273         WITH_VMPS=no
274   esac ]
275 )
276 if test "x$WITH_VMPS" = "xyes"; then
277         AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
278 fi
279
280 dnl extra argument: --with-dhcp
281 WITH_DHCP=yes
282 AC_ARG_WITH(dhcp,
283 [  --with-dhcp             Compile in DHCP support. (default=yes)],
284 [ case "$withval" in
285     yes)
286         ;;
287     *)
288         WITH_DHCP=no
289   esac ]
290 )
291 if test "x$WITH_DHCP" = "xyes"; then
292         AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
293 fi
294
295
296 dnl extra argument: --with-post-proxy-authorize
297 WITH_POST_PROXY_AUTHORIZE=
298 AC_ARG_WITH(post-proxy-authorize,
299 [  --with-post-proxy-authorize  1.x compatibility  (default=no) ],
300 [ case "$withval" in
301     yes)
302         WITH_POST_PROXY_AUTHORIZE=""
303         ;;
304     *)
305         ;;
306   esac ]
307 )
308
309 dnl #
310 dnl #  Allow the user to specify a list of modules to be linked
311 dnl #  statically to the server.
312 dnl #
313 STATIC_MODULES=
314 AC_ARG_WITH(static_modules,
315 [  --with-static-modules=QUOTED-MODULE-LIST],[
316   for i in $withval; do
317     STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
318   done
319 ])
320
321 MODULES=
322 AC_ARG_WITH(modules,
323 [ --with-modules=QUOTED-MODULE-LIST],[
324  for i in $withval; do
325    MODULES="$MODULES $i"
326  done
327 ])
328
329 dnl #
330 dnl #  Enable developer C compiler warnings
331 dnl #
332 AC_ARG_ENABLE(developer,
333 [  --enable-developer               Enables features of interest to developers.],
334 [ case "$enableval" in
335     no)
336         developer=no
337         ;;
338     *)
339         developer=yes
340   esac ]
341 )
342
343 if test -d $srcdir/.git; then
344   if test "x$developer" != "xno"; then
345     dnl turn on the developer flag when taken from a git checkout (not a release)
346     developer="yes"
347   fi
348
349   dnl append the current git hash onto the version string
350   if test "x$GIT" = "xyes"; then
351         RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
352   fi
353 fi
354
355 dnl extra argument: --with-experimental-modules
356 EXPERIMENTAL=
357 AC_ARG_WITH(experimental-modules,
358 [  --with-experimental-modules      Use experimental and unstable modules. (default=no) ],
359 [ case "$withval" in
360     yes)
361         EXPERIMENTAL=yes
362         ;;
363     *)
364   esac ]
365 )
366
367 dnl extra argument: --with-openssl
368 WITH_OPENSSL=yes
369 AC_ARG_WITH(openssl,
370 [  --with-openssl                   Use OpenSSL. (default=yes)],
371 [ case "$withval" in
372     no)
373         WITH_OPENSSL=no
374         ;;
375     *)
376         WITH_OPENSSL=yes
377         ;;
378   esac ]
379 )
380
381 dnl #
382 dnl # extra argument: --with-openssl-includes=dir
383 dnl #
384 OPENSSL_INCLUDE_DIR=
385 AC_ARG_WITH(openssl-includes,
386 [  --with-openssl-includes=DIR      Directory to look for OpenSSL include files],
387 [ case "$withval" in
388     *) OPENSSL_INCLUDE_DIR="$withval"
389         ;;
390   esac ]
391 )
392
393 dnl #
394 dnl # extra argument: --with-openssl-libraries=dir
395 dnl #
396 OPENSSL_LIB_DIR=
397 AC_ARG_WITH(openssl-libraries,
398 [  --with-openssl-libraries=DIR     Directory to look for OpenSSL library files],
399 [ case "$withval" in
400     *) OPENSSL_LIB_DIR="$withval"
401         ;;
402   esac ]
403 )
404
405 dnl #
406 dnl #  extra argument: --disable-openssl-version-check
407 dnl #
408 AC_ARG_ENABLE(openssl-version-check,
409 [  --disable-openssl-version-check  Disable vulnerable OpenSSL version check.]
410 )
411 if test "x$enable_openssl_version_check" != "xno"; then
412   AC_DEFINE(ENABLE_OPENSSL_VERSION_CHECK, [1],
413             [Define to 1 to have OpenSSL version check enabled])
414   openssl_version_check_config="\
415         #
416         #  allow_vulnerable_openssl: Allow the server to start with
417         #  versions of OpenSSL known to have critical vulnerabilities.
418         #
419         #  This check is based on the version number reported by libssl
420         #  and may not reflect patches applied to libssl by
421         #  distribution maintainers.
422         #
423         allow_vulnerable_openssl = no"
424 else
425   openssl_version_check_config=
426 fi
427 AC_SUBST([openssl_version_check_config])
428
429 dnl #
430 dnl #  These next two arguments don't actually do anything.  They're
431 dnl #  place holders so that the top-level configure script can tell
432 dnl #  the user how to configure lower-level modules
433 dnl #
434
435 dnl #
436 dnl # extra argument: --with-rlm-FOO-lib-dir
437 dnl #
438 AC_ARG_WITH(rlm-FOO-lib-dir,
439 [  --with-rlm-FOO-lib-dir=DIR       Directory to look for library files used by module FOO],
440 [ case "$withval" in
441     *)
442         ;;
443   esac ]
444 )
445
446 dnl #
447 dnl # extra argument: --with-rlm-FOO-include-dir
448 dnl #
449 AC_ARG_WITH(rlm-FOO-include-dir,
450 [  --with-rlm-FOO-include-dir=DIR   Directory to look for include files used by module FOO],
451 [ case "$withval" in
452     *)
453         ;;
454   esac ]
455 )
456
457 dnl See what include-style is used by the make program.
458 dnl AC_MSG_CHECKING(include style for make)
459 dnl echo "include /dev/null" > testmake.$$
460 dnl echo "all:" >> testmake.$$
461 dnl make -f testmake.$$ >/dev/null 2>&1
462 dnl if test $? = 0
463 dnl then
464 dnl     INCLUDE=include
465 dnl     IQUOTE=
466 dnl else
467 dnl     INCLUDE=.include
468 dnl     IQUOTE='"'
469 dnl fi
470 dnl rm -f testmake.$$
471 dnl AC_MSG_RESULT(" $INCLUDE")
472 dnl AC_SUBST(INCLUDE)
473 dnl AC_SUBST(IQUOTE)
474
475 dnl extra argument: --with-udpfromto
476 WITH_UDPFROMTO=no
477 AC_ARG_WITH(udpfromto,
478 [  --with-udpfromto        Compile in UDPFROMTO support. (default=no)],
479 [ case "$withval" in
480     yes)
481         WITH_UDPFROMTO=yes
482         ;;
483     *)
484         WITH_UDPFROMTO=no
485   esac ]
486 )
487
488 if test "x$WITH_UDPFROMTO" = "xyes"; then
489         AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
490 fi
491
492 dnl #############################################################
493 dnl #
494 dnl #  1. Checks for programs
495 dnl #
496 dnl #############################################################
497
498 CHECKRAD=checkrad.pl
499 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
500 if test "x$ac_cv_path_PERL" = "x"; then
501   AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
502 fi
503 AC_PATH_PROG(SNMPGET, snmpget)
504 if test "x$ac_cv_path_SNMPGET" = "x"; then
505   AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
506 fi
507
508 AC_PATH_PROG(SNMPWALK, snmpwalk)
509 if test "x$ac_cv_path_SNMPWALK" = "x"; then
510   AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
511 fi
512
513 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
514
515 dnl FIXME This is truly gross.
516 missing_dir=`cd $ac_aux_dir && pwd`
517 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
518 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
519 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
520
521 AC_PATH_PROG(LOCATE,locate)
522 AC_PATH_PROG(DIRNAME,dirname)
523 AC_PATH_PROG(GREP,grep)
524
525 dnl #############################################################
526 dnl #
527 dnl #  2. Checks for libraries
528 dnl #
529 dnl #############################################################
530
531 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
532 old_CFLAGS=$CFLAGS
533 if test "x$WITH_THREADS" = "xyes"; then
534   if test $ac_cv_prog_suncc = "yes"; then
535     CFLAGS="$CFLAGS -mt"
536   fi
537
538   AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
539
540 dnl #
541 dnl # pthread stuff is usually in -lpthread
542 dnl # or in -lc_r, on *BSD
543 dnl #
544 dnl # On Some systems, we need extra pre-processor flags, to get them to
545 dnl # to do the threading properly.
546 dnl #
547   AC_CHECK_LIB(pthread, pthread_create,
548                 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
549                   LIBS="-lpthread $LIBS" ],
550                 AC_CHECK_LIB(c_r, pthread_create,
551                             [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
552                             [ WITH_THREADS="no" ]
553                             )
554                 )
555 fi
556
557 dnl #
558 dnl # If we have NO pthread libraries, remove any knowledge of threads.
559 dnl #
560 if test "x$WITH_THREADS" != "xyes"; then
561   CFLAGS=$old_CFLAGS
562   ac_cv_header_pthread_h="no"
563   WITH_THREADS=no
564 else
565   dnl #
566   dnl #  We need sem_init() and friends, as they're the friendliest
567   dnl #  semaphore functions for threading.
568   dnl #
569   dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
570   dnl # Some systems have them in -lsem
571   dnl # Solaris has them in -lposix4
572   dnl # NetBSD has them in -lsemaphore
573
574   AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
575         [],
576         [AC_MSG_ERROR(-lsem not found.  You may want to download it from ftp://ftp.to.gd-es.com/pub/BSDI/libsem.tar.bz2 or ftp://ftp.freeradius.org/pub/radius/contrib/libsem.tar.gz)]
577    )
578 fi
579
580 dnl Check if we need -lsocket
581 AC_CHECK_LIB(socket, getsockname)
582
583 dnl Check for -lresolv
584 dnl This library may be needed later.
585 AC_CHECK_LIB(resolv, inet_aton)
586
587 dnl Check if we need -lnsl. Usually if we want to
588 dnl link against -lsocket we need to include -lnsl as well.
589 AC_CHECK_LIB(nsl, inet_ntoa)
590
591 dnl Check for OpenSSL libraries.
592 OPENSSL_LIBS=
593 if test "x$WITH_OPENSSL" = xyes; then
594   old_LIBS=$LIBS
595   old_LDFLAGS="$LDFLAGS"
596   if test "x$OPENSSL_LIB_DIR" != "x"; then
597     LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
598   fi
599   AC_CHECK_LIB(crypto, DH_new,
600     [
601         LIBS="-lcrypto $LIBS"
602         AC_DEFINE(HAVE_LIBCRYPTO, 1,
603             [Define to 1 if you have the `crypto' library (-lcrypto).])
604         AC_CHECK_LIB(ssl, SSL_new,
605             [
606                 AC_DEFINE(HAVE_LIBSSL, 1,
607                     [Define to 1 if you have the `ssl' library (-lssl).])
608                 if test "x$OPENSSL_LIB_DIR" != "x"; then
609                     OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
610                 fi
611                 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
612             ], [])
613     ], [])
614   LIBS=$old_LIBS
615   LDFLAGS="$old_LDFLAGS"
616 fi
617
618 AC_CHECK_LIB(ws2_32, htonl)
619
620 dnl Check the pcap library for the RADIUS sniffer.
621 PCAP_LIBS=
622 AC_CHECK_LIB(pcap, pcap_open_live,
623         [ PCAP_LIBS="-lpcap"
624         AC_DEFINE(HAVE_LIBPCAP, 1,
625                 [Define to 1 if you have the `pcap' library (-lpcap).])
626         ],
627         [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
628
629 AC_LIB_READLINE
630
631 dnl #############################################################
632 dnl #
633 dnl #  3. Checks for header files
634 dnl #
635 dnl #############################################################
636
637 dnl #
638 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
639 dnl # getopt will be #included, but won't link.  <sigh>
640 dnl #
641 dnl #
642 case "$host" in
643 *-interix*)
644         CFLAGS="$CFLAGS -D_ALL_SOURCE"
645         ;;
646 *-darwin*)
647         CFLAGS="$CFLAGS -DDARWIN"
648         LIBS="-framework DirectoryService $LIBS"
649         AC_DEFINE([__APPLE_USE_RFC_3542], 1, [Force OSX >= 10.7 Lion to use RFC2292 IPv6 socket options])
650         ;;
651 esac
652
653 AC_HEADER_DIRENT
654 AC_HEADER_STDC
655 AC_HEADER_TIME
656 AC_HEADER_SYS_WAIT
657
658 AC_CHECK_HEADERS( \
659         unistd.h \
660         crypt.h \
661         errno.h \
662         execinfo.h \
663         resource.h \
664         sys/resource.h \
665         getopt.h \
666         malloc.h \
667         utmp.h \
668         utmpx.h \
669         signal.h \
670         sys/select.h \
671         syslog.h \
672         inttypes.h \
673         stdint.h \
674         stdio.h \
675         netdb.h \
676         semaphore.h \
677         arpa/inet.h \
678         netinet/in.h \
679         sys/types.h \
680         sys/socket.h \
681         winsock.h \
682         sys/time.h \
683         sys/wait.h \
684         sys/security.h \
685         fcntl.h \
686         sys/fcntl.h \
687         sys/prctl.h \
688         sys/un.h \
689         glob.h \
690         prot.h \
691         pwd.h \
692         grp.h \
693         stddef.h \
694         fnmatch.h \
695         sia.h \
696         siad.h
697 )
698
699 dnl FreeBSD requires sys/socket.h before net/if.h
700 AC_CHECK_HEADERS(net/if.h, [], [],
701 [#ifdef HAVE_SYS_SOCKET_H
702 # include <sys/socket.h>
703 # endif
704 ])
705
706 REGEX=no
707 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
708 if test "x$ac_cv_header_regex_h" = "xyes"; then
709   REGEX_EXTENDED=no
710   REGEX=yes
711   AC_EGREP_CPP(yes,
712     [#include <regex.h>
713      #ifdef REG_EXTENDED
714        yes
715      #endif
716      ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
717 fi
718 AC_SUBST(REGEX)
719 AC_SUBST(REGEX_EXTENDED)
720
721 dnl #
722 dnl #  other checks which require headers
723 dnl #
724 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
725 then
726   AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
727 fi
728
729 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
730 then
731   AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
732 fi
733
734 dnl #
735 dnl #  Were we told to use OpenSSL, if we were and we find an error, call AC_MSG_FAILURE and exit
736 dnl #
737 if test "x$WITH_OPENSSL" = xyes; then
738   old_LIBS=$LIBS
739   old_LDFLAGS="$LDFLAGS"
740
741   OPENSSL_INCLUDE="-DNO_OPENSSL"
742   OPENSSL_LIBS=
743   if test "x$OPENSSL_LIB_DIR" != "x"; then
744     LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
745   fi
746
747   dnl #
748   dnl #  Check we can link to libssl
749   dnl #
750   AC_CHECK_LIB(crypto, DH_new,
751     [
752       LIBS="-lcrypto $LIBS"
753       AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
754       AC_CHECK_LIB(ssl, SSL_new,
755         [
756           AC_DEFINE(HAVE_LIBSSL, 1, [Define to 1 if you have the `ssl' library (-lssl).])
757           if test "x$OPENSSL_LIB_DIR" != "x"; then
758             OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
759           fi
760           OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
761           LIBS="$OPENSSL_LIBS $LIBS"
762         ],
763         [
764           AC_MSG_FAILURE([failed linking to libssl])
765         ]
766       )
767     ],
768     []
769   )
770
771   dnl #
772   dnl #  Check we can find required headers
773   dnl #
774   old_CPPFLAGS=$CPPFLAGS
775   old_CFLAGS=$CFLAGS
776   if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
777     CPPFLAGS="-I$OPENSSL_INCLUDE_DIR $CPPFLAGS"
778     CFLAGS="-I$OPENSSL_INCLUDE_DIR $CFLAGS"
779   fi
780
781   dnl #
782   dnl #  Stupid RedHat shit
783   dnl #
784   CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
785   AC_CHECK_HEADERS( \
786     openssl/ssl.h \
787     openssl/crypto.h \
788     openssl/err.h \
789     openssl/evp.h \
790     openssl/md5.h \
791     openssl/md4.h \
792     openssl/sha.h \
793     openssl/ocsp.h \
794     openssl/engine.h,
795     [],
796     [
797       AC_MSG_FAILURE([failed locating OpenSSL headers])
798     ]
799   )
800
801   AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
802   AC_EGREP_CPP(yes,
803     [#include <openssl/crypto.h>
804      #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
805      yes
806      #endif
807     ],
808     [
809       AC_MSG_RESULT(yes)
810     ],
811     [
812       AC_MSG_RESULT(no)
813       AC_MSG_FAILURE([OpenSSL version too old])
814     ]
815   )
816
817   if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
818     OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
819   else
820     OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
821   fi
822
823   dnl #
824   dnl #  Now check that the header versions match the library
825   dnl #
826   AC_MSG_CHECKING([OpenSSL library and header version consistency])
827   AC_RUN_IFELSE(
828     [AC_LANG_PROGRAM(
829       [[
830         #include <stdio.h>
831         #include <openssl/opensslv.h>
832         #include <openssl/crypto.h>
833       ]],
834       [[
835         if (SSLeay() == OPENSSL_VERSION_NUMBER) {
836           return 0;
837         } else {
838           printf("library: %lx header: %lx... ", (unsigned long) SSLeay(), (unsigned long) OPENSSL_VERSION_NUMBER);
839           return 1;
840         }
841       ]]
842     )],
843     [
844       AC_MSG_RESULT(yes)
845     ],
846     [
847       AC_MSG_RESULT(no)
848       AC_MSG_FAILURE([OpenSSL library version does not match header version])
849     ]
850   )
851
852   if test "x$OPENSSL_LIBS" = x; then
853     LIBS=$old_LIBS
854     LDFLAGS="$old_LDFLAGS"
855   fi
856   if test "x$OPENSSL_INCLUDE" = x; then
857     CPPFLAGS=$old_CPPFLAGS
858     CFLAGS=$old_CFLAGS
859   fi
860 fi
861
862 AC_SUBST(OPENSSL_INCLUDE)
863 AC_SUBST(OPENSSL_LIBS)
864 export OPENSSL_LIBS
865
866 dnl Check the pcap includes for the RADIUS sniffer.
867 if test "x$PCAP_LIBS" = x; then
868     AC_MSG_NOTICE([skipping test for pcap.h.])
869 else
870     AC_CHECK_HEADER(pcap.h,
871         AC_DEFINE(HAVE_PCAP_H, 1,
872                 [Define to 1 if you have the <pcap.h> header file.]),
873         [ PCAP_LIBS=
874         AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
875         ])
876
877     AC_CHECK_LIB(pcap, pcap_fopen_offline,
878         [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
879                 [Define to 1 if you have the function pcap_fopen_offline.])
880         ])
881     AC_CHECK_LIB(pcap, pcap_dump_fopen,
882         [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
883                 [Define to 1 if you have the function pcap_dump_fopen.])
884         ])
885 fi
886 AC_SUBST(PCAP_LIBS)
887
888 dnl #############################################################
889 dnl #
890 dnl #  4. Checks for typedefs
891 dnl #
892 dnl #############################################################
893
894 dnl #
895 dnl # Ensure that these are defined
896 dnl #
897 AC_TYPE_OFF_T
898 AC_TYPE_PID_T
899 AC_TYPE_SIZE_T
900 AC_TYPE_UID_T
901
902 dnl check for socklen_t
903 FR_CHECK_TYPE_INCLUDE([
904 #ifdef HAVE_SYS_TYPES_H
905 #include <sys/types.h>
906 #endif
907 #ifdef HAVE_SYS_SOCKET_H
908 #include <sys/socket.h>
909 #endif
910 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
911
912 dnl check for uint8_t
913 FR_CHECK_TYPE_INCLUDE([
914 #ifdef HAVE_INTTYPES_H
915 #include <inttypes.h>
916 #endif
917 #ifdef HAVE_STDINT_H
918 #include <stdint.h>
919 #endif
920 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
921
922 dnl check for uint16_t
923 FR_CHECK_TYPE_INCLUDE([
924 #ifdef HAVE_INTTYPES_H
925 #include <inttypes.h>
926 #endif
927 #ifdef HAVE_STDINT_H
928 #include <stdint.h>
929 #endif
930 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
931
932 dnl check for uint32_t
933 FR_CHECK_TYPE_INCLUDE([
934 #ifdef HAVE_INTTYPES_H
935 #include <inttypes.h>
936 #endif
937 #ifdef HAVE_STDINT_H
938 #include <stdint.h>
939 #endif
940 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
941
942 AC_CHECK_TYPE(sig_t, AC_DEFINE(HAVE_SIG_T, 1, [signal action callback function]), [], [
943     #ifdef HAVE_SIGNAL_H
944     #  include <signal.h>
945     #endif
946 ])
947
948 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
949 #ifdef HAVE_NETINET_IN_H
950 #include <netinet/in.h>
951 #endif
952 ])
953
954 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
955 #ifdef HAVE_NETINET_IN_H
956 #include <netinet/in.h>
957 #endif
958 #ifdef HAVE_SYS_SOCKET_H
959 #include <sys/socket.h>
960 #endif
961 ])
962
963 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
964 #ifdef HAVE_NETINET_IN_H
965 #include <netinet/in.h>
966 #endif
967 ])
968
969 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
970 #ifdef HAVE_SYS_TYPES_H
971 #include <sys/types.h>
972 #endif
973 #ifdef HAVE_SYS_SOCKET_H
974 #include <sys/socket.h>
975 #endif
976 #ifdef HAVE_NETDB_H
977 #include <netdb.h>
978 #endif
979 ])
980
981 dnl #############################################################
982 dnl #
983 dnl #  5. Checks for structures and functions
984 dnl #
985 dnl #############################################################
986 AC_CHECK_FUNCS( \
987         getopt_long \
988         lockf \
989         strsignal \
990         sigaction \
991         sigprocmask \
992         pthread_sigmask \
993         snprintf \
994         vsnprintf \
995         setsid \
996         strncasecmp \
997         strcasecmp \
998         localtime_r \
999         ctime_r \
1000         gmtime_r \
1001         strsep \
1002         inet_aton \
1003         inet_pton \
1004         inet_ntop \
1005         setlinebuf \
1006         setvbuf \
1007         getusershell \
1008         initgroups \
1009         getaddrinfo \
1010         getnameinfo \
1011         closefrom \
1012         gettimeofday \
1013         getpeereid \
1014         setuid \
1015         setresuid \
1016         getresuid \
1017         strlcat \
1018         strlcpy
1019 )
1020 RADIUSD_NEED_DECLARATIONS( \
1021         crypt \
1022         strncasecmp \
1023         strcasecmp \
1024         inet_aton \
1025         setlinebuf \
1026         getusershell \
1027         endusershell
1028 )
1029
1030 AC_TYPE_SIGNAL
1031
1032 dnl # check if we have utmpx.h
1033 dnl # if so, check if struct utmpx has entry ut_xtime
1034 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
1035 if test "x$ac_cv_header_utmpx_h" = "xyes"
1036 then
1037  FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
1038  if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
1039  then
1040    AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
1041  fi
1042 fi
1043
1044 dnl # struct ip_pktinfo
1045 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
1046 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
1047 then
1048         AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
1049 fi
1050
1051 dnl # struct in6_pktinfo
1052 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
1053 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
1054 then
1055         AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
1056 fi
1057
1058 dnl #############################################################
1059 dnl #
1060 dnl #  6. Checks for compiler characteristics
1061 dnl #
1062 dnl #############################################################
1063
1064 dnl #
1065 dnl # Ensure that these are defined
1066 dnl #
1067 AC_C_CONST
1068
1069 dnl #
1070 dnl # See if this is OS/2
1071 dnl #
1072 AC_MSG_CHECKING(type of OS)
1073 OS=`uname -s`
1074 AC_MSG_RESULT($OS)
1075 if test "$OS" = "OS/2"; then
1076         LIBPREFIX=
1077 else
1078         LIBPREFIX=lib
1079 fi
1080 AC_SUBST(LIBPREFIX)
1081
1082 AC_MSG_CHECKING(for developer gcc flags)
1083 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
1084   devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef"
1085   CFLAGS="$CFLAGS $devflags"
1086   INSTALLSTRIP=""
1087   AC_MSG_RESULT(yes.  Using $devflags)
1088 else
1089   devflags=""
1090   CFLAGS="$CFLAGS -DNDEBUG"
1091   INSTALLSTRIP=""
1092   AC_MSG_RESULT(no.)
1093 fi
1094
1095 FR_TLS
1096
1097 dnl #############################################################
1098 dnl #
1099 dnl #  7. Checks for library functions
1100 dnl #
1101 dnl #############################################################
1102
1103 old_LIBS="$LIBS"
1104 LIBS="$LIBS $LIBLTDL"
1105 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1106 LIBS="$old_LIBS"
1107
1108 dnl Check for libcrypt
1109 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1110 AC_CHECK_LIB(crypt, crypt,
1111   CRYPTLIB="-lcrypt"
1112 )
1113 if test "$CRYPTLIB" != ""; then
1114   AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1115 else
1116   AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1117 fi
1118
1119 dnl Check for libcipher
1120 AC_CHECK_LIB(cipher, setkey,
1121    CRYPTLIB="${CRYPTLIB} -lcipher"
1122 )
1123 AC_SUBST(CRYPTLIB)
1124
1125 dnl Check the style of gethostbyaddr, in order of preference
1126 dnl GNU (_r eight args)
1127 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1128 dnl SYSV (_r six args)
1129 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1130 dnl BSD (three args, may not be thread safe)
1131 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1132 dnl Tru64 has BSD version, but it is thread safe
1133 dnl     http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1134 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1135 gethostbyaddrrstyle=""
1136 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1137 case "$host" in
1138 *-freebsd*)
1139 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1140 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1141 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1142 dnl style support.
1143         AC_CHECK_DECLS([gethostbyaddr_r], [], [
1144                 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1145                         [style of gethostbyaddr_r functions ])
1146                 gethostbyaddrrstyle=BSD
1147                 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1148         ], [
1149 #ifdef HAVE_NETDB_H
1150 #include <netdb.h>
1151 #endif
1152 ])
1153         ;;
1154 esac
1155 if test "x$gethostbyaddrrstyle" = "x"; then
1156         AC_TRY_LINK([
1157 #include <stdio.h>
1158 #include <netdb.h>
1159 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1160         AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1161         gethostbyaddrrstyle=GNU
1162 ])
1163 fi
1164 if test "x$gethostbyaddrrstyle" = "x"; then
1165         AC_TRY_LINK([
1166 #include <stdio.h>
1167 #include <netdb.h>
1168 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1169                 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1170                 gethostbyaddrrstyle=SYSV
1171         ])
1172 fi
1173 if test "x$gethostbyaddrrstyle" = "x"; then
1174         AC_TRY_LINK([
1175 #include <stdio.h>
1176 #include <netdb.h>
1177 ], [ gethostbyaddr(NULL, 0, 0)  ], [
1178                 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1179                 gethostbyaddrrstyle=BSD
1180         ])
1181 fi
1182
1183 if test "x$gethostbyaddrrstyle" = "x"; then
1184         AC_MSG_RESULT([none!  It must not exist, here.])
1185 else
1186         AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1187 fi
1188
1189 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1190         AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1191 fi
1192
1193 dnl Check the style of gethostbyname, in order of preference
1194 dnl GNU (_r seven args)
1195 dnl SYSV (_r five args)
1196 dnl BSD (two args, may not be thread safe)
1197 dnl Tru64 has BSD version, but it _is_ thread safe
1198 dnl     http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1199 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1200 gethostbynamerstyle=""
1201 AC_MSG_CHECKING([gethostbyname_r() syntax])
1202 AC_TRY_LINK([
1203 #include <stdio.h>
1204 #include <netdb.h>
1205 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1206         AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1207         gethostbynamerstyle=GNU
1208 ])
1209 if test "x$gethostbynamerstyle" = "x"; then
1210         AC_TRY_LINK([
1211 #include <stdio.h>
1212 #include <netdb.h>
1213 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1214                 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1215                 gethostbynamerstyle=SYSV
1216         ])
1217 fi
1218 if test "x$gethostbynamerstyle" = "x"; then
1219         AC_TRY_LINK([
1220 #include <stdio.h>
1221 #include <netdb.h>
1222 ], [ gethostbyname(NULL)  ], [
1223                 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1224                 gethostbynamerstyle=BSD
1225         ])
1226 fi
1227
1228 if test "x$gethostbynamerstyle" = "x"; then
1229         AC_MSG_RESULT([none!  It must not exist, here.])
1230 else
1231         AC_MSG_RESULT([${gethostbynamerstyle}-style])
1232 fi
1233
1234 if test "x$gethostbynamerstyle" = "xBSD"; then
1235         AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1236 fi
1237
1238 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1239 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1240 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1241 ctimerstyle=""
1242 AC_MSG_CHECKING([ctime_r() syntax])
1243 AC_TRY_LINK([
1244 #include <time.h>
1245 ], [ ctime_r(NULL, NULL, 0) ], [
1246         AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1247         ctimerstyle="SOLARIS"
1248 ])
1249 if test "x$ctimerstyle" = "x"; then
1250         AC_TRY_LINK([
1251 #include <time.h>
1252 ], [ ctime_r(NULL, NULL) ], [
1253                 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1254                 ctimerstyle="POSIX"
1255         ])
1256 fi
1257
1258 if test "x$ctimerstyle" = "x"; then
1259         AC_MSG_RESULT([none!  It must not exist, here.])
1260 else
1261         AC_MSG_RESULT([${ctimerstyle}-style])
1262 fi
1263
1264 AC_SUBST(HOSTINFO, $host)
1265
1266 if test "x$WITH_POST_PROXY_AUTHORIZE" != "x"; then
1267         AC_DEFINE(WITH_POST_PROXY_AUTHORIZE, 1, [1.x compatibility])
1268 fi
1269
1270 dnl #############################################################
1271 dnl #
1272 dnl #  8. Checks for system services
1273 dnl #
1274 dnl #############################################################
1275
1276 dnl #
1277 dnl # Figure out where libtool is located,
1278 dnl #
1279 top_builddir=`pwd`
1280 export top_builddir
1281 AC_MSG_RESULT([top_builddir=$top_builddir])
1282 dnl # AC_SUBST(top_builddir)
1283 AC_SUBST(LIBLTDL)
1284 AC_SUBST(INCLTDL)
1285
1286 dnl import libtool stuff
1287
1288 dnl #############################################################
1289 dnl #
1290 dnl #  Configure in any module directories.
1291 dnl #
1292 dnl #############################################################
1293
1294 mysubdirs="$LIBLTDLPATH"
1295 if test "x$EXPERIMENTAL" = "xyes"; then
1296   bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1297   dnl # get rid of LF's.
1298   mysubdirs=`echo $mysubdirs $bar`
1299 else
1300   dnl #
1301   dnl # Find 'configure' in ONLY the stable modules
1302   dnl #
1303   for bar in `cat "${srcdir}"/src/modules/stable`; do
1304     if test -f "${srcdir}"/src/modules/$bar/configure; then
1305       mysubdirs="$mysubdirs src/modules/$bar"
1306     fi
1307   done
1308 fi
1309
1310 dnl ############################################################
1311 dnl # make modules by list
1312 dnl #############################################################
1313 if test "x$EXPERIMENTAL" = "xyes"; then
1314   for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1315     MODULES="$MODULES $foo"
1316   done
1317 else
1318    dnl #
1319    dnl # make ONLY the stable modules
1320    dnl #
1321    for foo in `cat "${srcdir}"/src/modules/stable`; do
1322     MODULES="$MODULES $foo"
1323    done
1324 fi
1325
1326 dnl #
1327 dnl #  Don't change the variable name here.  Autoconf goes bonkers
1328 dnl #  if you do.
1329 dnl #
1330 AC_CONFIG_SUBDIRS($LTDL_SUBDIRS $mysubdirs)
1331 AC_SUBST(MODULES)
1332
1333 dnl #############################################################
1334 dnl #
1335 dnl #  And finally, output the results.
1336 dnl #
1337 dnl #############################################################
1338
1339 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1340 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1341 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main   && chmod +x checkrad.pl radlast radtest)])
1342 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts    && chmod +x rc.radiusd radwatch radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1343
1344 dnl #
1345 dnl #  Substitute whatever libraries we found to be necessary
1346 dnl #
1347 AC_SUBST(LIBS)
1348 AC_SUBST(INSTALLSTRIP)
1349
1350 USE_SHARED_LIBS=$enable_shared
1351 AC_SUBST(USE_SHARED_LIBS)
1352 USE_STATIC_LIBS=$enable_static
1353 AC_SUBST(USE_STATIC_LIBS)
1354 AC_SUBST(STATIC_MODULES)
1355 AC_SUBST(RADIUSD_MAJOR_VERSION)
1356 AC_SUBST(RADIUSD_MINOR_VERSION)
1357 AC_SUBST(RADIUSD_INCRM_VERSION)
1358 AC_SUBST(RADIUSD_VERSION)
1359 AC_SUBST(RADIUSD_VERSION_STRING)
1360 AC_SUBST(RADIUSD_VERSION_COMMIT)
1361
1362 AC_OUTPUT(\
1363         ./Make.inc \
1364         ./src/include/build-radpaths-h \
1365         ./src/main/Makefile \
1366         ./src/main/checkrad.pl \
1367         ./src/main/radlast \
1368         ./src/main/radtest \
1369         ./scripts/rc.radiusd \
1370         ./scripts/radwatch \
1371         ./scripts/radiusd.cron.daily \
1372         ./scripts/radiusd.cron.monthly \
1373         ./scripts/cryptpasswd \
1374         ./raddb/dictionary \
1375         ./raddb/radrelay.conf \
1376         ./raddb/radiusd.conf
1377 )