1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330
|
dnl Process this file with autoconf to produce a configure script.
AC_INIT(super.h)
AC_CONFIG_HEADER(config.h)
AC_ARG_ENABLE(pam, [ --disable-pam don't include PAM support even if compile host has PAM])
AC_PROG_CC
Uname=unknown
Major=0
Minor=0
for d in /bin /usr/bin /sbin /usr/sbin ; do
if test -f $d/uname ; then
Uname=`$d/uname`
rev=`$d/uname -r`
break
fi
done
if test "$Uname" = HP-UX ; then
AC_DEFINE(_HPUX_SOURCE)
case "$CC" in
gcc )
CPP="${CC} -E -w"
;;
* )
CPP="${CC} -E -Ae -w"
CFLAGS="${CFLAGS} -Ae"
;;
esac
changequote(<<<,>>>)dnl
Major=`expr "$rev" : '.*\.\([0-9][0-9]*\)\..*'`
Minor=`expr "$rev" : '.*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`
changequote([,])dnl
AC_DEFINE_UNQUOTED(HPUX_MAJOR,$Major)
AC_DEFINE_UNQUOTED(HPUX_MINOR,$Minor)
elif test "$Uname" = Linux ; then
AC_DEFINE(_BSD_SOURCE)
elif test "$Uname" = OSF1 ; then
AC_DEFINE(_OSF_SOURCE)
AC_DEFINE(Digital_UNIX)
elif test "$Uname" = SunOS ; then
changequote(<<<,>>>)dnl
Major=`/bin/expr "$rev" : '^\([0-9][0-9]*\)\.'`
Minor=`/bin/expr "$rev" : '^[0-9][0-9]*\.\([0-9][0-9]*\)'`
changequote([,])dnl
test "$Major" = 5 && AC_DEFINE(SUNOS5)
AC_DEFINE_UNQUOTED(SUNOS_MAJOR,$Major)
AC_DEFINE_UNQUOTED(SUNOS_MINOR,$Minor)
elif test "$Uname" = Darwin ; then
changequote(<<<,>>>)dnl
Major=`/bin/expr "$rev" : '^\([0-9][0-9]*\)\.'`
Minor=`/bin/expr "$rev" : '^[0-9][0-9]*\.\([0-9][0-9]*\)'`
changequote([,])dnl
elif test "$Uname" = OpenBSD ; then
changequote(<<<,>>>)dnl
Major=`/bin/expr "$rev" : '^\([0-9][0-9]*\)\.'`
Minor=`/bin/expr "$rev" : '^[0-9][0-9]*\.\([0-9][0-9]*\)'`
changequote([,])dnl
elif test "$Uname" = AIX ; then
Major=`/bin/uname -v`
Minor=`/bin/uname -r`
# Ensure we are looking at just a numeric value, just in case
# IBM decides to add some letters or dots or underscores...
changequote(<<<,>>>)dnl
Major=`/bin/expr "$Major" : '^[^0-9]*\([0-9][0-9]*\)'`
Minor=`/bin/expr "$Minor" : '\([0-9][0-9]*\)[^0-9]*$'`
changequote([,])dnl
AC_DEFINE_UNQUOTED(AIX_MAJOR,$Major)
AC_DEFINE_UNQUOTED(AIX_MINOR,$Minor)
fi
AC_PROG_INSTALL
AC_HAVE_HEADERS(errno.h stdlib.h limits.h string.h standards.h \
netdb.h locale.h auth.h hpsecurity.h prot.h shadow.h \
fcntl.h regex.h sgtty.h unistd.h \
memory.h malloc.h pwdadj.h sgtty.h sys/time.h stdarg.h syslog.h \
sys/ioctl.h termio.h termios.h \
arpa/inet.h net/route.h net/if.h netinet/in.h \
sys/types.h sys/bsdtypes.h sys/label.h sys/audit.h \
sys/filio.h sys/wait.h sys/param.h sys/security.h \
sys/socket.h sys/sysinfo.h sys/systeminfo.h sys/utsname.h )
# In case the user said --without-pam instead of --disable-pam:
if test "$with_pam" = "no" ; then
enable_pam=no
fi
if test "$enable_pam" != "no" ; then
AC_HAVE_HEADERS(security/pam_appl.h security/pam_misc.h)
fi
AC_AIX
AC_MINIX
AC_CHECKING(for directories to include in the safe path)
SafePath=/bin:/usr/bin
test -d /usr/ucb && SafePath=${SafePath}:/usr/ucb
test -d /usr/bsd && SafePath=${SafePath}:/usr/bsd
AC_DEFINE_UNQUOTED(SAFE_PATH, "${SafePath}")
# syslog may be in one of the following. They may also be needed for
# other reasons, so we just blindly check for them all.
AC_CHECK_LIB(bsd, main)
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(inet, main)
badredhatpam=0
if test "$enable_pam" != "no" ; then
# RH 7.2 has messed up libpam's installation: it supplies with
# libpam.so.0, but not libpam.so. Ditto libpam_misc.
test -f /etc/redhat-release -a -f /lib/libpam.so.0 \
-a ! -f /lib/libpam.so && badredhatpam=1
# -ldl may be needed by -lpam.
AC_CHECK_LIB(dl, main)
AC_CHECK_LIB(pam, main)
AC_CHECK_LIB(pam_misc, main)
fi
# Pick up libcrypt if it exists and this OS needs it.
# (Note that on some OS's, libcrypt does not contain the
# correct crypt(); instead, libc contains the desired crypt.)
if test "$Uname" = SunOS -a $Major = 5 -a $Minor -ge 9 ; then
: # SunOS >= 5.9: don't link with -lcrypt
elif test "$Uname" = OpenBSD ; then
: # don't link with -lcrypt
elif test "$Uname" = Darwin ; then
: # don't link with -lcrypt
else
AC_CHECK_LIB(crypt, main)
fi
if test "$enable_pam" != "no" ; then
AC_CHECK_FUNCS(pam_start)
test "$ac_cv_func_pam_start" = yes && AC_REPLACE_FUNCS(misc_conv)
fi
AC_CHECK_FUNCS(fileno)
AC_CHECK_FUNCS(gtty)
AC_CHECK_FUNCS(syslog)
AC_CHECK_FUNCS(strdup)
AC_CHECK_FUNCS(initgroups)
for lib in os ; do
test "$ac_cv_func_initgroups" = yes && break
AC_CHECK_LIB($lib, initgroups)
done
# On IRIX, -lmalloc avoids a problem with default malloc
# that causes a core dump.
AC_CHECK_LIB(malloc, main)
# May be needed on IRIX
AC_CHECK_LIB(sun, getpwnam)
# Needed on SysV for shadow passwords.
AC_CHECK_LIB(sec, main)
# Needed on Digital Unix for shadow passwords.
AC_CHECK_LIB(security, main)
# Needed on Linux for shadow passwords.
AC_CHECK_LIB(shadow, main)
# Needed on Solaris
AC_CHECK_LIB(nsl, main)
# Needed on SCO-ODT-3.0 for crypt.
AC_CHECK_LIB(ufc, main)
# We want these before the checks, so the checks can modify their values.
test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
# If the user hasn't specified CFLAGS, and we're using gcc, use -O.
test -n "$auto_cflags" && test -n "$GCC" && CFLAGS="$CFLAGS -O"
# If we're on AIX, not using gcc, add the ansi spec.
test "$Uname" = AIX && test -z "$GCC" && CFLAGS="$CFLAGS -qlanglvl=ansi"
# If system supports "const", define ConstDef to be "", but if
# the system doesn't support "const", define ConstDef to be "-Dconst=".
# That makes it suitable for use in the CFLAGS.
AC_C_CONST
ConstDef=
test "$ac_cv_c_const" != yes && ConstDef="-Dconst="
AC_SYS_LONG_FILE_NAMES
AC_SYS_INTERPRETER
test "$ac_cv_sys_interpreter" != yes && AC_DEFINE(INTERPRETER_HACK)
AC_STDC_HEADERS
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_TYPE_GETGROUPS
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_TIME_WITH_SYS_TIME
void_ok=no
AC_MSG_CHECKING(if func signal is compatible with declaring type void)
AC_TRY_COMPILE([
#include <stdio.h>
#include <signal.h>
],
changequote(<<,>>)dnl
<<void (*signal())();
signal(1, 0);>>,
changequote([,])dnl
AC_DEFINE(HAVE_VOID_SIGNAL) void_ok=yes ; AC_MSG_RESULT(yes))
if test $void_ok = no ; then
AC_TRY_COMPILE([
#include <stdio.h>
#include <sys/signal.h>
],
changequote(<<,>>)dnl
<<void (*signal())();
signal(1, 0);>>,
changequote([,])dnl
AC_DEFINE(HAVE_VOID_SIGNAL) void_ok=yes ; AC_MSG_RESULT(yes))
fi
AC_MSG_CHECKING(if sys_errlist is defined)
AC_TRY_COMPILE([
#include <errno.h>
#include <stdio.h>
],
changequote(<<,>>)dnl
<<extern char *sys_errlist[];
fputs(sys_errlist[0], stdout);>>,
changequote([,])dnl
AC_DEFINE(HAVE_SYS_ERRLIST) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING(if errno must be explicitly declared extern)
AC_TRY_COMPILE([
#include <errno.h>
#include <stdio.h>
],
changequote(<<,>>)dnl
<<printf("%d", errno);>>,
changequote([,])dnl
AC_DEFINE(DONT_DECL_ERRNO) AC_MSG_RESULT(no), AC_MSG_RESULT(yes))
AC_MSG_CHECKING(if regex library is POSIX)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <regex.h>
],
changequote(<<,>>)dnl
<<
regex_t preg;
char buf[100];
regmatch_t pmatch[1];
regcomp(&preg, "a pattern", REG_EXTENDED|REG_ICASE|REG_NOSUB|REG_NEWLINE);
regexec(&preg, "a string", 1, pmatch, REG_NOTBOL|REG_NOTEOL);
regerror(1, &preg, buf, sizeof(buf));
regfree(&preg);
>>,
changequote([,])dnl
AC_DEFINE(HAVE_POSIX_REGEX) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING(if compiler supports enum)
AC_TRY_COMPILE(, [enum { red, green, blue } color;],
AC_DEFINE(HAVE_ENUM) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING(if close-on-exec can be done via ioctl())
AC_TRY_COMPILE([
#include <sgtty.h>
#include <stdio.h>
],
changequote(<<,>>)dnl
<<ioctl(0, FIOCLEX, NULL);>>,
changequote([,])dnl
AC_DEFINE(HAVE_IOCTL_FIOCLEX) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_FUNC_VPRINTF
if test "$enable_pam" != "no" ; then
AC_CHECK_FUNCS(pam_strerror)
fi
AC_CHECK_FUNCS(strerror strtol memcpy memset strerror setreuid setregid \
getgroups innetgr iscomsec localtime sysconf sysinfo getdtablesize \
getdomainname sysinfo tcgetattr tcsetattr uname)
# If we're enabling pam support (if PAM available), include pam.o in AC_LIBOBJ.
# Note that if we don't have pam_start() on this system, pam.o will still
# build correctly for a PAM-less system. In other words, include pam.o
# unless the user included the configure option "--disable-pam".
if test "$enable_pam" != "no" ; then
AC_LIBOBJ([pam])
with_pam=1
else
with_pam=0
fi
AC_SUBST(libdir)dnl
AC_SUBST(bindir)dnl
AC_SUBST(SafePath)dnl
AC_SUBST(ConstDef)dnl
AC_SUBST(with_pam)dnl
AC_OUTPUT(Makefile)
test "$badredhatpam" = 1 && {
echo "#"
echo "# WARNING."
echo "#"
echo "# You have /lib/libpam.so.0 but not libpam.so."
echo "# In Redhat 7.{1,2}, this is bugid 55651, and is fixed in rpm"
echo "# pam-0.75-18.7. You should get that rpm to fix several pam bugs,"
echo "# but for now you should become root, and make these links by hand:"
echo "# ln -s /lib/libpam.so.0 /lib/libpam.so"
echo "# ln -s /lib/libpam_misc.so.0 /lib/libpam_misc.so"
echo "#"
echo "# Then, rm config.cache and rerun configure."
echo "#"
echo "#"
}
# The test command will give a non-zero exit code if this isn't
# a bad-redhat-pam system. So use 'exit 0' to make everyone happy.
exit 0
|