1dnl Process this file with autoconf to produce a configure script. 2dnl 3dnl @(#) $Id$ 4dnl 5 6AC_INIT(calife.c, [3.0], [roberto@keltia.freenix.fr]) 7AC_CONFIG_HEADER(config.h) 8AC_PREFIX_DEFAULT(/usr/local) 9 10AC_CANONICAL_HOST 11 12dnl Checks for programs. 13AC_PROG_CC 14 15BINGRP="wheel" 16case "$host" in 17 *-*-sunos*) 18 CFLAGS="$CFLAGS -DSUNOS4" 19 os_sunos=yes 20 ;; 21 *-sgi-irix6*) 22 if test "`uname -s`" = "IRIX64"; then 23 CFLAGS="-32 $CFLAGS" 24 LDFLAGS="-32 $LDFLAGS" 25 fi 26 ;; 27 *-ibm-aix3.2|*-ibm-aix3.2.0|*-ibm-aix3.2.1|*-ibm-aix3.2.2|*-ibm-aix3.2.3|*-ibm-aix3.2.4) 28 os_aix=yes 29 CFLAGS="$CFLAGS -DAIX" 30 AC_CHECK_LIB(s, getuserattr) 31 ;; 32 *-ibm-aix*) 33 os_aix=yes 34 CFLAGS="$CFLAGS -DAIX" 35 AC_CHECK_LIB(s, getuserattr) 36 ;; 37 *-sun-solaris2.10) 38 CFLAGS="$CFLAGS -DSUNOS510" 39 os_solaris=yes 40 ;; 41 *-sun-solaris2*) 42 os_solaris=yes 43 WITH_PAM=yes 44 with_pam=yes 45 AC_DEFINE(WITH_PAM) 46 ;; 47 *-apple-darwin10*) 48 os_darwin=yes 49 WITH_PAM=yes 50 with_pam=yes 51 AC_DEFINE(WITH_PAM) 52 CFLAGS="$CFLAGS -DOSX=106" 53 ;; 54 *-apple-darwin*) 55 os_darwin=yes 56 WITH_PAM=yes 57 with_pam=yes 58 AC_DEFINE(WITH_PAM) 59 ;; 60 *-dec-ultrix*) 61 AC_TRY_COMPILE([#include <syslog.h>], 62 [int foo = LOG_DAEMON; ], 63 , 64 AC_DEFINE(NEED_SYS_SYSLOG_H)) 65 ;; 66 *-*-hpux*) 67 # HPUX flags from jgotts@engin.umich.edu 68 CFLAGS="$CFLAGS -DHPUX" 69 BINGRP="sys" 70 os_hpux=yes 71 ;; 72 alpha-dec-osf*) 73 AC_MSG_CHECKING(for OSF/1 C2 security package) 74 osfc2sec=`/usr/sbin/setld -i | grep '^OSFC2SEC'` 75 if test -n "$osfc2sec"; then 76 AC_MSG_RESULT(yes) 77 AC_DEFINE(HAVE_OSF1_C2_SECURITY) 78 AC_CHECK_LIB(security, set_auth_parameters, 79 LIBS="$LIBS -lsecurity", 80 AC_MSG_ERROR("Could not find libsecurity even though C2 security installed.")) 81 CONFOBJS="$CONFOBJS osfc2.o" 82 else 83 AC_MSG_RESULT(no) 84 fi 85 ;; 86 *-next-nextstep*) 87 # NeXT has sys/wait.h but use "union wait". 88 AC_DEFINE(HAVE_NON_POSIX_WAIT_H) 89 ;; 90 *-*-linux*|*-*-mklinux*) 91 os_linux=yes 92 CFLAGS="-D_GNU_SOURCE $CFLAGS" 93 AC_CHECK_FUNC(getspnam) 94 if test $ac_cv_func_getspnam = no; then 95 AC_CHECK_LIB(shadow, getspnam) 96 fi 97 if test $ac_cv_func_getspnam = yes; then 98 AC_DEFINE(HAVE_ETC_SHADOW) 99 fi 100 no_shadows_password_checking=yes 101 AC_CHECK_FUNCS(pw_encrypt, pwencrypt=yes) 102 if test $ac_cv_func_pw_encrypt = no; then 103 AC_CHECK_LIB(shadow, pw_encrypt, [ 104 pwencrypt=yes 105 pwencryptlib="-lshadow" ]) 106 fi 107 AC_MSG_CHECKING([whether to enable pw_encrypt]) 108 AC_ARG_ENABLE(deprecated-linux-pw-encrypt, 109[ --enable-deprecated-linux-pw-encrypt 110 Enable using of deprecated linx pw_encrypt 111function.], 112[ if test -z "$pwencrypt"; then 113 AC_MSG_RESULT(no) 114 else 115 AC_DEFINE(crypt,pw_encrypt) 116 AC_MSG_RESULT(no) 117 if test -n "$pwencryptlib"; then 118 LIBS="$LIBS $pwencryptlib" 119 fi 120 fi ], 121 AC_MSG_RESULT(no) ) 122 ;; 123 *-*-sysv4*) 124 CFLAGS="$CFLAGS -DSVR4" 125 AC_CHECK_LIB(gen, openlog) 126 BINGRP="sys" 127 ;; 128 i*86-unknown-sco*) 129 LIBS="$LIBS -L/usr/lib/libp" 130 AC_DEFINE(HAVE_SCO_ETC_SHADOW) 131 AC_DEFINE(SCO) 132 AC_CHECK_LIB(prot, accept_pw) 133 AC_CHECK_LIB(x, chsize) 134 ;; 135 *) 136 ;; 137esac 138 139if test -z "$no_pipe"; then 140if test -n "$GCC"; then 141 AC_MSG_CHECKING([if the compiler understands -pipe]) 142 OLDCC="$CC" 143 CC="$CC -pipe" 144 AC_TRY_COMPILE(,, 145 AC_MSG_RESULT(yes), 146 CC="$OLDCC" 147 AC_MSG_RESULT(no)) 148fi 149fi 150 151AC_PROG_INSTALL 152AC_PATH_PROG(SU_CMD, su, "/bin/su") 153AC_DEFINE_UNQUOTED(SU_CMD, "$SU_CMD") 154AC_PATH_PROG(GROFF, groff, ":") 155AC_PATH_PROG(RM, rm, "/bin/rm") 156AC_PATH_PROG(MV, mv, "/bin/mv") 157AC_PROGRAMS_CHECK(MAKEDEP, makedepend makedep, makedepend) 158 159if test "$ac_cv_prog_GROFF" = no; then 160 ac_msg='you don''t have groff so use the preformatted man pages' 161 AC_MSG_WARN($ac_msg) 162fi 163 164dnl Checks for libraries. 165AC_CHECK_LIB(crypt,crypt) 166 167dnl Checks for header files. 168AC_HEADER_STDC 169AC_HEADER_SYS_WAIT 170AC_CHECK_HEADERS(fcntl.h libgen.h shadow.h stdarg.h stdlib.h) 171AC_CHECK_HEADERS(string.h syslog.h unistd.h) 172AC_CHECK_HEADERS(sys/param.h sys/resource.h sys/time.h) 173 174AC_CHECK_HEADERS([utime.h], [], [], 175[[#ifdef HAVE_UTIME_H 176# include <utime.h> 177#endif 178]]) 179 180AC_CHECK_HEADERS([sys/resource.h], [], [], 181[[#ifdef HAVE_SYS_TIME_H 182# include <sys/time.h> 183#endif 184#ifdef HAVE_SYS_RESOURCE_H 185# include <sys/resource.h> 186#endif 187]]) 188 189AC_MSG_CHECKING(whether unistd.h needs _XOPEN_SOURCE for crypt(3)) 190AC_CACHE_VAL(su_cv_unistd_needs_xopen_source, 191[AC_EGREP_CPP(yes, [#define crypt yes 192#include <unistd.h>], su_cv_unistd_needs_xopen_source=no, 193 AC_EGREP_CPP(yes, [#define crypt yes 194#define _XOPEN_SOURCE 195#include <unistd.h>], su_cv_unistd_needs_xopen_source=yes, 196 su_cv_unistd_needs_xopen_source=no))]) 197AC_MSG_RESULT($su_cv_unistd_needs_xopen_source) 198test $su_cv_unistd_needs_xopen_source = yes && 199 AC_DEFINE(_XOPEN_SOURCE) 200 201dnl Checks for typedefs, structures, and compiler characteristics. 202AC_TYPE_SIZE_T 203AC_TYPE_UID_T 204AC_TYPE_PID_T 205 206dnl Checks for library functions. 207AC_TYPE_SIGNAL 208AC_CHECK_FUNCS(openlog syslog) 209AC_CHECK_FUNCS(seteuid) 210AC_CHECK_FUNCS(setresuid) 211AC_CHECK_FUNCS(setrlimit getrlimit) 212AC_CHECK_FUNCS(basename) 213AC_CHECK_FUNCS(sigaction) 214AC_CHECK_FUNCS(sigprocmask) 215AC_CHECK_FUNCS(initgroups) 216AC_CHECK_FUNCS(getspnam) 217AC_CHECK_FUNCS(getpassphrase) 218AC_CHECK_FUNCS(sysconf) 219 220dnl Define HAVE_RLIMIT if getrlimit/setrlimit exists and the symbol 221dnl we're interested in exists (in HP-UX 9, it doesn't !!!). 222 223AC_MSG_CHECKING(for a working set/getrlimit) 224if test $ac_cv_func_setrlimit = yes -a $ac_cv_func_getrlimit = yes; then 225 AC_EGREP_CPP(yes, 226[#include <sys/resource.h> 227#ifdef RLIMIT_CORE 228yes 229#endif 230], have_rlimit_core=yes, have_rlimit_core=no) 231 if test $have_rlimit_core = yes; then 232 AC_DEFINE(HAVE_RLIMIT) 233 fi 234fi 235AC_MSG_RESULT($have_rlimit_core) 236 237dnl Define NO_SYSLOG if openlog/syslog don't exist 238 239if test $ac_cv_func_openlog = no -o $ac_cv_func_syslog = no; then 240 AC_DEFINE(NO_SYSLOG) 241fi 242 243dnl Look for a proper POSIX sysconf 244 245AC_MSG_CHECKING(for a working POSIX sysconf) 246if test $ac_cv_func_sysconf = yes; then 247 AC_EGREP_CPP(yes, 248[#include <unistd.h> 249#ifdef _SC_LINE_MAX 250yes 251#endif 252], have_line_max=yes, have_line_max=no) 253 if test $have_line_max = yes; then 254 AC_DEFINE(HAVE_WORKING_SYSCONF) 255 fi 256fi 257AC_MSG_RESULT($have_line_max) 258 259dnl What style of signal do you have (POSIX, BSD, or SYSV)? 260 261AC_MSG_CHECKING(what style of signals to use) 262if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then 263 signals_style=POSIX_SIGNALS 264 AC_DEFINE(HAVE_POSIX_SIGNALS) 265fi 266AC_MSG_RESULT($signals_style) 267 268AC_MSG_CHECKING(how to name the installed binary) 269AC_ARG_WITH(program, 270[ --with-program=NAME Installed binary name (default calife)], 271[ case "$withval" in 272 no) 273 AC_MSG_ERROR(Need PROGRAM.) 274 ;; 275 yes) 276 AC_MSG_ERROR(Need PROGRAM.) 277 ;; 278 *) 279 IPROGRAM="$withval" 280 AC_MSG_RESULT($withval) 281 ;; 282 esac ], 283 IPROGRAM="calife" 284 AC_MSG_RESULT(calife) 285) 286 287AC_ARG_WITH(pam, [ --with-pam enable PAM support], 288[case $with_pam in 289 yes) AC_DEFINE(WITH_PAM) 290 AC_MSG_CHECKING(whether to use PAM authentication) 291 AC_MSG_RESULT(yes) 292 with_passwd=no 293 LIBS="$LIBS -lpam" 294 WITH_PAM=yes 295 ;; 296 no) ;; 297 *) AC_MSG_ERROR(["--with-pam does not take an argument."]) 298 ;; 299esac]) 300 301dnl 302dnl Extra PAM foolishness 303dnl 304if test "$with_pam" = "yes"; then 305 dnl 306 dnl Some PAM implementations (MacOS X for example) put the PAM headers 307 dnl in /usr/include/pam instead of /usr/include/security... 308 dnl 309 AC_CHECK_HEADERS([pam/pam_appl.h]) 310fi 311 312if test -n "$WITH_PAM"; then 313 enable_dynamic=yes 314else 315if test -n "$GCC"; then 316AC_MSG_CHECKING(if the command should be linked dynamically) 317AC_ARG_ENABLE(dynamic, 318[ --enable-dynamic Build the program dynamically (default static)], 319[ case "$withval" in 320 no) 321 if test x$os_solaris = xyes -o x$os_hpux = xyes -o \ 322 x$os_darwin = xyes -o x$os_linux = xyes; then 323 ac_msg='it will not work on HP-UX, Linux, MacOS X & Solaris, \ 324linking dynamically.' 325 AC_MSG_WARN($ac_msg) 326 AC_MSG_RESULT(yes) 327 undef STATIC_LINK 328 else 329 LDFLAGS="$LDFLAGS -static" 330 AC_MSG_RESULT(no) 331 STATIC_LINK=1 332 fi 333 ;; 334 yes) 335 AC_MSG_RESULT(yes) 336 ;; 337 *) 338 AC_MSG_RESULT(yes) 339 ;; 340 esac ], 341 if test x$os_solaris != xyes -a x$os_hpux != xyes -a \ 342 x$os_darwin != xyes -a x$os_linux != xyes; then 343 LDFLAGS="$LDFLAGS -static" 344 STATIC_LINK=1 345 fi 346 AC_MSG_RESULT(yes) 347) 348fi 349fi dnl # WITH_PAM 350 351AC_MSG_CHECKING(where to put calife.auth) 352AC_ARG_WITH(etcdir, 353[ --with-etcdir=PATH Directory containing calife.auth (default /etc)], 354[ case "$withval" in 355 no) 356 AC_MSG_ERROR(Need ETCDIR.) 357 ;; 358 yes) 359 ETCDIR="/etc" 360 AC_MSG_RESULT(/etc) 361 ;; 362 *) 363 ETCDIR="$withval" 364 AC_MSG_RESULT($withval) 365 ;; 366 esac ], 367 ETCDIR="/etc" 368 AC_MSG_RESULT(/etc) 369) 370 371AC_MSG_CHECKING(whether we want to execute /etc/calife.out) 372AC_ARG_ENABLE(global-rc, 373[ --enable-global-rc Add /etc/calife.out support], 374[ case "$withval" in 375 yes) 376 AC_DEFINE(WANT_GLOBAL_RC) 377 AC_MSG_RESULT(yes) 378 ;; 379 no) 380 AC_MSG_RESULT(no) 381 ;; 382 *) 383 AC_DEFINE(WANT_GLOBAL_RC) 384 AC_MSG_RESULT(yes) 385 ;; 386 esac ], 387 AC_MSG_RESULT(no) 388) 389 390case "$host" in 391 *-*-linux*) 392 # New option to enable/disable getspnam(3) usage 393AC_MSG_CHECKING(whether we want to disable shadow passwords) 394AC_ARG_ENABLE(shadow, 395[ --disable-shadow Disable getspnam(3) usage for some Linuxes], 396[ case "$withval" in 397 yes) 398 AC_DEFINE(UNUSED_SHADOW) 399 AC_MSG_RESULT(yes) 400 ;; 401 no) 402 AC_MSG_RESULT(no) 403 ;; 404 *) 405 AC_DEFINE(UNUSED_SHADOW) 406 AC_MSG_RESULT(yes) 407 ;; 408 esac ], 409 AC_MSG_RESULT(no) 410) 411esac 412 413AC_MSG_CHECKING(whether we want debugging output) 414AC_ARG_ENABLE(debug, 415[ --enable-debug Set the debugging mode (default is no)], 416[ case "$withval" in 417 no) 418 AC_MSG_RESULT(no) 419 ;; 420 yes) 421 AC_DEFINE(DEBUG) 422 AC_MSG_RESULT(yes) 423 ;; 424 *) 425 AC_DEFINE(DEBUG) 426 AC_MSG_RESULT(yes) 427 ;; 428 esac ], 429 AC_MSG_RESULT(no) 430) 431 432AC_MSG_CHECKING(whether we have a setuid-aware shell) 433AC_ARG_ENABLE(shellhack, 434[ --enable-shellhack Try to fool the shell about our setuidness], 435[ case "$withval" in 436 no) 437 AC_MSG_RESULT(no) 438 ;; 439 yes) 440 AC_DEFINE(NO_SETUID_SHELL) 441 AC_MSG_RESULT(yes) 442 ;; 443 *) 444 AC_MSG_RESULT(no) 445 ;; 446 esac ], 447 AC_MSG_RESULT(no) 448) 449 450AC_ARG_ENABLE(warnings, 451[ --enable-warnings Enable -Wall if using gcc.], 452[ if test -n "$GCC"; then 453 AC_MSG_RESULT(Adding -Wall to CFLAGS.) 454 CFLAGS="$CFLAGS -Wall" 455 fi]) 456 457AC_ARG_ENABLE(pedantic, 458[ --enable-pedantic Enable -pedantic if using gcc.], 459[ if test -n "$GCC"; then 460 AC_MSG_RESULT(Adding -pedantic to CFLAGS.) 461 CFLAGS="$CFLAGS -pedantic" 462 fi]) 463 464AC_SUBST(IPROGRAM) 465AC_SUBST(ETCDIR) 466AC_SUBST(GROFF) 467AC_SUBST(MV) 468AC_SUBST(RM) 469AC_SUBST(BINGRP) 470 471AC_OUTPUT(Makefile calife.1 calife.auth.5) 472