dnl Process this file with autoconf to produce a configure script. AC_INIT dnl Checks for programs. AC_PROG_CC AM_INIT_AUTOMAKE(pgpool-II, 2.2.5) AC_PROG_RANLIB AC_PROG_LIBTOOL AM_PROG_LEX AC_PROG_YACC dnl Check compiler option dnl check -Wall option OLD_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Wall" AC_MSG_CHECKING(for -Wall option) AC_CACHE_VAL(ac_cv_wall, AC_TRY_COMPILE([], [char a;], ac_cv_wall=yes, ac_cv_wall=no)) echo $ac_cv_wall if test $ac_cv_wall = no; then CFLAGS=$OLD_CFLAGS fi dnl check -Wmissing-prototypes OLD_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Wmissing-prototypes" AC_MSG_CHECKING(for -Wmissing-prototypes option) AC_CACHE_VAL(ac_cv_wmissing_prototypes, AC_TRY_COMPILE([], [char a;], ac_cv_wmissing_prototypes=yes, ac_cv_wmissing_prototypes=no)) echo $ac_cv_wmissing_prototypes if test $ac_cv_wmissing_prototypes = no; then CFLAGS=$OLD_CFLAGS fi dnl check -Wmissing-prototypes OLD_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Wmissing-declarations" AC_MSG_CHECKING(for -Wmissing-declarations option) AC_CACHE_VAL(ac_cv_wmissing_declarations, AC_TRY_COMPILE([], [char a;], ac_cv_wmissing_declarations=yes, ac_cv_wmissing_declarations=no)) echo $ac_cv_wmissing_declarations if test $ac_cv_wmissing_declarations = no; then CFLAGS=$OLD_CFLAGS fi dnl Checks for libraries. AC_CHECK_LIB(m, main) AC_CHECK_LIB(nsl, main) AC_CHECK_LIB(socket, main) AC_CHECK_LIB(ipc, main) AC_CHECK_LIB(IPC, main) AC_CHECK_LIB(lc, main) AC_CHECK_LIB(compat, main) AC_CHECK_LIB(BSD, main) AC_CHECK_LIB(gen, main) AC_CHECK_LIB(PW, main) AC_CHECK_LIB(resolv, main) dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h netinet/tcp.h netinet/in.h netdb.h sys/param.h sys/types.h sys/socket.h sys/un.h sys/time.h sys/sem.h sys/shm.h sys/select.h crypt.h sys/pstat.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_HEADER_TIME dnl Checks for sockaddr_storage structure, members and necessary types m4_include([ac_func_accept_argtypes.m4]) AC_CHECK_TYPES([struct sockaddr_storage], [], [], [#include #ifdef HAVE_SYS_SOCKET_H #include #endif ]) AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family, struct sockaddr_storage.__ss_family, struct sockaddr_storage.ss_len, struct sockaddr_storage.__ss_len, struct sockaddr.sa_len], [], [], [#include #ifdef HAVE_SYS_SOCKET_H #include #endif ]) AC_CHECK_TYPES([union semun],[],[],[#include #include #include ]) dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_FUNC_WAIT3 AC_FUNC_ACCEPT_ARGTYPES AC_CHECK_FUNCS(setsid select socket sigprocmask strdup strerror strftime strtok asprintf gai_strerror hstrerror pstat setproctitle) dnl Checks for pg_config command. AC_CHECK_PROGS(PGCONFIG, pg_config) if test -z $PGCONFIG then PGSQL_INCLUDE_DIR=/usr/local/pgsql/include PGSQL_LIB_DIR=/usr/local/pgsql/lib else PGSQL_INCLUDE_DIR=`pg_config --includedir` PGSQL_LIB_DIR=`pg_config --libdir` fi AC_ARG_WITH(pgsql, [ --with-pgsql=DIR site header files for PostgreSQL in DIR], [ case "$withval" in "" | y | ye | yes | n | no) AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql option.]) ;; esac PGSQL_INCLUDE_DIR="$withval"/include PGSQL_LIB_DIR="$withval"/lib ]) AC_ARG_WITH(pgsql-includedir, [ --with-pgsql-includedir=DIR site header files for PostgreSQL in DIR], [ case "$withval" in "" | y | ye | yes | n | no) AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql-includedir option.]) ;; esac PGSQL_INCLUDE_DIR="$withval" ]) AC_ARG_WITH(pgsql-libdir, [ --with-pgsql-libdir=DIR site library files for PostgreSQL in DIR], [ case "$withval" in "" | y | ye | yes | n | no) AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql-libdir option.]) ;; esac PGSQL_LIB_DIR="$withval" ]) AC_ARG_WITH(pam, [ --with-pam build with PAM support], [AC_DEFINE([USE_PAM], 1, [Define to 1 to build with PAM support. (--with-pam)])]) if test "$with_pam" = yes ; then AC_CHECK_LIB(pam, pam_start, [], [AC_MSG_ERROR([library 'pam' is required for PAM])]) AC_CHECK_HEADERS(security/pam_appl.h, [], [AC_CHECK_HEADERS(pam/pam_appl.h, [], [AC_MSG_ERROR([header file or is required for PAM.])])]) fi OLD_LDFLAGS="$LDFLAGS" LDFLAGS="-L$PGSQL_LIB_DIR" OLD_LIBS="$LIBS" AC_CHECK_LIB(pq, PQexecPrepared, [], [AC_MSG_ERROR(libpq is not installed or libpq is old)]) AC_CHECK_FUNCS(PQprepare) LDFLAGS="$OLD_LDFLAGS" LIBS="$OLD_LIBS" AC_SUBST(PGSQL_INCLUDE_DIR) AC_SUBST(PGSQL_LIB_DIR) # --enable(disable)-rpath option AC_ARG_ENABLE(rpath, [ --disable-rpath do not embed shared library search path in executables], [case "${enableval}" in yes) rpath=yes ;; no) rpath=no ;; esac], [rpath=yes] ) AM_CONDITIONAL([enable_rpath], test x$rpath = xyes) AM_CONFIG_HEADER(config.h) AC_OUTPUT([Makefile parser/Makefile pcp/Makefile])