# Guess values for system-dependent variables and create `Makefile'.
# Copyright (C) 1991 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#configure [--srcdir=DIR] [--prefix=DIR] [--host=HOST] [--gas] [--nfp] [TARGET]
#All args except --srcdir=DIR, --prefix=DIR, and --exec_prefix=DIR are ignored.
# @(#)configure 1.26 92/04/10
trap 'rm -f conftest* core* uttest; exit 1' 1 2 3 15
# Uncomment out the next line if your sh aborts if an unset variable
# is referenced; some popular systems do not understand +u and most
# bourne shells should already have this set as the default...
# Make sure we don't find the System V /etc/install.
s,:/usr/sbin\([:|]\),\1,g
s,\([:|]\)/usr/sbin:,\1,g
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
# Default destination directory is /usr/local
# Binaries go in "bin", libraries in "lib", manual pages in "man".
# Handle --srcdir with a space before the argument.
if [ x$next_srcdir = xyes ]; then srcdir=$arg; next_srcdir=
# Handle --prefix with a space before the argument.
elif [ x$next_prefix = xyes ]; then prefix=$arg; next_prefix=
# Handle --exec_prefix with a space before the argument.
elif [ x$next_exec_prefix = xyes ]; then exec_prefix=$arg; next_prefix=
# Handle --host with a space before the argument.
elif [ x$next_host = xyes ]; then next_host=
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
srcdir=`echo $arg | sed 's/^[-a-z]*=//'` ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=`echo $arg | sed 's/^[-a-z]*=//'` ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
exec_prefix=`echo $arg | sed 's/^[-a-z_]*=//'` ;;
-exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
-host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
-host | --host | --hos | --ho | --h)
-gas | --gas | --ga | --g) ;;
-nfp | --nfp | --nf | --n) ;;
if [ -z "${exec_prefix}" ] ; then exec_prefix=${prefix} ; fi
vpsub='s@\$\([-./a-zA-Z0-9]*\)<@\1@g'
# Find the source files, if location was not specified.
if [ x$srcdir = x ]; then
srcdirdefaulted=yes; srcdir=.
if [ ! -r $unique_file ]; then srcdir=`pwd`/..; fi
if [ $srcdir != . ]; then
VPATH='VPATH = $(srcdir)'
vpsub='s@\$\([-./a-zA-Z0-9]*\)<@\$<@g'
if [ ! -r $srcdir/$unique_file ]; then
if [ x$srcdirdefaulted = xyes ]; then
echo "$0: Can not find sources in \`.' or \`..'." 1>&2
echo "$0: Can not find sources in \`${srcdir}'." 1>&2
if grep '^#.*define.*MY_NDBM' ${srcdir}/src/config.h >/dev/null 2>/dev/null; then :
if test "$RANDOM" = "$RANDOM"; then
# Plain old Bourne shell.
test -n "`$CC1 / 2>&1`" && CC="$CC1"
test -n "`$CC2 2>&1`" && CC="$CC2"
echo checking for install
if test -z "$INSTALL" && test -n "`install 2>&1`"; then
INSTALLDATA="install -c -m 644"
test -z "$RANLIB" && test -n "`ranlib conftest 2>&1`" && RANLIB=ranlib
echo checking for bison/yacc
test -z "$YACC" && test -n "`bison 2>&1`" && YACC="bison -y"
# ksh, bash or zsh. ksh and zsh write "command not found" to stderr.
test -z "$CC" && type $CC2 && CC="$CC2"
echo checking for install
if test -z "$INSTALL" && type install; then
INSTALLDATA="install -c -m 644"
test -z "$RANLIB" && type ranlib && RANLIB=ranlib
echo checking for bison/yacc
test -z "$YACC" && type bison && YACC="bison -y"
INSTALLDATA=${INSTALLDATA-cp}
compile='$CC $DEFS $TDEFS conftest.c -o conftest $TLIBS $LIBS >/dev/null 2>&1'
# Check for various header files.
if test -d /usr/include/minix; then
DEFS="$DEFS -UUSG -D_POSIX_SOURCE -D_POSIX_1_SOURCE=2 -D_POSIX_C_SOURCE=2 -D_MINIX"
echo checking for BSD string and memory functions
main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
echo checking signal handler return type
main() { exit(0); } t() { signal(SIGINT, foo); kill(getpid(), SIGINT); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
else DEFS="$DEFS -DSIGTYPE=int"
echo checking for directory library header
main() { DIR *d = opendir(".");
if (strcmp(e->d_name, "conftestfile") == 0)
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
echo >&2 "configure: opendir() is missing; cannot continue"
echo checking for ANSI C header files
echo "#include <stddef.h>
main() { exit(0); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
DEFS="$DEFS -DSTDC_HEADERS"
echo checking for POSIX.1 header files
echo "#include <unistd.h>
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
echo checking for uid_t in sys/types.h
echo "#include <sys/types.h>
main() { exit(0); } t() { uid_t x; }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
DEFS="$DEFS -Duid_t=int -Dgid_t=int"
echo checking for mode_t in sys/types.h
echo "#include <sys/types.h>
main() { exit(0); } t() { mode_t x; }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
DEFS="$DEFS -Dmode_t=int"
echo checking for size_t in sys/types.h
echo "#include <sys/types.h>
main() { exit(0); } t() { size_t x; }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
DEFS="$DEFS -Dsize_t=unsigned"
echo checking for unsigned characters
echo 'main() { char c = 255; exit(c < 0); }' > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
DEFS="$DEFS -D__CHAR_UNSIGNED__"
echo checking whether time.h has struct tm
echo '#include <sys/types.h>
main() { struct tm *tp; exit(0); }' > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
else DEFS="$DEFS -DTM_IN_SYS_TIME"
# Check whether various functions exist.
# Functions we provide replacements for.
for func in fnmatch getwd mkdir rename strdup
echo "main() { exit(0); } t() { ${func}(); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
else LIBOBJS="$LIBOBJS ${func}.o"
echo "main() { exit(0); } t() { ${func}(); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
else LIBOBJS="$LIBOBJS hostname.o"
echo "main() { exit(0); } t() { ${func}(); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
else LIBOBJS="$LIBOBJS regex.o"
echo "main() { exit(0); } t() { ${func}(); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
else LIBOBJS="$LIBOBJS dup2.o"
# Functions whose absence we work around.
for func in fchmod fsync ftime mkfifo putenv strerror setvbuf vfork vprintf
echo "main() { exit(0); } t() { ${func}(); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
else DEFS="$DEFS -D`echo $func|tr '[a-z]' '[A-Z]'`_MISSING"
echo checking for timeb.h header file
main() { exit(0); } t() { struct timeb tb; printf("%d", sizeof(tb)); }' > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
DEFS="$DEFS -DTIMEB_H_MISSING"
echo "main() { exit(0); } t() { ${func}(); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
else DEFS="$DEFS -DDOPRNT_MISSING"
echo checking for timezone
echo "main() { extern char *timezone(); printf(\"%s\",timezone(0,0)); exit(0); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
DEFS="$DEFS -DHAVE_TIMEZONE"
echo checking for BSD signals
main() { exit(0); } t() { sigvec(); sigblock(); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
DEFS="$DEFS -DBSD_SIGNALS"
echo "main() { exit(0); } t() { ${func}(); }" > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
#if !defined(F_CHSIZE) && !defined(F_FREESP)
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
LIBOBJS="$LIBOBJS ${func}.o"
else DEFS="$DEFS -D`echo $func|tr '[a-z]' '[A-Z]'`_MISSING"
# Check other misc. things.
echo checking utime with null argument
# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong.
echo '#include <sys/types.h>
exit(!(stat ("uttest", &s) == 0 && utime("uttest", (long *)0) == 0
&& stat("uttest", &t) == 0 && t.st_mtime - s.st_mtime < 120));
test -s conftest && (./conftest) >/dev/null 2>/dev/null || DEFS="$DEFS -DUTIME_NULL_MISSING"
rm -f conftest* core* uttest
LIBPROGS="$LIBPROGS mvdir"
DEFS="$DEFS -DMVDIR="'\\"$(libdir)/mvdir\\"'
echo checking how to get alloca
#define alloca __builtin_alloca
main() { char *p = (char *) alloca(1); exit(0); }' > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
# I've had some problems with this stuff. If you need -lPW for some
# reason, try uncommenting the lines below
#main() { char *p = alloca(1); exit(0); }' > conftest.c
# if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then LIBS="$LIBS -lPW"
LIBOBJS="$LIBOBJS alloca.o"
if grep '^#.*define.*MY_NDBM' ${srcdir}/src/config.h >/dev/null 2>/dev/null; then :
echo checking for ndbm support
main() { exit(0); } t() { dbm_open(0); dbm_close(0); }' > conftest.c
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then :
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
TDEFS="-I${prefix}/include"
TLIBS="-L${prefix}/lib -lgdbm"
if test -s conftest && (./conftest) >/dev/null 2>/dev/null; then
DEFS="$DEFS -I${prefix}/include"
LIBS="$LIBS -L${prefix}/lib -lgdbm"
echo 'configure: Warning: you will likely have to install GNU dbm'
echo ' (including the <ndbm.h> header file)'
echo ' and re-run this configure script'
echo checking for $CC -g -O combination
echo "main() { exit(0); }" > conftest.c
if test -n "`$CC -g -O -o conftest conftest.c 2>&1`"; then
if test -n "`$CC -g -o conftest conftest.c 2>&1`"; then
trap 'rm -f Makefile lib/Makefile src/Makefile man/Makefile doc/Makefile examples/Makefile contrib/Makefile config.status conftest*; exit 1' 1 2 3 15
for dir in . lib src man doc examples contrib
test -d $dir || mkdir $dir
if test "$srcdir" = "."; then
includeopt="-I$srcdir/lib"
includeopt="-I../$srcdir/lib"
if test "$dir" = "."; then
echo '# Generated automatically from Makefile.in by configure.' > $dir/Makefile
s,@exec_prefix@,$exec_prefix,
s,@includeopt@,$includeopt,
s,@INSTALLDATA@,$INSTALLDATA,
" $srcdir/$dir/Makefile.in >> $dir/Makefile
exec_prefix = $exec_prefix
INSTALLDATA = $INSTALLDATA
CDEBUG = $CDEBUG" > config.status