dnl @(#)configure.in 11.33 (Sleepycat) 11/11/99 dnl Process this file with autoconf to produce a configure script. AC_INIT(db.c) VERSION=`cat ${srcdir}/../.version` MAJOR_VERSION=[`expr $VERSION : '\([0-9][0-9]*\)'`] AC_SUBST(MAJOR_VERSION) MINOR_VERSION=[`expr $VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\)'`] AC_SUBST(MINOR_VERSION) MICRO_VERSION=[`expr $VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)'`] AC_SUBST(MICRO_VERSION) AM_INIT_AUTOMAKE([mifluz], $VERSION, nosubst) AC_PREREQ(2.13) AM_CONFIG_HEADER(db_config.h) AC_PROG_MAKE_SET AM_PROG_LIBTOOL dnl Initialize maintainer mode AM_MAINTAINER_MODE dnl Checks for programs. AC_PROG_CC AC_COMPILE_WARNINGS dnl Configure setup. AC_PROG_INSTALL() AC_CANONICAL_HOST AC_ARG_PROGRAM() dnl Process all options before using them. This is necessary because there dnl are dependencies among them. AM_OPTIONS_SET dnl This is where we handle stuff that autoconf can't handle: compiler, dnl preprocessor and load flags, libraries that the standard tests don't dnl look for. The default optimization is -O. dnl dnl There are additional libraries we need for some compiler/architecture dnl combinations. dnl dnl Some architectures require DB to be compiled with special flags and/or dnl libraries for threaded applications dnl dnl The makefile CC may be different than the CC used in config testing, dnl because the makefile CC may be set to use $(LIBTOOL). dnl dnl XXX dnl Don't override anything if it's already set from the environment. optimize_def="-O" case "$host_os" in aix4.*) optimize_def="-O2" CC=${CC-"xlc_r"} CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS";; bsdi3*) CC=${CC-"shlicc2"} optimize_def="-O2" LIBS="-lipc $LIBS";; bsdi*) optimize_def="-O2";; freebsd*) optimize_def="-O2" CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS";; hpux*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; irix*) optimize_def="-O2" CPPFLAGS="-D_SGI_MP_SOURCE $CPPFLAGS";; linux*) optimize_def="-O2" CPPFLAGS="-D_REENTRANT $CPPFLAGS";; mpeix*) CPPFLAGS="-D_POSIX_SOURCE -D_SOCKET_SOURCE $CPPFLAGS" LIBS="-lsocket -lsvipc $LIBS";; osf*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; sco3.2v4*) CC=${CC-"cc -belf"} LIBS="-lsocket -lnsl_s $LIBS";; sco*) CC=${CC-"cc -belf"} LIBS="-lsocket -lnsl $LIBS";; solaris*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; esac CFLAGS=${CFLAGS-$optimize_def} CXXFLAGS=${CXXFLAGS-"$CFLAGS"} dnl If the user wants a debugging environment, add -g to the CFLAGS value. dnl dnl XXX dnl Some compilers can't mix optimizing and debug flags. The only way to dnl handle this is to specify CFLAGS in the environment before configuring. if test "$db_cv_debug" = yes; then AC_DEFINE(DEBUG) CFLAGS="$CFLAGS -g" CXXFLAGS="$CXXFLAGS -g" fi dnl Set some #defines based on configuration options. if test "$db_cv_diagnostic" = yes; then AC_DEFINE(DIAGNOSTIC) fi if test "$db_cv_debug_rop" = yes; then AC_DEFINE(DEBUG_ROP) fi if test "$db_cv_debug_wop" = yes; then AC_DEFINE(DEBUG_WOP) fi CHECK_ZLIB dnl Checks for typedefs, structures, and system/compiler characteristics. AC_C_BIGENDIAN AC_C_CONST AC_HEADER_STAT AC_HEADER_TIME AC_STRUCT_ST_BLKSIZE AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T dnl Define any short-hand types we're missing. AM_SHORTHAND_TYPES dnl Checks for header files. AC_HEADER_DIRENT AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(sys/time.h) dnl Check for mutexes. We do this here because it changes $LIBS. AM_DEFINE_MUTEXES dnl Check for system functions we optionally use. AC_CHECK_FUNCS(getuid pread pstat_getdynamic sysconf) AC_CHECK_FUNCS(sched_yield yield) dnl Check for the sigfillset macro/function. If it exists, we assume we can dnl use it and sigprocmask to block signals when creating temporary files. dnl dnl !!! dnl Don't replace this test with AC_CHECK_FUNCS, it fails on Solaris because dnl the C library has the sigfillset symbol, but common compiler flags like dnl -Xc can make the sigset_t type unavailable. AC_CACHE_CHECK([for sigfillset], db_cv_have_sigfillset, [dnl AC_TRY_LINK([#include ], [sigset_t set; sigfillset(&set);], [db_cv_have_sigfillset=yes], [db_cv_have_sigfillset=no])]) if test "$db_cv_have_sigfillset" = yes; then AC_DEFINE(HAVE_SIGFILLSET) fi dnl Check for fcntl(2) to deny child process access to file descriptors. AC_CACHE_CHECK([for fcntl/F_SETFD], db_cv_fcntl_f_setfd, [dnl AC_TRY_RUN([ #include #include main(){exit(fcntl(1, F_SETFD, 1) == -1);}], [db_cv_fcntl_f_setfd=yes], [db_cv_fcntl_f_setfd=no], [:])]) if test "$db_cv_fcntl_f_setfd" = yes; then AC_DEFINE(HAVE_FCNTL_F_SETFD) fi dnl Checks for system functions for which we don't have replacements. dnl We require qsort(3) and select(2). AC_CHECK_FUNCS(qsort, , AC_MSG_ERROR([No qsort library function.])) AC_CHECK_FUNCS(select, , AC_MSG_ERROR([No select library function.])) dnl Some versions of sprintf return a pointer to the first argument instead dnl of a character count. We assume that the return value of snprintf and dnl vsprintf etc. will be the same as sprintf, and check the easy one. AC_CACHE_CHECK([for int type sprintf return value], db_cv_sprintf_count, [dnl AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}], [db_cv_sprintf_count=yes], [db_cv_sprintf_count=no], [:])]) if test "$db_cv_sprintf_count" = no; then AC_DEFINE(SPRINTF_RET_CHARPNT) fi dnl Vendors are doing 64-bit lseek in different ways. dnl Linux, AIX, HP/UX and Solaris all use _FILE_OFFSET_BITS to specify a "big-file" dnl environment. if test "$db_cv_bigfile" = yes; then case "$host_os" in bsdi*|aix*|hpux*|solaris*) AC_DEFINE(HAVE_FILE_OFFSET_BITS);; linux*) AC_DEFINE(HAVE_FILE_OFFSET_BITS) AC_DEFINE(HAVE_LARGEFILE_SOURCE) ;; esac fi dnl Figure out how to create shared regions. dnl dnl First, we look for mmap. dnl dnl BSD/OS has mlock(2), but it doesn't work. dnl dnl Nextstep (version 3.3) apparently supports mmap(2) (the mmap symbol dnl is defined in the C library) but does not support munmap(2). Don't dnl try to use mmap if we can't find munmap. dnl dnl Ultrix has mmap(2), but it doesn't work. mmap_ok=no case "$host_os" in ultrix*) AC_MSG_WARN([mmap(2) interface ignored on Ultrix.]);; bsdi*) AC_MSG_WARN([mlock(2) interface ignored on BSD/OS.]) mmap_ok=yes AC_CHECK_FUNCS(mmap munmap, , mmap_ok=no);; *) mmap_ok=yes AC_CHECK_FUNCS(mlock munlock) AC_CHECK_FUNCS(mmap munmap, , mmap_ok=no);; esac dnl Second, we look for shmget. dnl dnl SunOS has the shmget(2) interfaces, but there appears to be a missing dnl #include file, so we ignore them. shmget_ok=no case "$host_os" in sunos*) AC_MSG_WARN([shmget(2) interface ignored on SunOS.]);; *) shmget_ok=yes AC_CHECK_FUNCS(shmget, , shmget_ok=no);; esac dnl We require either mmap/munmap(2) or shmget(2). if test "$mmap_ok" = no -a "$shmget_ok" = no; then AC_MSG_ERROR([Neither mmap/munmap(2) or shmget(2) library functions.]) fi dnl Check for programs used in building and installation. AM_PROGRAMS_SET AC_OUTPUT(Makefile db.h)