1 dnl Process this file with autoconf to produce a configure script.
4 dnl Checks for programs.
7 AM_INIT_AUTOMAKE(pgpool-II, 2.2.5)
14 dnl Check compiler option
15 dnl check -Wall option
17 CFLAGS="$CFLAGS -Wall"
18 AC_MSG_CHECKING(for -Wall option)
19 AC_CACHE_VAL(ac_cv_wall,
20 AC_TRY_COMPILE([], [char a;], ac_cv_wall=yes, ac_cv_wall=no))
22 if test $ac_cv_wall = no; then
26 dnl check -Wmissing-prototypes
28 CFLAGS="$CFLAGS -Wmissing-prototypes"
29 AC_MSG_CHECKING(for -Wmissing-prototypes option)
30 AC_CACHE_VAL(ac_cv_wmissing_prototypes,
31 AC_TRY_COMPILE([], [char a;], ac_cv_wmissing_prototypes=yes,
32 ac_cv_wmissing_prototypes=no))
33 echo $ac_cv_wmissing_prototypes
34 if test $ac_cv_wmissing_prototypes = no; then
39 dnl check -Wmissing-prototypes
41 CFLAGS="$CFLAGS -Wmissing-declarations"
42 AC_MSG_CHECKING(for -Wmissing-declarations option)
43 AC_CACHE_VAL(ac_cv_wmissing_declarations,
44 AC_TRY_COMPILE([], [char a;], ac_cv_wmissing_declarations=yes,
45 ac_cv_wmissing_declarations=no))
46 echo $ac_cv_wmissing_declarations
47 if test $ac_cv_wmissing_declarations = no; then
51 dnl Checks for libraries.
53 AC_CHECK_LIB(nsl, main)
54 AC_CHECK_LIB(socket, main)
55 AC_CHECK_LIB(ipc, main)
56 AC_CHECK_LIB(IPC, main)
57 AC_CHECK_LIB(lc, main)
58 AC_CHECK_LIB(compat, main)
59 AC_CHECK_LIB(BSD, main)
60 AC_CHECK_LIB(gen, main)
61 AC_CHECK_LIB(PW, main)
62 AC_CHECK_LIB(resolv, main)
64 dnl Checks for header files.
67 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)
69 dnl Checks for typedefs, structures, and compiler characteristics.
74 dnl Checks for sockaddr_storage structure, members and necessary types
75 m4_include([ac_func_accept_argtypes.m4])
76 AC_CHECK_TYPES([struct sockaddr_storage], [], [],
77 [#include <sys/types.h>
78 #ifdef HAVE_SYS_SOCKET_H
79 #include <sys/socket.h>
82 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family,
83 struct sockaddr_storage.__ss_family,
84 struct sockaddr_storage.ss_len,
85 struct sockaddr_storage.__ss_len,
86 struct sockaddr.sa_len], [], [],
87 [#include <sys/types.h>
88 #ifdef HAVE_SYS_SOCKET_H
89 #include <sys/socket.h>
93 AC_CHECK_TYPES([union semun],[],[],[#include <sys/types.h>
95 #include <sys/sem.h>])
97 dnl Checks for library functions.
101 AC_FUNC_ACCEPT_ARGTYPES
102 AC_CHECK_FUNCS(setsid select socket sigprocmask strdup strerror strftime strtok asprintf gai_strerror hstrerror pstat setproctitle)
104 dnl Checks for pg_config command.
105 AC_CHECK_PROGS(PGCONFIG, pg_config)
109 PGSQL_INCLUDE_DIR=/usr/local/pgsql/include
110 PGSQL_LIB_DIR=/usr/local/pgsql/lib
112 PGSQL_INCLUDE_DIR=`pg_config --includedir`
113 PGSQL_LIB_DIR=`pg_config --libdir`
118 [ --with-pgsql=DIR site header files for PostgreSQL in DIR],
121 "" | y | ye | yes | n | no)
122 AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql option.])
125 PGSQL_INCLUDE_DIR="$withval"/include
126 PGSQL_LIB_DIR="$withval"/lib
129 AC_ARG_WITH(pgsql-includedir,
130 [ --with-pgsql-includedir=DIR site header files for PostgreSQL in DIR],
133 "" | y | ye | yes | n | no)
134 AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql-includedir option.])
137 PGSQL_INCLUDE_DIR="$withval"
140 AC_ARG_WITH(pgsql-libdir,
141 [ --with-pgsql-libdir=DIR site library files for PostgreSQL in DIR],
144 "" | y | ye | yes | n | no)
145 AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql-libdir option.])
148 PGSQL_LIB_DIR="$withval"
152 [ --with-pam build with PAM support],
153 [AC_DEFINE([USE_PAM], 1, [Define to 1 to build with PAM support. (--with-pam)])])
154 if test "$with_pam" = yes ; then
155 AC_CHECK_LIB(pam, pam_start, [], [AC_MSG_ERROR([library 'pam' is required for PAM])])
156 AC_CHECK_HEADERS(security/pam_appl.h, [],
157 [AC_CHECK_HEADERS(pam/pam_appl.h, [],
158 [AC_MSG_ERROR([header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM.])])])
161 OLD_LDFLAGS="$LDFLAGS"
162 LDFLAGS="-L$PGSQL_LIB_DIR"
164 AC_CHECK_LIB(pq, PQexecPrepared, [], [AC_MSG_ERROR(libpq is not installed or libpq is old)])
165 AC_CHECK_FUNCS(PQprepare)
166 LDFLAGS="$OLD_LDFLAGS"
169 AC_SUBST(PGSQL_INCLUDE_DIR)
170 AC_SUBST(PGSQL_LIB_DIR)
172 # --enable(disable)-rpath option
174 [ --disable-rpath do not embed shared library search path in executables],
175 [case "${enableval}" in
181 AM_CONDITIONAL([enable_rpath], test x$rpath = xyes)
183 AM_CONFIG_HEADER(config.h)
185 AC_OUTPUT([Makefile parser/Makefile pcp/Makefile])