1# This file is part of GNU Radius. 2# Copyright (C) 2000,2001,2002,2003,2004,2005, 3# 2007,2008 Free Software Foundation, Inc. 4# 5# Written by Sergey Poznyakoff 6# 7# GNU Radius is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 3 of the License, or 10# (at your option) any later version. 11# 12# GNU Radius is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with GNU Radius; if not, write to the Free Software Foundation, 19# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 21AC_PREREQ(2.61) 22 23AC_REVISION($Revision$) 24AC_INIT([GNU Radius], [1.6.1], [bug-gnu-radius@gnu.org]) 25AC_CONFIG_SRCDIR(radiusd/radiusd.c) 26AC_CONFIG_MACRO_DIR([m4]) 27AC_CONFIG_AUX_DIR([build-aux]) 28AC_CONFIG_LIBOBJ_DIR([gnu]) 29AC_CANONICAL_SYSTEM 30AM_INIT_AUTOMAKE(no-exeext) 31AC_CONFIG_HEADERS([config.h]) 32 33AC_SUBST(BUILD_TARGET) 34AC_SUBST(RADIUS_PID) 35 36AC_SUBST(RADIUS_INCLUDE_PATH, 37 ['-I$(top_builddir) -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)/include/radius -I$(top_srcdir)/include/radius -I$(top_srcdir)/lib -I$(top_srcdir)/gnu -I$(top_builddir)/gnu']) 38 39dnl Library versioning 40AC_SUBST(VI_CURRENT, 1) 41AC_SUBST(VI_REVISION, 0) 42AC_SUBST(VI_AGE, 0) 43 44## * Checks for programs. 45AC_PROG_CC 46gl_EARLY 47AM_PROG_CC_STDC 48AC_PROG_YACC 49AM_PROG_LEX 50AC_PROG_AWK 51 52AC_PATH_PROG(PS, ps, no, $PATH:/usr/ccs/bin:/usr/bin:/usr/local/bin) 53AC_ARG_VAR(PS,[Full path to ps binary]) 54 55AC_PROG_LN_S 56AM_PROG_LIBTOOL 57 58AC_SUBST(M4,['`cd $(top_srcdir); pwd`/build-aux/missing --run m4']) 59RA_MAINTAINER_MODE 60RA_LD_VERSIONING 61 62### Check if Guile is installed. 63AC_ARG_WITH(guile, 64 AC_HELP_STRING([--without-guile], 65 [do not compile Guile support]), 66 [USE_GUILE=$withval], 67 [USE_GUILE=yes]) 68 69AC_ARG_WITH(server-guile, 70 AC_HELP_STRING([--with-server-guile], [compile server Guile support]), 71 [USE_SERVER_GUILE=$withval], 72 [USE_SERVER_GUILE=yes]) 73 74if test $USE_GUILE = yes; then 75 RA_CHECK_GUILE(, 76 [LIBRADSCM="libradscm.la libservscm.a" 77 RADSCM=radscm 78 RADSESSION=radsession 79 RADSCM_BUILT_SOURCES_LIST='${RADSCM_BUILT_SOURCE_FILES}' 80 RADSCM_PKGDATA='${RADSCM_PKGDATA_FILES}' 81 GUILE_BINDIR=`guile-config info bindir` 82 if test $USE_SERVER_GUILE = yes; then 83 AC_DEFINE(USE_SERVER_GUILE,1, 84 [Define this to enable Guile interface]) 85 RA_RADIUSD_LDADD(../radscm/libradscm.la ../radscm/libservscm.a $GUILE_LIBS) 86 fi], 87 [USE_GUILE=no]) 88fi 89 90AC_SUBST(GUILE_CONFIG, ["# "]) 91if test "$USE_GUILE" = yes; then 92 GUILE_CONFIG= 93fi 94 95# We used to have 'case' here that determined the Guile snarfer version 96# to use. Now that we don't support 1.4 any more, it is gone as well. 97# Hopefully, next versions of Guile will install the snarfer, so I 98# be able to get rid from scripts/guile once and for all. For the 99# time being, let's assume the shipped 1.6-compatible snarfer will 100# work for all future versions of Guile. If it does not, please report 101# to <bug-gnu-radius@gnu.org>. Make sure to include a copy of your config.log, 102# and any relevant error messages, produced when compiling/running. 103 104GUILE_SNARF_VERSION="1.6" 105 106AC_SUBST(GUILE_INCLUDES) 107AC_SUBST(GUILE_LIBS) 108AC_SUBST(GUILE_SNARF_VERSION) 109AC_SUBST(GUILE_BINDIR) 110AC_SUBST(LIBRADSCM) 111AC_SUBST(RADSCM) 112AC_SUBST(RADSESSION) 113AC_SUBST(RADSCM_BUILT_SOURCES_LIST) 114AC_SUBST(RADSCM_PKGDATA) 115 116### Check for Emacs site-lisp directory 117AM_PATH_LISPDIR 118 119## * Check for preprocessor capabilities 120AC_MSG_CHECKING(whether compiler defines __FUNCTION__) 121AC_TRY_RUN( 122main() { return strcmp(__FUNCTION__,"main"); }, 123 AC_MSG_RESULT(yes), 124 AC_DEFINE_UNQUOTED(__FUNCTION__, (char*)0, 125 [Defined if your compiler does not define it]) 126 AC_MSG_RESULT(no), 127 AC_MSG_RESULT(don't know)) 128 129## ************************************* 130## add any additional libraries/includes 131## ************************************* 132## For backward compatibility, support --with-include-path ... 133if test "${with_include_path+set}" = set; then 134 for path in `echo $with_include_path | sed 's/:/ /g'` 135 do 136 CPPFLAGS="$CPPFLAGS -I$path" 137 done 138fi 139## ... and --with-lib-path, but do not promote them. 140if test "${with_lib_path+set}" = set; then 141 for path in `echo $with_lib_path | sed 's/:/ /g'` 142 do 143 LIBS="$LIBS -L$path" 144 done 145fi 146 147 148## * Checks for libraries. 149AC_SEARCH_LIBS(socket, socket) 150AC_SEARCH_LIBS(gethostbyaddr, nsl) 151AC_SEARCH_LIBS(crypt, crypt) 152 153USE_LOADABLE_MODULES=no 154if test "$enable_shared" = yes; then 155 AC_CHECK_LIB(ltdl, lt_dlinit,[ 156 AC_DEFINE(HAVE_LIBLTDL, 157 1, 158 [Define to 1 if you have the `ltdl' library (-lltdl).]) 159 RA_RADIUSD_LDADD([-lltdl]) 160 USE_LOADABLE_MODULES=yes]) 161fi 162if test $USE_LOADABLE_MODULES = yes; then 163 AC_DEFINE(USE_LOADABLE_MODULES,1, 164 [Define if radiusd is able to use loadable modules]) 165fi 166 167## * Checks for header files. 168 169AC_HEADER_STDC 170AC_HEADER_SYS_WAIT 171AC_CHECK_HEADERS(fcntl.h malloc.h strings.h\ 172 sys/file.h sys/time.h sys/types.h unistd.h\ 173 ctype.h sys/socket.h socket.h netinet/in.h arpa/inet.h\ 174 netdb.h stdarg.h varargs.h termcap.h termios.h termio.h sgtty.h\ 175 crypt.h sys/uio.h sys/select.h sys/resources.h libintl.h) 176 177AC_TYPE_PID_T 178AC_TYPE_SIZE_T 179AC_TYPE_OFF_T 180AC_TYPE_SIGNAL 181AC_CHECK_SIZEOF(uint32_t) 182AC_CHECK_SIZEOF(unsigned long) 183AC_CHECK_SIZEOF(unsigned int) 184 185AC_CHECK_TYPE(socklen_t, , AC_DEFINE(socklen_t, int, [Define to int if <sys/types.h> does not define]), 186[ 187#if HAVE_SYS_TYPES_H 188# include <sys/types.h> 189#endif 190#ifdef HAVE_SYS_SOCKET_H 191# include <sys/socket.h> 192#endif 193#ifdef HAVE_SOCKET_H 194# include <socket.h> 195#endif 196]) 197 198AC_CHECK_MEMBERS([struct passwd.pw_expire, struct passwd.pw_change], , , 199 [#include <pwd.h>]) 200 201## Check for shadow support 202AC_CHECK_HEADER([shadow.h], 203 [AC_CHECK_FUNCS(getspnam) 204 AC_CHECK_TYPES(struct spwd, , , 205 [ #include <shadow.h> ]) 206 AC_CHECK_MEMBERS([struct spwd.sp_expire], , , 207 [ #include <shadow.h> ])], 208 [AC_CHECK_HEADER([sys/security.h], 209 [AC_CHECK_HEADER([prot.h], 210 [AC_CHECK_TYPES(struct pr_passwd, , , 211 [ #include <sys/security.h> 212 #include <prot.h> ]) 213 AC_CHECK_FUNCS(getprpwnam) 214 AC_CHECK_MEMBERS([struct pr_passwd.uflg.fg_lock])])])]) 215 216AH_BOTTOM([ 217#if defined(HAVE_GETSPNAM) && defined(HAVE_STRUCT_SPWD) 218# define PWD_SHADOW SHADOW 219#elif defined(HAVE_STRUCT_PR_PASSWD) && defined(HAVE_GETPRPWNAM) 220# define PWD_SHADOW OSFC2 221#endif]) 222 223# Initialize the test suite. 224AC_CONFIG_TESTDIR(tests) 225AC_CONFIG_FILES([tests/Makefile 226 tests/atlocal 227 tests/raddb/Makefile 228 tests/proxy/Makefile]) 229AM_MISSING_PROG([AUTOM4TE], [autom4te]) 230 231## * Provide top and bottom parts of config.h. 232AH_TOP([ 233#ifndef _REENTRANT 234# define _REENTRANT 235#endif 236]) 237 238AC_ARG_VAR([LEAK_DETECTOR], 239 [Enable leak detector support. Allowed values: 0 - disable leak detector, 1 - enable debug messages, 2 - enable debug messages and memory statistics. The setting takes effect only if --enable-maintainer-mode is specified. Using --enable-maintainer-mode alone implies LEAK_DETECTOR=1.]) 240 241case $LEAK_DETECTOR in 242[[0-9]]) AC_DEFINE_UNQUOTED(LEAK_DETECTOR, $LEAK_DETECTOR);; 243*) ;; 244esac 245 246AH_BOTTOM([ 247#ifdef MAINTAINER_MODE 248# define LEAK_DETECTOR 1 249#endif 250]) 251 252## * Checks for typedefs, structures, and compiler characteristics. 253AC_C_CONST 254AC_TYPE_UID_T 255AC_TYPE_OFF_T 256AC_TYPE_PID_T 257AC_TYPE_SIZE_T 258AC_TYPE_SIGNAL 259AC_CHECK_TYPE(u_char, unsigned char) 260AC_CHECK_TYPE(u_int, unsigned int) 261AC_CHECK_TYPE(u_long, unsigned long) 262AC_HEADER_TIME 263AC_STRUCT_TM 264AC_CHECK_MEMBERS([struct sockaddr_in.sin_len], , , 265 [ #include <sys/types.h> 266 #include <netinet/in.h> ]) 267RA_CHECK_INADDR_LOOPBACK 268 269## * Checks for library functions. 270#AC_FUNC_MEMCMP 271AC_FUNC_STRFTIME 272AC_FUNC_VPRINTF 273AC_FUNC_MMAP 274 275gl_INIT 276 277# Radius uses code that conflicts with gcc understanding of C aliasing: 278# 279# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38527 280# 281# In particular, when compiling radiusd/rewrite.y gcc >= 4.3.0 generates 282# code containing explicit dead loops. According to gcc folks, such code 283# generation is correct. I can hardly agree with that. And not only me. 284# Quoting Linus Torvalds: 285# The gcc people are more interested in trying to find out what can be 286# allowed by the c99 specs than about making things actually _work_. The 287# aliasing code in particular is not even worth enabling, it's just not 288# possible to sanely tell gcc when some things can alias. 289# (see http://lkml.org/lkml/2003/2/26/158, for details) 290# 291# (The code below is borrowed from Python's configure.in) 292AC_SUBST(OPTFLAGS) 293case $GCC in 294yes) 295 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing) 296 ac_save_cc="$CC" 297 CC="$CC -fno-strict-aliasing" 298 AC_TRY_RUN([int main() { return 0; }], 299 ac_cv_no_strict_aliasing_ok=yes, 300 ac_cv_no_strict_aliasing_ok=no, 301 ac_cv_no_strict_aliasing_ok=no) 302 CC="$ac_save_cc" 303 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok) 304 if test $ac_cv_no_strict_aliasing_ok = yes 305 then 306 OPTFLAGS="$OPTFLAGS -fno-strict-aliasing" 307 fi 308 ;; 309*) # FIXME 310 ;; 311esac 312 313## * Check for national language support 314AM_GNU_GETTEXT([external], [need-ngettext]) 315AM_GNU_GETTEXT_VERSION(0.15) 316 317AC_CHECK_FUNCS(setsid gethostname gettimeofday \ 318 mkdir mktime select socket strdup strtol lockf \ 319 setlocale bzero \ 320 inet_ntoa inet_aton \ 321 setvbuf setegid setregid setresgid seteuid setreuid getdtablesize sigaction) 322 323# FIXME: Do we need to check for the functions before `crypt'? 324AC_CHECK_DECLS([strncasecmp, strtok_r, localtime_r, asprintf, vasprintf, 325getline, crypt, crypt_set_format], , , 326 [ 327#define _REENTRANT 328#include <string.h> 329#ifdef HAVE_STRINGS_H 330# include <strings.h> 331#endif 332#ifdef HAVE_SYS_TIME_H 333# include <sys/time.h> 334# ifdef TIME_WITH_SYS_TIME 335# include <time.h> 336# endif 337#else 338# include <time.h> 339#endif 340#if defined(HAVE_CRYPT_H) 341# include <crypt.h> 342#endif 343#include <stdio.h>]) 344 345# Always use included argp stuff. 346# Earlier, configure preferred to use the one from glibc, if provided, 347# while offering --with-included-argp configuration option. This proved 348# to be unreliable, since there are too many broken argp implementations 349# around 350 351AH_BOTTOM([ 352#define GNULIB_ARGP_EXTERN_BASENAME 1 353]) 354 355AC_ARG_WITH([readline], 356 AC_HELP_STRING([--without-readline], 357 [do not use readline]), 358 [ 359case "${withval}" in 360 yes) usereadline=yes ;; 361 no) usereadline=no ;; 362 *) AC_MSG_ERROR(bad value ${withval} for --without-readline) ;; 363esac],[usereadline=yes]) 364 365dnl Check for GNU Readline 366AC_SUBST(READLINE_LIBS) 367 368if test "$usereadline" = "yes"; then 369 370 dnl FIXME This should only link in the curses libraries if it's 371 dnl really needed! 372 373 dnl Check for Curses libs. 374 CURSES_LIBS= 375 for lib in ncurses curses termcap 376 do 377 AC_CHECK_LIB($lib, tputs, [CURSES_LIBS="-l$lib"; break]) 378 done 379 380 saved_LIBS=$LIBS 381 LIBS="$LIBS $CURSES_LIBS" 382 AC_CHECK_LIB(readline, readline, ra_have_readline=yes) 383 LIBS=$saved_LIBS 384 385 if test "$ra_have_readline" = "yes"; then 386 AC_CHECK_HEADERS(readline/readline.h, 387 AC_DEFINE(WITH_READLINE,1,[Enable use of readline])) 388 READLINE_LIBS="-lreadline $CURSES_LIBS" 389 saved_LIBS=$LIBS 390 LIBS="$LIBS $READLINE_LIBS" 391 AC_CHECK_FUNCS(rl_completion_matches) 392 LIBS=$saved_LIBS 393 else 394 AC_MSG_WARN(readline requested but does not seem to be installed) 395 fi 396 397fi 398AH_BOTTOM([ 399/* Newer versions of readline have rl_completion_matches */ 400#ifndef HAVE_RL_COMPLETION_MATCHES 401# define rl_completion_matches completion_matches 402#endif]) 403 404RA_CHECK_STRUCT_FIELD(hostent, h_addr_list, 405 [#include <netdb.h>]) 406 407## ******************************************************************** 408## * User-configurable options * 409## ******************************************************************** 410 411## ************** 412## debug 413## ************** 414RADIUS_DEBUG=1 415AC_ARG_ENABLE(debug, 416 AC_HELP_STRING([--disable-debug], 417 [disable debugging functions]), 418 [case $enableval in 419 yes) RADIUS_DEBUG=1;; 420 no) RADIUS_DEBUG=0;; 421 esac]) 422 423AC_DEFINE_UNQUOTED(RADIUS_DEBUG, $RADIUS_DEBUG, 424 [Define to 1 to enable debugging]) 425 426AC_MSG_CHECKING(for log directory path) 427AC_ARG_WITH(log-dir, 428 AC_HELP_STRING([--with-log-dir=PATH], 429 [Use PATH instead of default log directory path]), 430 [case "$withval" in 431 /*) RADLOG_DIR=$withval;; 432 *) AC_MSG_ERROR(Argument must be an absolute pathname);; 433 esac], 434 [if test -d /var/log; then 435 RADLOG_DIR="/var/log" 436 elif test -d /usr/adm; then 437 RADLOG_DIR="/usr/adm" 438 else 439 RADLOG_DIR="NONE" 440 fi]) 441AC_MSG_RESULT($RADLOG_DIR) 442if test $RADLOG_DIR = NONE; then 443 AC_MSG_ERROR("Don't know where to place default logging directory") 444fi 445 446AC_MSG_CHECKING(for pidfile directory path) 447AC_ARG_WITH(pid-dir, 448 AC_HELP_STRING([--with-pid-dir=PATH], 449 [Use PATH instead of default podfile location]), 450 [case "$withval" in 451 /*) RADPID_DIR=$withval;; 452 *) AC_MSG_ERROR(Argument must be an absolute pathname);; 453 esac], 454 [if test -d /var/run; then 455 RADPID_DIR="/var/run" 456 else 457 RADPID_DIR='$(sysconfdir)/raddb' 458 fi]) 459AC_MSG_RESULT($RADPID_DIR) 460 461AC_SUBST(PATHFLAGS) 462AC_SUBST(RADPID_DIR) 463AC_SUBST(RADLOG_DIR) 464PATHFLAGS='-DSYSCONFDIR=\"$(sysconfdir)\" -DRADPID_DIR=\"$(RADPID_DIR)\" -DRADLOG_DIR=\"$(RADLOG_DIR)\"' 465 466AC_DEFINE_UNQUOTED(BUILD_TARGET, 467 "$target", [Target the package is built for]) 468 469## ****************** 470## server vs. client 471## ****************** 472AC_MSG_CHECKING(whether to build radius daemon) 473AC_ARG_ENABLE(server, 474 AC_HELP_STRING([--disable-server], 475 [do not compile radius daemon (radiusd) and accompanying programs (implies --enable-client]), 476 [case $enableval in 477 yes|no) BUILD_SERVER=$enableval;; 478 *) AC_MSG_ERROR([Invalid argument for --enable-server]);; 479 esac], 480 [BUILD_SERVER=yes]) 481AC_MSG_RESULT($BUILD_SERVER) 482 483AC_MSG_CHECKING(whether to build client programs) 484AC_ARG_ENABLE(client, 485 AC_HELP_STRING([--enable-client], 486 [compile client programs]), 487 [case $enableval in 488 yes) BUILD_CLIENT=$enableval;; 489 no) if test $BUILD_SERVER = yes; then 490 AC_MSG_WARN([--disable-server implies --enable-client]) 491 enableval=yes 492 fi 493 BUILD_CLIENT=$enableval;; 494 *) AC_MSG_ERROR([Invalid argument for --enable-client]);; 495 esac], 496 [case $BUILD_SERVER in 497 yes) BUILD_CLIENT=no;; 498 no) BUILD_CLIENT=yes;; 499 esac]) 500AC_MSG_RESULT($BUILD_CLIENT) 501 502## ************** 503## Contributions 504## ************** 505 506AC_ARG_WITH(php, 507 AC_HELP_STRING([--with-php=PATH], 508 [Enable PHP module]), 509 [case $withval in 510 no) PHP_PREFIX= 511 ;; 512 yes) PHP_PREFIX= 513 ;; 514 /*) PHP_PREFIX=$withval 515 ;; 516 *) AC_MSG_ERROR([Invalid prefix in --with-php]) 517 esac], 518 [PHP_PREFIX=]) 519 520if test "$PHP_PREFIX" != ""; then 521 AC_SUBST(PHP_INCLUDES) 522 PHP_INCLUDES="-I${PHP_PREFIX}/include/php/main -I${PHP_PREFIX}/include/php/Zend -I${PHP_PREFIX}/include/php -I${PHP_PREFIX}/include/php/TSRM" 523 524 php_save_CPPFLAGS=$CPPFLAGS 525 CPPFLAGS="$CPPFLAGS $PHP_INCLUDES" 526 AC_CHECK_HEADER([php.h],[:],AC_MSG_ERROR([php.h not found])) 527 CPPFLAGS=$php_save_CPPFLAGS 528 529 AC_SUBST(PHPMODDIR) 530 AC_ARG_WITH([php-moddir], 531 AC_HELP_STRING([--with-php-moddir=PATH], 532 [Set install prefix for PHP extension modules]), 533 [case $withval in 534 /*) PHPMODDIR=$withval;; 535 *) AC_MSG_ERROR([--with-php-moddir requires absolute file name as its argument]);; 536 esac], 537 [PHPMODDIR='$(libdir)/php/extensions']) 538 539 AC_SUBST(BUILD_MOD_RADIUS_LA) 540 BUILD_MOD_RADIUS_LA=mod_radius.la 541fi 542 543AC_SUBST(APACHEMODDIR) 544AC_SUBST(APACHE_INCLUDES) 545AC_SUBST(BUILD_MOD_AUTH_RADIUS_LA) 546AC_ARG_WITH(apache, 547 AC_HELP_STRING([--with-apache], 548 [Enable Apache modules]), 549 [case $withval in 550 no) ;; 551 yes) AC_ARG_VAR([APXS],[Name of apxs program]) 552 AC_CHECK_PROG(APXS, [apxs], [apxs], [no]) 553 if test $APXS = no; then 554 AC_MSG_ERROR([apxs not found]) 555 fi 556 APACHEMODDIR=`$APXS -q LIBEXECDIR` 557 APACHE_INCLUDES=`$APXS -q INCLUDEDIR` 558 BUILD_MOD_AUTH_RADIUS_LA='mod_auth_radius.la' 559 ;; 560 *) AC_MSG_ERROR([Invalid option argument in --with-apache]) 561 esac]) 562 563 564## ************** 565## auth port no 566## ************** 567AC_MSG_CHECKING(authentication port number) 568AC_ARG_WITH(auth-port, 569 AC_HELP_STRING([--with-auth-port={rfc|old|NUMBER}], 570 [specify port number to use for authentication]), 571 [case $withval in 572 [[0-9]][[0-9]]*) AUTH_PORT=$withval 573 ;; 574 rfc|RFC) AUTH_PORT=1812 575 ;; 576 old|OLD) AUTH_PORT=1645 577 ;; 578 *) AC_MSG_ERROR(invalid port number) 579 ;; 580 esac], 581 AUTH_PORT=1812) 582ACCT_PORT="`expr $AUTH_PORT + 1`" 583AC_MSG_RESULT([Default ports are $AUTH_PORT/$ACCT_PORT]) 584AC_SUBST(AUTH_PORT) 585AC_SUBST(ACCT_PORT) 586AC_DEFINE_UNQUOTED(DEF_AUTH_PORT, $AUTH_PORT, [Default authentication port]) 587AC_DEFINE_UNQUOTED(DEF_ACCT_PORT, $ACCT_PORT, [Default accounting port]) 588 589## ************** 590## PAM support 591## ************** 592AC_ARG_ENABLE(pam, 593 AC_HELP_STRING([--enable-pam], 594 [enable pam support]), 595 [case $enableval in 596 yes) USE_PAM=yes 597 AC_DEFINE(USE_PAM,1,[Enable PAM support]);; 598 no) ;; 599 *) AC_MSG_ERROR([--enable-pam can't be used with an argument]) 600 exit 1;; 601 esac]) 602if test "$USE_PAM" = yes; then 603 AC_CHECK_LIB(pam, pam_start, 604 [ AC_DEFINE(HAVE_LIBPAM,1,[Define if you have libpam]) 605 RA_RADIUSD_LDADD(-lpam) ], 606 [AC_MSG_FAILURE([The requested library libpam is not found or is unusable])]) 607fi 608 609 610## ************** 611## DBM 612## ************** 613 614AH_TEMPLATE(HAVE_LIBDBM, [Define this if you have libdbm]) 615AH_TEMPLATE(HAVE_LIBNDBM, [Define this if you have libndbm]) 616 617rad_lib_dbm() { 618 AC_CHECK_HEADER(dbm.h,, 619 [ AC_MSG_ERROR(can't find header dbm.h) 620 exit 0] ) 621 AC_CHECK_FUNC(dbminit,, 622 AC_CHECK_LIB(dbm, dbminit, 623 [ AC_DEFINE(HAVE_LIBDBM) 624 RA_RADIUSD_LDADD(-ldbm) ], 625 [AC_MSG_FAILURE([The requested library libdbm is not found or is unusable])])) 626} 627 628rad_lib_ndbm() { 629 AC_CHECK_HEADER(ndbm.h,, 630 [ AC_MSG_ERROR(can't find header ndbm.h) 631 exit 0] ) 632 AC_CHECK_FUNC(dbm_open,, 633 AC_CHECK_LIB(ndbm, dbm_open, 634 [ AC_DEFINE(HAVE_LIBNDBM) 635 RA_RADIUSD_LDADD(-lndbm) ], 636 [AC_MSG_FAILURE([The requested library libndbm is not found or is unusable])])) 637} 638 639AH_TEMPLATE(USE_DBM,[Define this to enable DBM support]) 640AC_ARG_ENABLE(dbm, 641 AC_HELP_STRING([--enable-dbm[={dbm|ndbm}]], 642 [include dbm support]), 643 [case $enableval in 644 yes) rad_lib_ndbm 645 AC_DEFINE_UNQUOTED(USE_DBM,DBM_NDBM);; 646 647 no) USE_DBM=no;; 648 649 DBM|dbm) rad_lib_dbm 650 AC_DEFINE_UNQUOTED(USE_DBM,DBM_DBM);; 651 652 NDBM|ndbm) rad_lib_ndbm 653 AC_DEFINE_UNQUOTED(USE_DBM,DBM_NDBM);; 654 655 *) AC_MSG_ERROR(unsupported option value: $enableval) 656 esac]) 657 658 659## ************** 660## SQL 661## ************** 662 663SQL_MODULES= 664AC_SUBST(SQL_MODULES) 665 666SQL_LIBOBJS= 667AC_SUBST(SQL_LIBOBJS) 668 669SQL_LTLIBOBJS= 670AC_SUBST(SQL_LTLIBOBJS) 671 672BUILD_SQL= 673AC_SUBST(BUILD_SQL) 674AC_SUBST(SQLLIB) 675 676SQL_LOADABLE_MODULES= 677AC_SUBST(SQL_LOADABLE_MODULES) 678 679AH_TEMPLATE(USE_SQL,[Enables SQL support]) 680 681AC_DEFUN([RA_SQL_LDADD],[ 682 if test $USE_LOADABLE_MODULES = yes; then 683 $1=$2 684 else 685 RA_RADIUSD_LDADD($2) 686 fi 687]) 688 689 690## ********* 691## MySQL 692## ********* 693AH_TEMPLATE(USE_SQL_MYSQL,[When defined, enable MySQL support]) 694AH_TEMPLATE(HAVE_LIBMYSQL,[Define if you have libmysql]) 695AC_SUBST(MYSQLLIBS) 696 697mysql_init() { 698 RA_CHECK_LIB(mysqlclient, 699 mysql_real_connect, 700 [-lm], 701 [ AC_DEFINE(USE_SQL_MYSQL) 702 AC_DEFINE(HAVE_LIBMYSQL) 703 RA_SQL_LDADD(MYSQLLIBS, $ra_cv_lib_mysqlclient) 704 ], 705 [AC_MSG_FAILURE([The requested library libmysqlclient is not found or is unusable])], 706 [/usr/local/lib/mysql /usr/lib/mysql]) 707} 708 709AC_ARG_WITH(mysql, 710 AC_HELP_STRING([--with-mysql], 711 [Configure to work with MySQL]), 712 [case $withval in 713 yes) SQL_MODULES="$SQL_MODULES mysql" 714 ;; 715 no) ;; 716 esac]) 717 718 719# ********* 720# Postgres 721# ********* 722AH_TEMPLATE(USE_SQL_POSTGRES,[When defined, enable PostgreSQL support]) 723AH_TEMPLATE(HAVE_LIBPQ,[Define if you have libpq]) 724AC_SUBST(POSTGRESLIBS) 725 726postgres_init() { 727 RA_CHECK_LIB(pq, PQconnectStart, [], 728 [ AC_DEFINE(USE_SQL_POSTGRES) 729 AC_DEFINE(HAVE_LIBPQ) 730 RA_SQL_LDADD(POSTGRESLIBS, $ra_cv_lib_pq)], 731 [AC_MSG_FAILURE([The requested library libpq is not found or is unusable])], 732 [/usr/local/pgsql/lib /usr/pgsql/lib]) 733} 734 735AC_ARG_WITH(postgres, 736 AC_HELP_STRING([--with-postgres], 737 [Configure to work with Postgres]), 738 [case $withval in 739 yes) SQL_MODULES="$SQL_MODULES postgres" 740 ;; 741 no) ;; 742 esac]) 743 744 745## ********* 746## ODBC 747## ********* 748AH_TEMPLATE(USE_SQL_ODBC,[When defined, enable ODBC support]) 749AH_TEMPLATE(HAVE_LIBODBC,[Define if you have libodbc or libiodbc]) 750AC_SUBST(ODBCLIBS) 751 752rad_lib_odbc() { 753 RA_CHECK_LIB(odbc, SQLAllocHandle, [], 754 [ AC_DEFINE(USE_SQL_ODBC) 755 AC_DEFINE(HAVE_LIBODBC) 756 RA_SQL_LDADD(ODBCLIBS, $ra_cv_lib_odbc)], 757 [AC_MSG_FAILURE([The requested library libobdc is not found or is unusable])], 758 [/usr/local/lib]) 759} 760 761rad_lib_iodbc() { 762 RA_CHECK_LIB(iodbc, SQLAllocHandle, [], 763 [ AC_DEFINE(USE_SQL_ODBC) 764 AC_DEFINE(HAVE_LIBODBC) 765 RA_SQL_LDADD(ODBCLIBS, $ra_cv_lib_iodbc)], 766 [AC_MSG_FAILURE([The requested library libiodbc is not found or is unusable])], 767 [/usr/local/lib]) 768} 769 770with_flag_used=odbc 771 772odbc_init() { 773 case $with_flag_used in 774 yes|odbc|ODBC) 775 rad_lib_odbc 776 ;; 777 iodbc|iODBC|IODBC) 778 rad_lib_iodbc 779 ;; 780 no) ;; 781 esac 782} 783 784AC_ARG_WITH(odbc, 785 AC_HELP_STRING([--with-odbc[={odbc|iodbc}]], 786 [Configure to work with ODBC]), 787 [case $withval in 788 yes|odbc|ODBC|iodbc|iODBC|IODBC) 789 SQL_MODULES="$SQL_MODULES odbc" 790 with_flag_used=$withval 791 ;; 792 no) with_flag_used=$withval 793 ;; 794 *) AC_MSG_ERROR(unsupported option value: $withval) 795 esac]) 796 797 798## *********** 799## General SQL support 800## *********** 801 802AC_ARG_WITH(sql, 803 AC_HELP_STRING([--with-sql=modlist], 804 [Configure to work with SQL]), 805 [for mod in `echo $withval | tr ':,' ' '` 806 do 807 if test -r $srcdir/sql/${mod}.c; then 808 SQL_MODULES="$SQL_MODULES ${mod}" 809 else 810 AC_MSG_ERROR(No such SQL module: $mod) 811 fi 812 done]) 813 814dummy_init() { 815 : 816} 817 818if test -n "$SQL_MODULES"; then 819 USE_SQL=1 820 AC_DEFINE(USE_SQL) 821 BUILD_SQL=libsql.la 822 SQLLIB=../sql/libsql.la 823 824 for module in $SQL_MODULES 825 do 826 ${module:-dummy}_init 827 if test $USE_LOADABLE_MODULES = yes; then 828 SQL_LOADABLE_MODULES="$SQL_LOADABLE_MODULES ${module}.la" 829 else 830 SQL_LIBOBJS="$SQL_LIBOBJS ${module}.o" 831 fi 832 done 833 S=`echo "$SQL_LIBOBJS" | 834 sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'` 835 SQL_LTLIBOBJS=`echo "$S" | 836 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'` 837 838 AC_CONFIG_COMMANDS([sql/modlist.h], 839 [$srcdir/scripts/sqlmod.sh $SQL_MODULES > sql/modlist.h], 840 [if test $USE_LOADABLE_MODULES = yes; then 841 SQL_MODULES= 842 else 843 SQL_MODULES="$SQL_MODULES" 844 fi]) 845fi 846 847## ************** 848## SNMP 849## ************** 850 851AH_TEMPLATE(USE_SNMP, [Define this to enable SNMP support]) 852AC_SUBST(SNMP_CONFIG) 853SNMP_CONFIG="# " 854AC_ARG_ENABLE(snmp, 855 AC_HELP_STRING([--enable-snmp[={yes|no|compat}]], 856 [enable SNMP support]), 857 [case $enableval in 858 compat) USE_SNMP=yes 859 AC_DEFINE(USE_SNMP) 860 AC_DEFINE(SNMP_COMPAT_0_96,1, 861 [Enable support for MIBS used in 0.96 branch]) 862 SNMP_CONFIG="" 863 ;; 864 yes) USE_SNMP=yes 865 AC_DEFINE(USE_SNMP) 866 SNMP_CONFIG="" 867 ;; 868 no) ;; 869 *) AC_MSG_ERROR(--enable-snmp can't be used with an argument) 870 exit 1;; 871 esac]) 872 873AH_BOTTOM([ 874#ifndef HAVE_MMAP 875# undef USE_SNMP 876#endif]) 877 878## ************** 879## Directories 880## ************** 881PAMDIR='$(prefix)/lib/security' 882AC_ARG_WITH(pamdir, 883 AC_HELP_STRING([--with-pamdir=DIR], 884 [install PAM modules in DIR [[PREFIX/lib/security)]]]), 885 [PAMDIR=$withval]) 886AC_SUBST(PAMDIR) 887 888## *********************************************************************** 889## * Compatibility options and some special hacks * 890## *********************************************************************** 891 892AC_ARG_ENABLE(livingston-menus, 893 AC_HELP_STRING([--enable-livingston-menus], 894 [enable Livingston-compatible menus]), 895 [USE_LIVINGSTON_MENUS=$enableval 896 case $enableval in 897 yes) AC_DEFINE(USE_LIVINGSTON_MENUS,1, 898 [Enable support for Livingstone menus]);; 899 *) ;; 900 esac]) 901 902AH_TEMPLATE(DENY_SHELL, 903 [When defined, users with the given shell will be always denied 904 access]) 905AC_ARG_ENABLE(deny_shell, 906 AC_HELP_STRING([--enable-deny-shell=STRING], 907 [always reject users with given shell]), 908 [USE_DENY_SHELL=$enableval 909 case $enableval in 910 yes|no) AC_MSG_ERROR([--enable-deny-shell requires an argument]) 911 exit 1;; 912 *) AC_DEFINE_UNQUOTED(DENY_SHELL, "$enableval");; 913 esac]) 914 915## *********************************************************************** 916## * Do some final checks and create Makefiles * 917## *********************************************************************** 918 919AC_SUBST(BUILD_NAS_SCM) 920AC_SUBST(BUILD_PAM_RADIUS_LA) 921 922AC_SUBST(RADIUS_DAEMON) 923if test x$BUILD_SERVER = xyes; then 924 RADIUS_DAEMON=radiusd 925fi 926 927if test x$BUILD_CLIENT = xyes; then 928 AC_CHECK_LIB(pam, pam_start, 929 [ BUILD_PAM_RADIUS_LA='pam_radius.la$(EXEEXT)' ], 930 [ AC_MSG_WARN([-lpam not found. Won't build pam_radius.so])]) 931 if test x$USE_GUILE != xno; then 932 BUILD_NAS_SCM=nas.scm 933 else 934 AC_MSG_WARN([Guile not installed. Won't build nas.scm]) 935 fi 936fi 937 938if test "$EMACS" != "no"; then 939 lisp_LISP='$(LISPSRC)' 940fi 941AC_SUBST(lisp_LISP) 942 943dnl Define ARG_UNUSED macro 944dnl 945AH_BOTTOM([ 946#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) 947# define __attribute__(x) 948#endif 949 950#ifndef ARG_UNUSED 951# define ARG_UNUSED __attribute__ ((__unused__)) 952#endif 953 954#define LOCK_DECLARE(name) 955#define LOCK_SET(name) 956#define LOCK_RELEASE(name) 957]) 958 959AC_SUBST(LIBGNURADIUS,'${top_builddir}/lib/libgnuradius.la') 960AC_SUBST(LIBRADEXTRA,'${top_builddir}/lib/libradextra.a ${top_builddir}/gnu/libgnu.la') 961 962### Display the status 963 964AC_CONFIG_COMMANDS([status],[ 965cat <<EOF 966 967******************************************************************* 968GNU Radius configured with the following settings: 969 970General 971 972NLS .............................. $status_nls 973Debug ............................ $status_debug 974Build Server (radiusd) ........... $status_server 975Build client ..................... $status_client 976Guile ............................ $status_guile 977Readline ......................... $status_readline 978 979EOF 980 981if test "$status_server" = yes; then 982cat <<EOF 983Server 984 985Authentication port .............. $status_auth_port 986Accounting port .................. $status_acct_port 987Log directory .................... $status_logdir 988PID directory .................... $status_piddir 989PAM .............................. $status_pam 990DBM .............................. $status_dbm 991SNMP ............................. $status_snmp 992Livingston Menus ................. $status_menus 993Deny Shell ....................... $status_deny_shell 994Guile ............................ $status_server_guile 995SQL .............................. $status_sql_modules 996 997EOF 998fi 999 1000cat <<EOF 1001Modules 1002 1003PHP .............................. $status_mod_php 1004Apache ........................... $status_mod_apache 1005******************************************************************* 1006EOF 1007], 1008[status_nls=$USE_NLS 1009if test $RADIUS_DEBUG -eq 1; then 1010 status_debug=yes 1011else 1012 status_debug=no 1013fi 1014status_server="$BUILD_SERVER" 1015status_client="$BUILD_CLIENT" 1016status_guile="${USE_GUILE:-no}" 1017status_readline="$usereadline" 1018status_lispdir="${lispdir:-none}" 1019status_auth_port="$AUTH_PORT" 1020status_acct_port="$ACCT_PORT" 1021status_logdir="$RADLOG_DIR" 1022status_piddir="$RADPID_DIR" 1023status_pam="${USE_PAM:-no}" 1024status_dbm="${USE_DBM:-no}" 1025status_snmp="$USE_SNMP" 1026status_menus="$USE_LIVINGSTON_MENUS" 1027status_deny_shell="${USE_DENY_SHELL:-no}" 1028status_server_guile="$USE_SERVER_GUILE" 1029status_sql_modules="${SQL_MODULES:-no}" 1030if test "$PHP_PREFIX" != ""; then 1031 status_mod_php=yes 1032else 1033 status_mod_php=no 1034fi 1035if test "$BUILD_MOD_AUTH_RADIUS_LA" != ""; then 1036 status_mod_apache=yes 1037else 1038 status_mod_apache=no 1039fi 1040]) 1041 1042AC_CONFIG_FILES(Makefile 1043 po/Makefile.in 1044 raddb/client.conf 1045 raddb/config 1046 include/Makefile 1047 include/radius/Makefile 1048 include/snmp/Makefile 1049 gnu/Makefile 1050 lib/Makefile 1051 sql/Makefile 1052 snmplib/Makefile 1053 radscm/Makefile 1054 radiusd/Makefile 1055 radlast/Makefile 1056 radwho/Makefile 1057 radzap/Makefile 1058 radscripts/Makefile 1059 doc/Makefile 1060 doc/texinfo/Makefile 1061 doc/man/Makefile 1062 doc/man/config.so 1063 doc/rfc/Makefile 1064 mibs/Makefile 1065 elisp/Makefile 1066 raddb/Makefile 1067 db/Makefile 1068 client/Makefile 1069 client/nas/Makefile 1070 client/pam_radius/Makefile 1071 radtest/Makefile 1072 examples/Makefile 1073 scripts/Makefile 1074 scripts/guile/Makefile 1075 scripts/guile/1.6/Makefile 1076 contrib/Makefile 1077 contrib/web-radact/Makefile 1078 contrib/passcvt/Makefile 1079 contrib/passwd_to_db/Makefile 1080 contrib/radsend/Makefile 1081 contrib/php/Makefile) 1082AC_OUTPUT 1083 1084# EOF 1085