]> git.8kb.co.uk Git - pgpool-ii/pgpool-ii_2.2.5/blob - configure.in
Attempt to send a proper failure message to frontend when authentication
[pgpool-ii/pgpool-ii_2.2.5] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT
3
4 dnl Checks for programs.
5 AC_PROG_CC
6
7 AM_INIT_AUTOMAKE(pgpool-II, 2.2.5)
8 AC_PROG_RANLIB
9 AC_PROG_LIBTOOL
10
11 AM_PROG_LEX
12 AC_PROG_YACC
13
14 dnl Check compiler option
15 dnl check -Wall option
16 OLD_CFLAGS=$CFLAGS
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))
21 echo $ac_cv_wall
22 if test $ac_cv_wall = no; then
23    CFLAGS=$OLD_CFLAGS
24 fi
25
26 dnl check -Wmissing-prototypes
27 OLD_CFLAGS=$CFLAGS
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
35    CFLAGS=$OLD_CFLAGS
36 fi
37
38
39 dnl check -Wmissing-prototypes
40 OLD_CFLAGS=$CFLAGS
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
48    CFLAGS=$OLD_CFLAGS
49 fi
50
51 dnl Checks for libraries.
52 AC_CHECK_LIB(m,        main)
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)
63
64 dnl Checks for header files.
65 AC_HEADER_STDC
66 AC_HEADER_SYS_WAIT
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)
68
69 dnl Checks for typedefs, structures, and compiler characteristics.
70 AC_C_CONST
71 AC_TYPE_PID_T
72 AC_HEADER_TIME
73
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>
80 #endif
81 ])
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>
90 #endif
91 ])
92
93 AC_CHECK_TYPES([union semun],[],[],[#include <sys/types.h>
94 #include <sys/ipc.h>
95 #include <sys/sem.h>])
96
97 dnl Checks for library functions.
98 AC_TYPE_SIGNAL
99 AC_FUNC_VPRINTF
100 AC_FUNC_WAIT3
101 AC_FUNC_ACCEPT_ARGTYPES
102 AC_CHECK_FUNCS(setsid select socket sigprocmask strdup strerror strftime strtok asprintf gai_strerror hstrerror pstat setproctitle)
103
104 dnl Checks for pg_config command.
105 AC_CHECK_PROGS(PGCONFIG, pg_config)
106
107 if test -z $PGCONFIG
108 then
109   PGSQL_INCLUDE_DIR=/usr/local/pgsql/include
110   PGSQL_LIB_DIR=/usr/local/pgsql/lib
111 else
112   PGSQL_INCLUDE_DIR=`pg_config --includedir`
113   PGSQL_LIB_DIR=`pg_config --libdir`
114 fi
115
116
117 AC_ARG_WITH(pgsql,
118     [  --with-pgsql=DIR     site header files for PostgreSQL in DIR],
119     [
120         case "$withval" in
121         "" | y | ye | yes | n | no)
122             AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql option.])
123           ;;
124         esac
125         PGSQL_INCLUDE_DIR="$withval"/include
126         PGSQL_LIB_DIR="$withval"/lib
127     ])
128
129 AC_ARG_WITH(pgsql-includedir,
130     [  --with-pgsql-includedir=DIR     site header files for PostgreSQL in DIR],
131     [
132         case "$withval" in
133         "" | y | ye | yes | n | no)
134             AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql-includedir option.])
135           ;;
136         esac
137         PGSQL_INCLUDE_DIR="$withval"
138     ])
139
140 AC_ARG_WITH(pgsql-libdir,
141     [  --with-pgsql-libdir=DIR     site library files for PostgreSQL in DIR],
142     [
143         case "$withval" in
144         "" | y | ye | yes | n | no)
145             AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql-libdir option.])
146           ;;
147         esac
148         PGSQL_LIB_DIR="$withval"
149     ])
150
151 AC_ARG_WITH(pam,
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.])])])
159 fi
160
161 OLD_LDFLAGS="$LDFLAGS"
162 LDFLAGS="-L$PGSQL_LIB_DIR"
163 OLD_LIBS="$LIBS"
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"
167 LIBS="$OLD_LIBS"
168
169 AC_SUBST(PGSQL_INCLUDE_DIR)
170 AC_SUBST(PGSQL_LIB_DIR)
171
172 # --enable(disable)-rpath option
173 AC_ARG_ENABLE(rpath,
174     [  --disable-rpath     do not embed shared library search path in executables],
175     [case "${enableval}" in
176       yes) rpath=yes ;;
177       no)  rpath=no ;;
178       esac],
179     [rpath=yes]
180 )
181 AM_CONDITIONAL([enable_rpath], test x$rpath = xyes)
182
183 AM_CONFIG_HEADER(config.h)
184
185 AC_OUTPUT([Makefile parser/Makefile pcp/Makefile])