Check for libpq and libpqxx >= 4.0.1
authorArjen Baart <arjen@andromeda.nl>
Sat, 14 Mar 2015 09:39:11 +0000 (10:39 +0100)
committerArjen Baart <arjen@andromeda.nl>
Sat, 14 Mar 2015 09:39:11 +0000 (10:39 +0100)
configure
configure.ac

index 243f11b..529ef9f 100755 (executable)
--- a/configure
+++ b/configure
@@ -4350,6 +4350,51 @@ _ACEOF
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQconnectdb in -lpq" >&5
+$as_echo_n "checking for PQconnectdb in -lpq... " >&6; }
+if ${ac_cv_lib_pq_PQconnectdb+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpq  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char PQconnectdb ();
+int
+main ()
+{
+return PQconnectdb ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_pq_PQconnectdb=yes
+else
+  ac_cv_lib_pq_PQconnectdb=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pq_PQconnectdb" >&5
+$as_echo "$ac_cv_lib_pq_PQconnectdb" >&6; }
+if test "x$ac_cv_lib_pq_PQconnectdb" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPQ 1
+_ACEOF
+
+  LIBS="-lpq $LIBS"
+
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lAXE" >&5
 $as_echo_n "checking for main in -lAXE... " >&6; }
 if ${ac_cv_lib_AXE_main+:} false; then :
@@ -4521,12 +4566,12 @@ if test -n "$LIBPQXX_CFLAGS"; then
     pkg_cv_LIBPQXX_CFLAGS="$LIBPQXX_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpqxx >= 2.5.1\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "libpqxx >= 2.5.1") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpqxx >= 4.0.1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libpqxx >= 4.0.1") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_LIBPQXX_CFLAGS=`$PKG_CONFIG --cflags "libpqxx >= 2.5.1" 2>/dev/null`
+  pkg_cv_LIBPQXX_CFLAGS=`$PKG_CONFIG --cflags "libpqxx >= 4.0.1" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -4538,12 +4583,12 @@ if test -n "$LIBPQXX_LIBS"; then
     pkg_cv_LIBPQXX_LIBS="$LIBPQXX_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpqxx >= 2.5.1\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "libpqxx >= 2.5.1") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpqxx >= 4.0.1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libpqxx >= 4.0.1") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_LIBPQXX_LIBS=`$PKG_CONFIG --libs "libpqxx >= 2.5.1" 2>/dev/null`
+  pkg_cv_LIBPQXX_LIBS=`$PKG_CONFIG --libs "libpqxx >= 4.0.1" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -4564,14 +4609,14 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               LIBPQXX_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpqxx >= 2.5.1" 2>&1`
+               LIBPQXX_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpqxx >= 4.0.1" 2>&1`
         else
-               LIBPQXX_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpqxx >= 2.5.1" 2>&1`
+               LIBPQXX_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpqxx >= 4.0.1" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
        echo "$LIBPQXX_PKG_ERRORS" >&5
 
-       as_fn_error $? "Package requirements (libpqxx >= 2.5.1) were not met:
+       as_fn_error $? "Package requirements (libpqxx >= 4.0.1) were not met:
 
 $LIBPQXX_PKG_ERRORS
 
index 43b4203..6b0fada 100644 (file)
@@ -24,9 +24,10 @@ fi
 # Checks for libraries.
 AC_CHECK_LIB(z, gzread)
 AC_CHECK_LIB(xml2, xmlParseFile)
+AC_CHECK_LIB(pq, PQconnectdb)
 AC_CHECK_LIB(AXE, main, , AC_MSG_ERROR(AXE Library is not installed))
 
-PKG_CHECK_MODULES([LIBPQXX], [libpqxx >= 2.5.1])
+PKG_CHECK_MODULES([LIBPQXX], [libpqxx >= 4.0.1])
 AC_SUBST(LIBPQXX_CFLAGS)
 AC_SUBST(LIBPQXX_LIBS)