From ccc43a77fea4ff5e61f3adcdf5fbf19dc5eb1f77 Mon Sep 17 00:00:00 2001 From: Stephane Bortzmeyer Date: Fri, 18 Jun 2004 09:52:01 +0000 Subject: [PATCH] Found the PostgreSQL header in several places --- SRC/plugins/postgresql/config.h.in | 3 + SRC/plugins/postgresql/configure | 361 +++++++++++++++++++++++++--- SRC/plugins/postgresql/configure.ac | 15 ++ SRC/plugins/postgresql/postgresql.c | 8 + 4 files changed, 359 insertions(+), 28 deletions(-) diff --git a/SRC/plugins/postgresql/config.h.in b/SRC/plugins/postgresql/config.h.in index 7d11253..6292d92 100644 --- a/SRC/plugins/postgresql/config.h.in +++ b/SRC/plugins/postgresql/config.h.in @@ -63,6 +63,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define if you need to include postgresql/libpq-fe.h, not just libpq-fe.h */ +#undef POSTGRESQL_PREFIX + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS diff --git a/SRC/plugins/postgresql/configure b/SRC/plugins/postgresql/configure index 3ba3542..03fdd1b 100755 --- a/SRC/plugins/postgresql/configure +++ b/SRC/plugins/postgresql/configure @@ -1044,6 +1044,7 @@ Optional Packages: include additional configurations [automatic] --with-libidn=DIR Internationalized Domain Names support (needs GNU libidn) --with-popt=DIR popt command-line parsing library + --with-pgsql=DIR PostgreSQL development library Some influential environment variables: CC C compiler command @@ -2840,7 +2841,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 2843 "configure"' > conftest.$ac_ext + echo '#line 2844 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -4295,7 +4296,7 @@ fi # Provide some information about the compiler. -echo "$as_me:4298:" \ +echo "$as_me:4299:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5327,11 +5328,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:5330: $lt_compile\"" >&5) + (eval echo "\"\$as_me:5331: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:5334: \$? = $ac_status" >&5 + echo "$as_me:5335: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -5560,11 +5561,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:5563: $lt_compile\"" >&5) + (eval echo "\"\$as_me:5564: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:5567: \$? = $ac_status" >&5 + echo "$as_me:5568: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -5620,11 +5621,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:5623: $lt_compile\"" >&5) + (eval echo "\"\$as_me:5624: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:5627: \$? = $ac_status" >&5 + echo "$as_me:5628: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7796,7 +7797,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10075: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10078: \$? = $ac_status" >&5 + echo "$as_me:10079: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10131,11 +10132,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10134: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10135: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10138: \$? = $ac_status" >&5 + echo "$as_me:10139: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11488,7 +11489,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12417: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12420: \$? = $ac_status" >&5 + echo "$as_me:12421: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12473,11 +12474,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12476: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12477: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12480: \$? = $ac_status" >&5 + echo "$as_me:12481: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14506,11 +14507,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14509: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14510: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14513: \$? = $ac_status" >&5 + echo "$as_me:14514: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -14739,11 +14740,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14742: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14743: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14746: \$? = $ac_status" >&5 + echo "$as_me:14747: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -14799,11 +14800,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14802: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14803: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14806: \$? = $ac_status" >&5 + echo "$as_me:14807: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16975,7 +16976,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 +echo $ECHO_N "checking for libpq-fe.h... $ECHO_C" >&6 +if test "${ac_cv_header_libpq_fe_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_libpq_fe_h" >&5 +echo "${ECHO_T}$ac_cv_header_libpq_fe_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking libpq-fe.h usability" >&5 +echo $ECHO_N "checking libpq-fe.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking libpq-fe.h presence" >&5 +echo $ECHO_N "checking libpq-fe.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: libpq-fe.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: libpq-fe.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: libpq-fe.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: libpq-fe.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: libpq-fe.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: libpq-fe.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: libpq-fe.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: libpq-fe.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: libpq-fe.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: libpq-fe.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: libpq-fe.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: libpq-fe.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: libpq-fe.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: libpq-fe.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: libpq-fe.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: libpq-fe.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to the echoping lists. ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for libpq-fe.h" >&5 +echo $ECHO_N "checking for libpq-fe.h... $ECHO_C" >&6 +if test "${ac_cv_header_libpq_fe_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_libpq_fe_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_libpq_fe_h" >&5 +echo "${ECHO_T}$ac_cv_header_libpq_fe_h" >&6 + +fi +if test $ac_cv_header_libpq_fe_h = yes; then + : +else + if test "${ac_cv_header_postgresql_libpq_fe_h+set}" = set; then + echo "$as_me:$LINENO: checking for postgresql/libpq-fe.h" >&5 +echo $ECHO_N "checking for postgresql/libpq-fe.h... $ECHO_C" >&6 +if test "${ac_cv_header_postgresql_libpq_fe_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_postgresql_libpq_fe_h" >&5 +echo "${ECHO_T}$ac_cv_header_postgresql_libpq_fe_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking postgresql/libpq-fe.h usability" >&5 +echo $ECHO_N "checking postgresql/libpq-fe.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking postgresql/libpq-fe.h presence" >&5 +echo $ECHO_N "checking postgresql/libpq-fe.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: postgresql/libpq-fe.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: postgresql/libpq-fe.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: postgresql/libpq-fe.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: postgresql/libpq-fe.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: postgresql/libpq-fe.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: postgresql/libpq-fe.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: postgresql/libpq-fe.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: postgresql/libpq-fe.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: postgresql/libpq-fe.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: postgresql/libpq-fe.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: postgresql/libpq-fe.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: postgresql/libpq-fe.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: postgresql/libpq-fe.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: postgresql/libpq-fe.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: postgresql/libpq-fe.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: postgresql/libpq-fe.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to the echoping lists. ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for postgresql/libpq-fe.h" >&5 +echo $ECHO_N "checking for postgresql/libpq-fe.h... $ECHO_C" >&6 +if test "${ac_cv_header_postgresql_libpq_fe_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_postgresql_libpq_fe_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_postgresql_libpq_fe_h" >&5 +echo "${ECHO_T}$ac_cv_header_postgresql_libpq_fe_h" >&6 + +fi +if test $ac_cv_header_postgresql_libpq_fe_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define POSTGRESQL_PREFIX 1 +_ACEOF + +else + { echo "$as_me:$LINENO: WARNING: No PostgreSQL header found, not building this plugin" >&5 +echo "$as_me: WARNING: No PostgreSQL header found, not building this plugin" >&2;} && PGSQL_BUILD=0 +fi + + +fi + + if test "$PGSQL_BUILD" = 1; then diff --git a/SRC/plugins/postgresql/configure.ac b/SRC/plugins/postgresql/configure.ac index a07a07a..a108d47 100644 --- a/SRC/plugins/postgresql/configure.ac +++ b/SRC/plugins/postgresql/configure.ac @@ -7,6 +7,18 @@ AC_CONFIG_HEADERS(config.h) m4_include([../configure-plugins.ac]) PGSQL_BUILD=1 +AC_ARG_WITH(pgsql, + [ --with-pgsql[=DIR] PostgreSQL development library],dnl + [if test "$withval" != "no"; then + if test "$withval" != "yes"; then + PGSQLROOT=$withval + LDFLAGS="${LDFLAGS} -L$PGSQLROOT/lib" + CPPFLAGS="${CPPFLAGS} -I$PGSQLROOT/include" + fi + else + PGSQL_BUILD=0 + fi], +) AC_CHECK_FUNCS(poptGetContext,, [AC_CHECK_LIB(popt,poptGetContext,,[AC_MSG_WARN([No popt development environment found, not building this plugin]) && PGSQL_BUILD=0])]) if test "$PGSQL_BUILD" != "0"; then @@ -14,6 +26,9 @@ AC_CHECK_FUNCS(PQconnectdb, , [AC_CHECK_LIB(pq,PQconnectdb,, [AC_MSG_WARN([No PostgreSQL development environment found, not building this plugin]) && PGSQL_BUILD=0])]) fi +AC_CHECK_HEADER([libpq-fe.h],, + [AC_CHECK_HEADER([postgresql/libpq-fe.h],AC_DEFINE(POSTGRESQL_PREFIX,1,[Define if you need to include postgresql/libpq-fe.h, not just libpq-fe.h]), + [AC_MSG_WARN([No PostgreSQL header found, not building this plugin]) && PGSQL_BUILD=0])]) AM_CONDITIONAL(PGSQLBUILD, test "$PGSQL_BUILD" = 1) AC_OUTPUT(Makefile) diff --git a/SRC/plugins/postgresql/postgresql.c b/SRC/plugins/postgresql/postgresql.c index f2b520b..dbb4148 100644 --- a/SRC/plugins/postgresql/postgresql.c +++ b/SRC/plugins/postgresql/postgresql.c @@ -7,7 +7,15 @@ #define IN_PLUGIN #include "../../echoping.h" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef POSTGRESQL_PREFIX #include +#else +#include +#endif const char *request = NULL; int readall = FALSE;