dnl Process this file with autoconf to produce a configure script. m4_define([bp_major_version], [0]) m4_define([bp_minor_version], [0]) m4_define([bp_micro_version], [1]) m4_define([bp_interface_age], [0]) m4_define([bp_binary_age], [m4_eval(100 * bp_minor_version + bp_micro_version)]) m4_define([bp_version], [bp_major_version.bp_minor_version.bp_micro_version]) m4_define([bp_lt_current], [m4_eval(100 * bp_minor_version + bp_micro_version - bp_interface_age)]) m4_define([bp_lt_revision], [bp_interface_age]) m4_define([bp_lt_age], [m4_eval(bp_binary_age - bp_interface_age)]) AC_INIT(bufferpool, bp_version) AC_CONFIG_AUX_DIR(config) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(dist-bzip2 check-news) AC_PREFIX_DEFAULT("/usr") AM_CONFIG_HEADER(config.h) AC_ARG_ENABLE(debug, [ --enable-debug enable gcc dubugging flags [[default=no]]],, enable_debug="no") AC_ARG_ENABLE(mudflap, [ --enable-mudflap enable mudflap support (implies --enable-debug) [[default=no]]],, enable_mudflap="no") AC_ARG_ENABLE(errors, [ --enable-errors make gcc warnings behave like errors: none, normal, pedantic [[default=none]]],, enable_errors="none") dnl Check for LibTool Dynamic Loading m4_undefine([AC_PROG_CXX]) m4_defun([AC_PROG_CXX],[]) m4_undefine([AC_PROG_F77]) m4_defun([AC_PROG_F77],[]) AC_PROG_LIBTOOL LIBTOOL="$LIBTOOL --silent" AC_SUBST([LIBTOOL_DEPS]) AC_C_BIGENDIAN([BIGENDIAN="Big Endian"] AC_DEFINE([WORDS_BIGENDIAN], 1, [Define if manchine is big-endian]),[BIGENDIAN="Little Endian"] ) AC_CHECK_LIBM AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS(sys/time.h unistd.h strings.h errno.h sys/errno.h fcntl.h malloc.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_TYPE_UID_T AC_TYPE_PID_T AC_C_INLINE AC_HEADER_TIME dnl Checks for library functions. AC_FUNC_MEMCMP AC_FUNC_MMAP AC_CHECK_FUNCS(select gettimeofday getcwd getwd strcspn strdup strtoul strerror strstr) AC_CHECK_FUNC(getaddrinfo) AC_CHECK_LIB([c], [shm_open], [SHM_LIB=], [AC_CHECK_LIB([rt], [shm_open], [SHM_LIB=-lrt])]) AC_SUBST(SHM_LIB) dnl Check for pthread libraries. ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support])) CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$LIBS $PTHREAD_LIBS" if test "$enable_mudflap" = "yes"; then CFLAGS="$CFLAGS -fmudflapth" LDFLAGS="$LDFLAGS -lmudflapth" enable_debug=yes fi if test "$enable_debug" = "yes"; then CFLAGS="$CFLAGS -g -ggdb -Wall" AC_DEFINE(ENABLE_DEBUG, 1,[Debug enabled]) else AC_DEFINE(ENABLE_DEBUG, 0,[Debug disabled]) CFLAGS="$CFLAGS -O2 -Wall" fi case "$enable_errors" in pedantic) CFLAGS="$CFLAGS -pedantic-errors -Werror" ;; normal | yes) CFLAGS="$CFLAGS -Werror" ;; none | *) CFLAGS="$CFLAGS" ;; esac dnl libtool nonsense LT_CURRENT=bp_lt_current LT_REVISION=bp_lt_revision LT_AGE=bp_lt_age AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) AC_CONFIG_FILES([Makefile docs/Makefile lib/Makefile libbufferpool.pc]) AC_OUTPUT AC_MSG_NOTICE([config files successfully generated! debug enabled ................ : $enable_debug mudflap enabled ............. : $enable_mudflap 'make' will now compile bufferpool and 'su -c make install' will install it. Note: On non-Linux systems you might need to use 'gmake' instead of 'make'. ])