1 dnl This file writen by Devrim SERAL for tac_plus daemon
4 dnl Check for Host information
5 dnl AC_CANONICAL_HOST()
7 AM_INIT_AUTOMAKE(tac_plus, F4.0.3.alpha.8.gts4)
9 dnl Checks for programs.
29 AC_MSG_WARN([See /usr/lpp/bos/bsdport on your system for details of how to define bsdcc])
40 AM_CONFIG_HEADER(config.h)
43 if test "x$USE_MAINTAINER_MODE" = "xyes"; then
44 AC_DEFINE(MAINTAINER_MODE)
47 if test "x$USE_MAINTAINER_MODE" = "xyes" -a "x$GCC" = "xyes"; then
48 CFLAGS="$CFLAGS -ggdb3 -Wall -Wstrict-prototypes -pedantic -Wsign-compare"
51 # Set these options as otherwise some autoconf tests give different results:
52 final_CFLAGS="$CFLAGS"
53 CFLAGS="$CFLAGS -D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 -D_BSD_SOURCE=1 -D_OSF_SOURCE=1 -D__EXTENSIONS__=1"
58 AC_SUBST(conf_LDFLAGS)
63 dnl Checks for libraries.
64 dnl Replace `main' with a function in -lnsl:
65 AC_CHECK_LIB(nsl, main, [ conf_LDADD="-lnsl $conf_LDADD" ] )
66 dnl Replace `main' with a function in -log:
67 AC_CHECK_LIB(og, main, [ conf_LDADD="-log $conf_LDADD" ] )
68 dnl Replace `main' with a function in -lsocket:
69 AC_CHECK_LIB(socket, main, [ conf_LDADD="-lsocket $conf_LDADD" ] )
70 dnl Check for Crypt function
71 dnl Never use CONF_LDADD here as it is used also for "generate_passwd"
72 AC_CHECK_LIB(crypt, crypt)
73 AC_CHECK_LIB(c,printf)
75 dnl Checks for header files.
77 AC_CHECK_HEADERS(fcntl.h malloc.h strings.h sys/file.h sys/ioctl.h sys/time.h syslog.h sys/syslog.h unistd.h regex.h sys/param.h)
78 AC_CHECK_HEADERS(shadow.h,[
79 if test -f /etc/shadow ; then
80 AC_DEFINE(SHADOW_PASSWORDS)
83 dnl Checks for typedefs, structures, and compiler characteristics.
87 dnl Checks for library functions.
88 AC_PROG_GCC_TRADITIONAL
94 AC_CHECK_FUNCS(select socket strcspn strdup strtol siginterrupt)
95 AC_CHECK_SIZEOF(unsigned short,2)
96 AC_CHECK_SIZEOF(unsigned int,4)
97 AC_CHECK_SIZEOF(unsigned long,4)
101 AC_MSG_CHECKING(for PAM support:)
104 [ --with-pam With PAM Support ],,)
105 if test "x$with_pam" = "xyes";then
106 AC_CHECK_LIB(dl, dlopen, [ conf_LDADD="-ldl $conf_LDADD" ] )
107 AC_CHECK_LIB(pam, pam_start, [ conf_LDADD="-lpam $conf_LDADD" ] )
109 COND_USE="$COND_USE "'$(cond_USE_PAM)'
110 AC_MSG_RESULT(Pam support... yes)
112 AC_MSG_RESULT(Pam support... no)
116 AC_MSG_CHECKING(for LDAP support)
119 [ --with-ldap With LDAP Support ],,)
121 if test "x$with_ldap" = "xyes";then
122 dnl Replace `main' with a function in -llber:
123 AC_CHECK_LIB(lber, main, [ conf_LDADD="-llber $conf_LDADD"; liblber="-llber" ], [ liblber="" ] )
124 dnl Replace `main' with a function in -lldap:
125 AC_CHECK_LIB(ldap, ldap_simple_bind_s, [ conf_LDADD="-lldap $conf_LDADD" ],
127 AC_CHECK_LIB(ldap, ldap_init, [ conf_LDADD="-lldap $conf_LDADD" ],, $liblber)
130 COND_USE="$COND_USE "'$(cond_USE_LDAP)'
131 AC_MSG_RESULT(LDAP support... yes)
133 AC_MSG_RESULT(LDAP support... no)
137 AC_MSG_CHECKING(for DB support)
140 [ --with-db For DB Support ],,)
141 if test "x$with_db" = "xyes";then
144 COND_USE="$COND_USE "'$(cond_DB)'
145 COND_USE="$COND_USE "'$(cond_DB_NULL)'
146 AC_MSG_RESULT(DB support... yes)
148 AC_MSG_RESULT(DB support... no)
151 dnl For MySQL support
152 if test "x$with_db" = "xyes";then
154 echo "Check for MySQL support:"
157 [ --with-mysql With MySQL Support ],,)
159 AC_ARG_WITH(mysql-prefix,
160 [ --with-mysql-prefix=PREFIX Mysql prefix [default=/usr]],
161 MYSQL_PREFIX=$withval,
166 if test "x$with_mysql" = "xyes";then
168 conf_LDFLAGS="-L$MYSQL_PREFIX/lib/mysql $conf_LDFLAGS"
169 CPPFLAGS="-I$MYSQL_PREFIX/include/mysql $CPPFLAGS"
170 AC_CHECK_LIB(mysqlclient, mysql_init,
171 conf_LDADD="-lmysqlclient -lm $conf_LDADD",
172 AC_MSG_ERROR(*** couldn't find libmysqlclient),
176 COND_USE="$COND_USE "'$(cond_DB_MYSQL)'
177 AC_MSG_RESULT(Mysql support... yes)
179 AC_MSG_RESULT(Mysql support... no)
184 dnl For PgSQL support
185 if test "x$with_db" = "xyes";then
187 echo "Check for PgSQL support:"
190 [ --with-pgsql With PgSQL Support ],,)
192 AC_ARG_WITH(pgsql-prefix,
193 [ --with-pgsql-prefix=PREFIX PgSQL prefix [default=/usr]],
194 PGSQL_PREFIX=$withval,
199 if test "x$with_pgsql" = "xyes";then
201 conf_LDFLAGS="-L$PGSQL_PREFIX/lib/pgsql $conf_LDFLAGS"
202 CPPFLAGS="-I$PGSQL_PREFIX/include/pgsql $CPPFLAGS"
203 AC_CHECK_LIB(pq,PQconnectdb ,
204 conf_LDADD="-lpq $conf_LDADD",
205 AC_MSG_ERROR(*** couldn't find libpq))
208 COND_USE="$COND_USE "'$(cond_DB_PGSQL)'
209 AC_MSG_RESULT(Pgsql support... yes)
211 AC_MSG_RESULT(Pgsql support... no)
216 dnl Tacuid & tac guid
219 [ --with-tacuid=ID If you like to run tac_plus other than root user (no default value) ],,)
221 [ --with-tacgid=GID If you like to run tac_plus other than root group(no default value) ],,)
224 if (test "x$with_tacuid" != "x" && test "x$with_tacgid" != "x" && test "x$with_tacuid" != "xyes" && test "x$with_tacgid" != "xyes");then
226 AC_DEFINE_UNQUOTED(TACPLUS_USERID, $with_tacuid)
227 AC_DEFINE_UNQUOTED(TACPLUS_GROUPID, $with_tacgid)
228 AC_MSG_RESULT(tacacs+ work with given user and group id)
231 AC_MSG_CHECKING(whether to enable the maxsess feature)
232 AC_ARG_ENABLE(maxsess,
233 [ --enable-maxsess Enable maxsess feature ],
235 if test "$enableval" = "yes";then
238 COND_USE="$COND_USE "'$(cond_MAXSESS)'
247 dnl Enable tacacs.pid file directory
248 AC_ARG_WITH(tacplus_pid,
249 [ --with-tacplus_pid=PREFIX Tac_plus pid file location [default=/var/run] ],
250 [ pidfile="$withval" ],
253 if test "x$pidfile" '!=' "x"; then
254 AC_DEFINE_UNQUOTED(TACPLUS_PIDFILE, "$pidfile/tac_plus.pid")
257 dnl For libwrap check
258 AC_MSG_CHECKING(whether to enable the libwrap feature)
261 [ --with-libwrap[=PATH] Compile in libwrap (tcp_wrappers) support.],
268 AC_CHECK_LIB(wrap, request_init, [
269 conf_LDADD="-lwrap $conf_LDADD"
275 if test -d "$withval"; then
276 LDFLAGS="-L$withval $LDFLAGS"
278 AC_TRY_LINK([ int allow_severity; int deny_severity; ],
281 [ AC_MSG_ERROR(Could not find the $withval library. You must first install tcp_wrappers.) ])
288 AC_DEFINE(TCPWRAPPER)
289 COND_USE="$COND_USE "'$(cond_TCPWRAPPER)'
293 AC_MSG_CHECKING(whether to use SKEY security feature)
296 [ --with-skey[=LIBPATH] Compile with SKEY support (also use -I in CPPFLAGS var).],
307 if test '!' -f "$withval";then
308 AC_MSG_ERROR([Cannot find $withval library file, you may wish to use LIBS variable instead.])
310 conf_LDADD="$withval $conf_LDADD"
318 COND_USE="$COND_USE "'$(cond_SKEY)'
321 dnl For MSCHAP and also MSCHAP_DES
322 AC_MSG_CHECKING(whether to compile with Microsoft CHAP)
325 [ --with-mschap[=des] Compile with Microsoft CHAP (optionally including MSCHAP_DES).],
331 AC_MSG_RESULT([yes, without DES])
335 AC_MSG_RESULT([yes, including DES])
336 AC_DEFINE(MSCHAP_DES)
340 AC_MSG_ERROR(Unknown --with-mschap argument $withval, use: no, yes or des)
347 COND_USE="$COND_USE "'$(cond_MSCHAP)'
350 dnl For SunOS encryption compatibility
351 dnl Never use CONF_LDADD here as it is used also for "generate_passwd"
352 AC_MSG_CHECKING(whether to use SunOS encryption compatibility)
354 AC_ARG_WITH(descrypt,
355 [ --with-descrypt Be password encryption compatible with SunOS.],
362 LIBS="-ldescrypt $LIBS"
365 AC_MSG_RESULT(yes - $withval)
366 LIBS="$withval $LIBS"
373 [ --with-efence compile with efence support (for debugging)],,[
374 if test "x$USE_MAINTAINER_MODE" = "xyes"; then
380 if test "$with_efence" != no; then
381 AC_CHECK_LIB(efence,malloc,,[
382 if test "$with_efence" = yes; then
383 AC_MSG_ERROR(Unable to find efence library.)
388 dnl Check for type in sys/socket.h
389 AC_MSG_CHECKING([for parameter type of 3rd accept() arg])
390 AC_CACHE_VAL(tac_plus_cv_accept_type, [
392 for type in socklen_t size_t int; do
394 #include <sys/types.h>
395 #include <sys/socket.h>
402 int accept(int s, struct sockaddr *addr, ]$type[ *addrlen)
404 int discarded_main() {
406 [check_ok=true;break],continue)
410 tac_plus_cv_accept_type=$type
412 tac_plus_cv_accept_type=no
415 if test "x$tac_plus_cv_accept_type" = "xno"
417 AC_DEFINE(socklen_t,int)
418 AC_MSG_RESULT([failed to detect, will try int])
420 AC_MSG_RESULT($tac_plus_cv_accept_type)
421 if test "x$tac_plus_cv_accept_type" != "xsocklen_t"
423 AC_DEFINE_UNQUOTED(socklen_t,$tac_plus_cv_accept_type)
427 dnl Check for system regex (stolen from "mutt" package)
428 AC_ARG_WITH(included-regex, [ --with-included-regex Use the included regex library ],
429 [tac_plus_cv_included_regex=yes],
430 [AC_CHECK_FUNCS(regcomp, tac_plus_cv_included_regex=no, tac_plus_cv_included_regex=yes)])
432 if test $tac_plus_cv_included_regex = no ; then
433 AC_CACHE_CHECK([whether your system's regexp library is completely broken],
434 [tac_plus_cv_included_regex_broken],
442 main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }],
443 tac_plus_cv_included_regex_broken=no, tac_plus_cv_included_regex_broken=yes, tac_plus_cv_included_regex_broken=yes))
444 if test $tac_plus_cv_included_regex_broken = yes ; then
445 echo "Using the included regex instead." >&AC_FD_MSG
446 tac_plus_cv_included_regex=yes
449 if test $tac_plus_cv_included_regex = yes; then
450 AC_DEFINE(WITH_INCLUDED_REGEX)
451 COND_USE="$COND_USE "'$(cond_WITH_INCLUDED_REGEX)'
454 dnl Check for "struct passwd.pw_{age,comment}"
455 dnl Stolen from Julianne Frances Haugh's login replacement.
456 AC_CACHE_CHECK(for pw_age in struct passwd,
457 tac_plus_cv_struct_passwd_pw_age, AC_TRY_COMPILE([#include <pwd.h>],
458 [ struct passwd pw; pw.pw_age = "" ],
459 tac_plus_cv_struct_passwd_pw_age=yes, tac_plus_cv_struct_passwd_pw_age=no))
461 if test "$tac_plus_cv_struct_passwd_pw_age" = "yes"; then
462 AC_DEFINE(HAVE_PASSWD_PW_AGE)
464 AC_CACHE_CHECK(for pw_comment in struct passwd,
465 tac_plus_cv_struct_passwd_pw_comment, AC_TRY_COMPILE([#include <pwd.h>],
466 [ struct passwd pw; pw.pw_comment = "" ],
467 tac_plus_cv_struct_passwd_pw_comment=yes, tac_plus_cv_struct_passwd_pw_comment=no))
469 if test "$tac_plus_cv_struct_passwd_pw_comment" = "yes"; then
470 AC_DEFINE(HAVE_PASSWD_PW_COMMENT)
472 AC_CACHE_CHECK(for ut_host in struct utmp,
473 tac_plus_cv_struct_utmp_ut_host, AC_TRY_COMPILE([#include <utmp.h>],
474 [ struct utmp ut; ut.ut_host = "" ],
475 tac_plus_cv_struct_utmp_ut_host=yes, tac_plus_cv_struct_utmp_ut_host=no))
477 if test "$tac_plus_cv_struct_utmp_ut_host" = "yes"; then
478 AC_DEFINE(HAVE_UTMP_UT_HOST)
481 CFLAGS="$final_CFLAGS"