AC_INIT(src/Edb.h) AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_ISC_POSIX AM_INIT_AUTOMAKE(edb, 1.0.5.007) AM_CONFIG_HEADER(config.h) AC_PROG_CC AM_PROG_CC_STDC AC_C_CONST AM_ENABLE_SHARED AM_PROG_LIBTOOL if test X"$enable_shared" = Xyes; then DLLDFLAGS=-export-dynamic AC_SUBST(DLLDFLAGS) fi AM_WITH_DMALLOC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_C_BIGENDIAN ##################### DB stuff dnl AC_PROG_INSTALL() dnl AC_ARG_PROGRAM() 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 XXX dnl Don't override anything if it's already set from the environment. AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) dnl AC_SUBST(CXX) dnl AC_SUBST(CXXFLAGS) AC_SUBST(LDFLAGS) case "$host_os" in aix4.1*) CFLAGS=${CFLAGS-"-O3"};; bsd4.4) CFLAGS=${CFLAGS-"-O2"};; bsdi4*) CFLAGS=${CFLAGS-"-O2"};; bsdi*) CC=${CC-"shlicc2"} CFLAGS=${CFLAGS-"-O2"} LIBS="-lipc $LIBS";; irix*) CFLAGS=${CFLAGS-"-O2"};; nextstep3) CFLAGS=${CFLAGS-"-O2"};; linux*) CFLAGS=${CFLAGS-"-O2"};; mpeix*) CPPFLAGS="-D_POSIX_SOURCE -D_SOCKET_SOURCE $CPPFLAGS" LIBS="-lsocket -lsvipc $LIBS";; sco*) CFLAGS="$CFLAGS -b elf" LIBS="-lsocket -lnsl $LIBS";; *) CFLAGS=${CFLAGS-"-O"};; esac CXXFLAGS=${CXXFLAGS-"$CFLAGS"} dnl Optional C++ API.. dnl dnl XXX dnl Versions of GCC up to 2.8.0 required -fhandle-exceptions, but it is dnl the default in versions 2.8.0 and after. dnl AC_MSG_CHECKING(if --enable-cxx option specified) dnl AC_ARG_ENABLE(cxx, dnl [ --enable-cxx Provide C++ interfaces.], dnl [db_cv_cxx="$enable_cxx"], [db_cv_cxx="no"]) dnl AC_MSG_RESULT($db_cv_cxx) dnl if test "$db_cv_cxx" = "yes"; then dnl AC_PROG_CXX dnl if test "$GXX" = "yes"; then dnl CXXFLAGS="-fhandle-exceptions $CXXFLAGS" dnl fi dnl AC_LIBOBJ="$AC_LIBOBJ \$(COBJS)" dnl fi dnl There are additional libraries we need for some compiler/architecture dnl combinations. AC_SUBST(LIBS) dnl Optional DB 1.85 compatibility API. AC_MSG_CHECKING(if --enable-compat185 option specified) AC_ARG_ENABLE(compat185, [ --enable-compat185 Include DB 1.85 compatibility API.], [db_cv_compat185="$enable_compat185"], [db_cv_compat185="no"]) AC_MSG_RESULT($db_cv_compat185) dnl if test "$db_cv_compat185" = "yes"; then dnl AC_LIBOBJ="db185.o $AC_LIBOBJ" dnl fi dnl Optional utilities. AC_SUBST(build_additional) AC_MSG_CHECKING(if --enable-dump185 option specified) AC_ARG_ENABLE(dump185, [ --enable-dump185 Build db_dump185(1) to dump 1.85 databases.], [db_cv_dump185="$enable_dump185"], [db_cv_dump185="no"]) AC_MSG_RESULT($db_cv_dump185) if test "$db_cv_dump185" = "yes"; then build_additional="db_dump185 $build_additional" fi dnl Check for programs used in building and installation. AC_PATH_PROG(db_cv_path_ar, ar, missing_ar) if test "$db_cv_path_ar" = missing_ar; then AC_MSG_ERROR([No ar utility found.]) fi AC_PATH_PROG(db_cv_path_chmod, chmod, missing_chmod) if test "$db_cv_path_chmod" = missing_chmod; then AC_MSG_ERROR([No chmod utility found.]) fi AC_PATH_PROG(db_cv_path_cp, cp, missing_cp) if test "$db_cv_path_cp" = missing_cp; then AC_MSG_ERROR([No cp utility found.]) fi AC_PATH_PROG(db_cv_path_mkdir, mkdir, missing_mkdir) if test "$db_cv_path_mkdir" = missing_mkdir; then AC_MSG_ERROR([No mkdir utility found.]) fi AC_PATH_PROG(db_cv_path_ranlib, ranlib, missing_ranlib) AC_PATH_PROG(db_cv_path_rm, rm, missing_rm) if test "$db_cv_path_rm" = missing_rm; then AC_MSG_ERROR([No rm utility found.]) fi AC_PATH_PROG(db_cv_path_sh, sh, missing_sh) if test "$db_cv_path_sh" = missing_sh; then AC_MSG_ERROR([No sh utility found.]) fi AC_PATH_PROG(db_cv_path_strip, strip, missing_strip) if test "$db_cv_path_strip" = missing_strip; then AC_MSG_ERROR([No strip utility found.]) fi dnl Checks for typedefs, structures, and compiler characteristics. AC_CHECK_TYPE(size_t, int) AC_C_BIGENDIAN AC_C_CONST AC_STRUCT_ST_BLKSIZE AC_HEADER_STAT AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T dnl Checks for header files. AC_HEADER_DIRENT AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADER(zlib.h,, AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")) dnl Checks for system functions for which we have replacements. dnl dnl XXX dnl The only portable getcwd call is getcwd(char *, size_t), where the dnl buffer is non-NULL -- Solaris can't handle a NULL buffer, and they dnl deleted getwd(). AC_REPLACE_FUNCS(getcwd getopt memcmp memcpy memmove) AC_REPLACE_FUNCS(raise snprintf strerror strsep vsnprintf) dnl Check for system functions we optionally use. AC_CHECK_FUNCS(getuid pread pstat_getdynamic sysconf) dnl A/UX has a broken getopt(3). case "$host_os" in dnl aux*) AC_LIBOBJ = "getopt.o $AC_LIBOBJ" ;; esac dnl Checks for system functions for which we don't have replacements. dnl dnl HP/UX has the shmget(2) interfaces, but you can't use them to hold dnl mutexes, so they're useless. dnl dnl SunOS has the shmget(2) interfaces, but there appears to be a missing dnl #include file, so we ignore them. dnl dnl Nextstep (version 3.3) apparently supports mmap(2) (the mmap symbol is dnl defined in the C library) but does not support munmap(2). Don't try dnl to find mmap if we can't find munmap. shmget_ok=no case "$host_os" in hpux*) AC_MSG_WARN([shmget(2) interface ignored on HP/UX.]);; sunos*) AC_MSG_WARN([shmget(2) interface ignored on SunOS.]);; *) shmget_ok=yes AC_CHECK_FUNCS(shmget, , shmget_ok=no) esac mmap_ok=no case "$host_os" in ultrix*) AC_MSG_WARN([mmap(2) interface ignored on Ultrix.]);; *) mmap_ok=yes AC_CHECK_FUNCS(mmap munmap, , mmap_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 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 Check for the sigfillset macro/function. If it exists, we assume we can dnl use it and sigprocmask to we block signals when creating temporary files. 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, 1, [sigfillset() available]) fi dnl Vendors are doing 64-bit lseek in different ways. dnl AIX, HP/UX and Solaris all use _FILE_OFFSET_BITS to specify a "big-file" dnl environment. AC_MSG_CHECKING(if --disable-bigfile option specified) AC_ARG_ENABLE(bigfile, [ --disable-bigfile Disable AIX, HP/UX, Solaris big files.], [db_cv_bigfile="$enable_bigfile"], [db_cv_bigfile="yes"]) if test "$db_cv_bigfile" = yes; then case "$host_os" in bsdi*|aix*|hpux*|solaris*) AC_DEFINE(HAVE_FILE_OFFSET_BITS, 1, [_FILE_OFFSET_BITS available]);; esac AC_MSG_RESULT("no") else AC_MSG_RESULT("yes") fi dnl Some architectures require DB to be compiled with special flags and/or dnl libraries for threaded applications case "$host_os" in freebsd*) CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS";; irix*) CPPFLAGS="-D_SGI_MP_SOURCE $CPPFLAGS";; linux*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; osf*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; solaris*) CPPFLAGS="-D_REENTRANT $CPPFLAGS" LIBS="-lthread $LIBS";; esac AC_SUBST(spin_line1) AC_SUBST(spin_line2) AC_SUBST(spin_line3) mutex_align=1; AC_SUBST(mutex_align) dnl Check for the standard shorthand types. AC_SUBST(u_char_decl) AC_CACHE_CHECK([for u_char], db_cv_uchar, [dnl AC_TRY_COMPILE([#include ], [u_char foo = 0; return foo;], [db_cv_uchar=yes], [db_cv_uchar=no])]) if test "$db_cv_uchar" = no; then u_char_decl="typedef unsigned char u_char;" fi AC_SUBST(u_short_decl) AC_CACHE_CHECK([for u_short], db_cv_ushort, [dnl AC_TRY_COMPILE([#include ], [u_short foo = 0; return foo;], [db_cv_ushort=yes], [db_cv_ushort=no])]) if test "$db_cv_ushort" = no; then u_short_decl="typedef unsigned short u_short;" fi AC_SUBST(u_int_decl) AC_CACHE_CHECK([for u_int], db_cv_uint, [dnl AC_TRY_COMPILE([#include ], [u_int foo = 0; return foo;], [db_cv_uint=yes], [db_cv_uint=no])]) if test "$db_cv_uint" = no; then u_int_decl="typedef unsigned int u_int;" fi AC_SUBST(u_long_decl) AC_CACHE_CHECK([for u_long], db_cv_ulong, [dnl AC_TRY_COMPILE([#include ], [u_long foo = 0; return foo;], [db_cv_ulong=yes], [db_cv_ulong=no])]) if test "$db_cv_ulong" = no; then u_long_decl="typedef unsigned long u_long;" fi dnl DB/Vi use specific integer sizes. AC_SUBST(u_int8_decl) AC_CACHE_CHECK([for u_int8_t], db_cv_uint8, [dnl AC_TRY_COMPILE([#include ], [u_int8_t foo = 0; return foo;], [db_cv_uint8=yes])]) if test "$db_cv_uint8" = no; then AC_MSG_ERROR(No unsigned 8-bit integral type.) fi if test "$db_cv_uint8" != yes; then u_int8_decl="typedef $db_cv_uint8 u_int8_t;" fi AC_SUBST(u_int16_decl) AC_CACHE_CHECK([for u_int16_t], db_cv_uint16, [dnl AC_TRY_COMPILE([#include ], [u_int16_t foo = 0; return foo;], [db_cv_uint16=yes])]) if test "$db_cv_uint16" = no; then AC_MSG_ERROR([No unsigned 16-bit integral type.]) fi if test "$db_cv_uint16" != yes; then u_int16_decl="typedef $db_cv_uint16 u_int16_t;" fi AC_SUBST(int16_decl) AC_CACHE_CHECK([for int16_t], db_cv_int16, [dnl AC_TRY_COMPILE([#include ], [int16_t foo = 0; return foo;], [db_cv_int16=yes])]) if test "$db_cv_int16" = no; then AC_MSG_ERROR([No signed 16-bit integral type.]) fi if test "$db_cv_int16" != yes; then int16_decl="typedef $db_cv_int16 int16_t;" fi AC_SUBST(u_int32_decl) AC_CACHE_CHECK([for u_int32_t], db_cv_uint32, [dnl AC_TRY_COMPILE([#include ], [u_int32_t foo = 0; return foo;], [db_cv_uint32=yes])]) if test "$db_cv_uint32" = no; then AC_MSG_ERROR([No unsigned 32-bit integral type.]) fi if test "$db_cv_uint32" != yes; then u_int32_decl="typedef $db_cv_uint32 u_int32_t;" fi AC_SUBST(int32_decl) AC_CACHE_CHECK([for int32_t], db_cv_int32, [dnl AC_TRY_COMPILE([#include ], [int32_t foo = 0; return foo;], [db_cv_int32=yes])]) if test "$db_cv_int32" = no; then AC_MSG_ERROR([No signed 32-bit integral type.]) fi if test "$db_cv_int32" != yes; then int32_decl="typedef $db_cv_int32 int32_t;" fi AC_MSG_CHECKING(if --enable-test option specified) AC_ARG_ENABLE(test, [ --enable-test Build the Tcl-based test suite.], [db_cv_test="$enable_test"], [db_cv_test="no"]) AC_MSG_RESULT($db_cv_test) if test "$db_cv_test" = yes; then dnl Try to find the Tk/Tcl library. dnl dnl XXX dnl Some systems require -ldl (Linux, BSD/OS 3.X), and we have to dnl figure that out. There are two problems here: (1) assume that dnl loading Tcl_Eval, Tcl_VarEval and Tcl_EvalFile will force a dnl load error if -ldl or -lm are needed and not there. (2) use dnl different function names on each test, otherwise we find the dnl result of the first test in the cache and don't do subsequent dnl checks. AC_CHECK_LIB(tcl, Tcl_Eval, [db_cv_tcl="-ltcl"], [AC_CHECK_LIB(tcl, Tcl_VarEval, [db_cv_tcl="-ltcl -ldl -lm"], [AC_CHECK_LIB(tcl, Tcl_EvalFile, [db_cv_tcl="-ltcl -lm"], [db_cv_tcl=no], -lm)], -ldl -lm)]) if test "$db_cv_tcl" = "no"; then AC_MSG_ERROR([No Tcl library: unable to build test program.]) else build_additional="dbtest $build_additional" LIBS="$LIBS $db_cv_tcl" fi dnl Check for programs used in testing. AC_PATH_PROG(db_cv_path_cmp, cmp, missing_cmp) if test "$db_cv_path_cmp" = missing_cmp; then AC_MSG_ERROR([No cmp utility found.]) fi AC_PATH_PROG(db_cv_path_diff, diff, missing_diff) if test "$db_cv_path_diff" = missing_diff; then AC_MSG_ERROR([No diff utility found.]) fi AC_PATH_PROG(db_cv_path_kill, kill, missing_kill) if test "$db_cv_path_kill" = missing_kill; then AC_MSG_ERROR([No kill utility found.]) fi AC_PATH_PROG(db_cv_path_ls, ls, missing_ls) if test "$db_cv_path_ls" = missing_ls; then AC_MSG_ERROR([No ls utility found.]) fi AC_PATH_PROG(db_cv_path_mv, mv, missing_mv) if test "$db_cv_path_mv" = missing_mv; then AC_MSG_ERROR([No mv utility found.]) fi AC_PATH_PROG(db_cv_path_sed, sed, missing_sed) if test "$db_cv_path_sed" = missing_sed; then AC_MSG_ERROR([No sed utility found.]) fi AC_PATH_PROG(db_cv_path_sleep, sleep, missing_sleep) if test "$db_cv_path_sleep" = missing_sleep; then AC_MSG_ERROR([No sleep utility found.]) fi AC_PATH_PROG(db_cv_path_sort, sort, missing_sort) if test "$db_cv_path_sort" = missing_sort; then AC_MSG_ERROR([No sort utility found.]) fi AC_PATH_PROG(db_cv_path_tr, tr, missing_tr) if test "$db_cv_path_tr" = missing_tr; then AC_MSG_ERROR([No tr utility found.]) fi fi ncurses_ok=no gtk_ok=no GTK_CONFIG=`which gtk-config` if test -x "$GTK_CONFIG"; then AC_CHECK_LIB(gtk, gtk_init, gtk_ok=yes, gtk_ok=no, `$GTK_CONFIG --libs`) fi AC_MSG_CHECKING([for gtk db editor to be built]) AC_ARG_ENABLE(gtk, [ --enable-gtk Enable gtk1.x based db editor], [ if test "$enableval" = "yes" ; then if test "$gtk_ok" = "no" ; then AC_MSG_ERROR(gtk support requested but not found) fi else gtk_ok=no fi ]) AC_MSG_RESULT($gtk_ok) AM_CONDITIONAL(EDB_GTK_ED, test "$gtk_ok" = yes) AC_CHECK_LIB(ncurses, putwin, [AC_CHECK_HEADER(ncurses.h, ncurses_ok=yes, ncurses_ok=no)], ncurses_ok=no, -lncurses) AC_MSG_CHECKING([for ncurses db editor to be built]) AC_ARG_ENABLE(ncurses, [ --enable-ncurses Enable ncurses based db editor], [ if test "$enableval" = "yes" ; then if test "$ncurses_ok" = "no" ; then AC_MSG_ERROR(ncurses support requested but not found) fi else ncurses_ok=no fi ]) AC_MSG_RESULT($ncurses_ok) AM_CONDITIONAL(EDB_VT_ED, test "$ncurses_ok" = yes) AC_OUTPUT([ Makefile edb.pc src/Makefile tools/Makefile tools/edb_gtk_ed/Makefile test/Makefile src/edb_common.h src/edb_int.h src/edb_185.h edb-config README edb.spec debian/changelog ], [ chmod +x edb-config ])