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
|
dnl configure.in for libtabe
dnl
dnl Process this file with autoconf to produce a configure script.
dnl-----------------------------------------------------------------------
AC_INIT(src/tabe.h)
AC_CONFIG_AUX_DIR(script)
AC_CONFIG_HEADER(config.h:script/config.h.in)
AC_CANONICAL_HOST
dnl-----------------------------------------------------------------------
dnl libtabe configure special command line options
dnl-----------------------------------------------------------------------
AC_ARG_ENABLE(debug,
[ --enable-debug enable debug],
[ test x$enableval = xyes && AC_DEFINE([DEBUG], 1, [Define if the debug option is enabled.]) ])
AC_ARG_ENABLE(merge_db,
[ --enable-merge-db merge the original db files with the new version.],
[ test x$enableval = xyes && enable_merge_db=mergedb ],
[ enable_merge_db='' ])
AC_ARG_WITH(db_inc,
[ --with-db-inc=PATH set the include dir of Berkeley DB.],
[ test x$withval != x && with_db_inc="-I$withval"])
AC_ARG_WITH(db_lib,
[ --with-db-lib=PATH set the library dir of Berkeley DB.],
[ test x$withval != x && test_db_lib="-L$withval"])
AC_ARG_WITH(db_bin,
[ --with-db-bin=PATH set the binary dir of Berkeley DB.])
AC_ARG_WITH(db_name,
[ --with-db-name=NAME set the library name of Berkeley DB.],
[ test x$withval != x && with_db_name="$withval" ],
[ with_db_name='db' ])
if test "$program_prefix" != NONE; then
program_prefix="$program_prefix/"
else
program_prefix=
fi
AC_SUBST(program_prefix)
AC_SUBST(enable_merge_db)
dnl-----------------------------------------------------------------------
dnl Update version information.
dnl-----------------------------------------------------------------------
verf='src/version.h'
RELEASE_VER=`awk '{if (/RELEASE_VER/) print $3}' $verf | sed 's/"\(.*\)"/\1/'`
CURRENT_VER=`awk '{if (/CURRENT_VER/) print $3}' $verf`
REVISION_VER=`awk '{if (/REVISION_VER/) print $3}' $verf`
AGE_VER=`awk '{if (/AGE_VER/) print $3}' $verf`
AC_SUBST(RELEASE_VER)
AC_SUBST(CURRENT_VER)
AC_SUBST(REVISION_VER)
AC_SUBST(AGE_VER)
dnl-----------------------------------------------------------------------
dnl Check compiler: You can specify in 'CC=<..> ./configure'
dnl-----------------------------------------------------------------------
OLD_CFLAGS=$CFLAGS
AC_PROG_CC
if test "x$GCC" != xyes; then
compiler_type=
AC_MSG_CHECKING([ANSI C compiler])
CFLAGS="$OLD_CFLAGS -Aa"
AC_TRY_RUN([ int main(){return 0;} ], [ compiler_type=ANSIC ],
[ compiler_type=UNKNOWN ], [ cross_compiler=1 ])
if test $compiler_type = ANSIC; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
CFLAGS=$OLD_CFLAGS
dnl-----------------------------------------------------------------------
dnl Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
dnl-----------------------------------------------------------------------
if test -z "$CFLAGS"; then
if test "x$GCC" = xyes; then
optimize_opt=-O2
CFLAGS='-Wall -fsigned-char'
else
optimize_opt=-O
if test "x$compiler_type" = xANSIC; then
CFLAGS=-Aa
else
CFLAGS=
fi
fi
if test "x$enable_debug" = xyes; then
CFLAGS="$CFLAGS -g"
else
CFLAGS="$CFLAGS $optimize_opt"
fi
fi
dnl-----------------------------------------------------------------------
dnl libtool commands.
dnl-----------------------------------------------------------------------
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
dnl-----------------------------------------------------------------------
dnl Checks for programs.
dnl-----------------------------------------------------------------------
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_INSTALL
${INSTALL} -d testdir > /dev/null 2>&1
if test ! -d testdir; then
INSTALL="$srcdir/script/install-sh -c"
AC_SUBST(INSTALL)
fi
rm -rf testdir
AC_MSG_RESULT([checking for install -d: $INSTALL])
dnl-----------------------------------------------------------------------
dnl Checks for host type
dnl-----------------------------------------------------------------------
case "$host_os" in
linux*)
AC_DEFINE([LINUX], 1, [Define for Linux system.])
;;
freebsd*)
AC_DEFINE(FREEBSD, 1, [Define for FreeBSD system.])
;;
openbsd*)
AC_DEFINE(OPENBSD, 1, [Define for OpenBSD system.])
;;
netbsd*)
AC_DEFINE(NETBSD, 1, [Define for NETBSD system.])
;;
solaris*)
AC_DEFINE(SOLARIS, 1, [Define for Solaris system.])
;;
hp*)
AC_DEFINE(HPUX, 1, [Define for HP-UX system.])
;;
darwin*)
AC_DEFINE(DARWIN, 1, [Define for Darwin system.])
;;
esac
dnl-----------------------------------------------------------------------
dnl Checks for Berkeley DB libraries.
dnl-----------------------------------------------------------------------
OLD_CPPFLAGS=$CPPFLAGS
OLD_LDFLAGS=$LDFLAGS
OLD_LIBS=$LIBS
CPPFLAGS="$OLD_CPPFLAGS $with_db_inc"
LDFLAGS="$OLD_LDFLAGS $test_db_lib"
for dbname in $with_db_name db db2 db3 db4
do
AC_CHECK_LIB($dbname, db_open, [found_bdb=yes; test_db_lib="$test_db_lib -l$dbname"; LIBS="-l$dbname"; break])
AC_CHECK_LIB($dbname, db_create, [found_bdb=yes; test_db_lib="$test_db_lib -l$dbname"; LIBS="-l$dbname"; break])
done
if test x$found_bdb != xyes; then
AC_MSG_RESULT([You need Berkeley DB to compile libtabe.])
AC_MSG_RESULT([Please use --with-db-lib and/or --with-db-name to configure.])
exit 1
fi
AC_CHECK_HEADERS(db.h, ,
[ AC_MSG_RESULT([db.h is not available.])
AC_MSG_RESULT([Please use --with-db-inc to configure.])
exit 1 ])
AC_MSG_CHECKING([BerkeleyDB API])
AC_TRY_RUN([
#include <errno.h>
#include <stdlib.h>
#include <db.h>
DB *dbp;
DBC *dbcp;
DB_BTREE_STAT *sp;
#define DB_VERSION (DB_VERSION_MAJOR*100000+DB_VERSION_MINOR*1000+DB_VERSION_PATCH)
int main(void)
{
#if DB_VERSION >= 300000
errno = db_create(&dbp, NULL, 0);
#endif
if(errno) return errno;
#if DB_VERSION >= 401025
errno = dbp->open(dbp, NULL, "foo.db", NULL, DB_BTREE, DB_CREATE, 0644);
#elif DB_VERSION >= 300000
errno = dbp->open(dbp, "foo.db", NULL, DB_BTREE, DB_CREATE, 0644);
#else
errno = db_open("foo.db", DB_BTREE, DB_CREATE, 0644, NULL, NULL, &dbp);
#endif
if(errno) return errno;
#if DB_VERSION >= 303011
errno = dbp->stat(dbp, &sp, 0);
#else
errno = dbp->stat(dbp, &sp, NULL, 0);
#endif
if(errno) return errno;
#if DB_VERSION >= 206004
errno = dbp->cursor(dbp, NULL, &dbcp, 0);
#else
errno = dbp->cursor(dbp, NULL, &dbcp);
#endif
if(errno) return errno;
return 0;
}
],
[ AC_MSG_RESULT([ok])
rm -f foo.db ],
[ AC_MSG_RESULT([BerkeleyDB header and library mismatch, or API changes.])
exit 1 ])
if test x$with_db_lib = x; then
with_db_lib="$test_db_lib"
else
with_db_lib="$test_db_lib -rpath $with_db_lib"
fi
if test x$with_db_bin = x; then
with_db_bin="$PATH"
else
with_db_bin="$with_db_bin:$PATH"
fi
AC_SUBST(with_db_inc)
AC_SUBST(with_db_lib)
AC_SUBST(with_db_bin)
dnl-----------------------------------------------------------------------
dnl Checks for X11R6 library and header files.
dnl-----------------------------------------------------------------------
AC_PATH_X
if test x$no_x = xyes; then
AC_MSG_RESULT([You need X11R6 header files to compile libbims.])
AC_MSG_RESULT([Please use --x-includes to configure.])
build_supports=
else
build_supports=bims
fi
AC_SUBST(x_includes)
AC_SUBST(x_libraries)
AC_SUBST(build_supports)
dnl-----------------------------------------------------------------------
dnl Checks for header files.
dnl-----------------------------------------------------------------------
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
dnl-----------------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
dnl-----------------------------------------------------------------------
AC_C_CONST
dnl-----------------------------------------------------------------------
dnl Checks for library functions.
dnl-----------------------------------------------------------------------
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(strdup strerror strstr)
AC_OUTPUT(Makefile:script/Makefile.in \
src/Makefile \
src/supports/bims/Makefile \
util/Makefile \
util/tsipackdb \
tsi-src/Makefile)
|