SHA256
1
0
forked from pool/collectd
collectd/avoid-pg-config.patch

112 lines
3.2 KiB
Diff
Raw Normal View History

diff --git a/configure.ac b/configure.ac
index 4032d84..284192d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4272,18 +4272,10 @@ AC_SUBST([PERL_LIBS])
# }}}
# --with-libpq {{{
-with_pg_config="pg_config"
AC_ARG_WITH([libpq],
- [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@], [Path to libpq.])],
+ [AS_HELP_STRING([--with-libpq], [Build using pgsql])],
[
- if test "x$withval" = "xno" || test "x$withval" = "xyes"; then
- with_libpq="$withval"
- else
- if test -f "$withval" && test -x "$withval"; then
- with_pg_config="$withval"
- else if test -x "$withval/bin/pg_config"; then
- with_pg_config="$withval/bin/pg_config"
- fi; fi
+ if test "x$withval" != "xno" || test "x$withval" != "xyes"; then
with_libpq="yes"
fi
],
@@ -4291,66 +4283,42 @@ AC_ARG_WITH([libpq],
)
if test "x$with_libpq" = "xyes"; then
- with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
- pg_config_status=$?
-
- if test $pg_config_status -eq 0; then
- if test -n "$with_libpq_includedir"; then
- for dir in $with_libpq_includedir; do
- with_libpq_cppflags="$with_libpq_cppflags -I$dir"
- done
- fi
- else
- AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
+ $PKG_CONFIG --exists 'libpq' 2>/dev/null
+ if test $? -ne 0; then
+ with_libpq="no (pkg-config doesn't know libpq)"
fi
-
- SAVE_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
-
- AC_CHECK_HEADERS([libpq-fe.h],
- [with_libpq="yes"],
- [with_libpq="no (libpq-fe.h not found)"]
- )
-
- CPPFLAGS="$SAVE_CPPFLAGS"
fi
if test "x$with_libpq" = "xyes"; then
- with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
- pg_config_status=$?
-
- if test $pg_config_status -eq 0
- then
- if test -n "$with_libpq_libdir"; then
- for dir in $with_libpq_libdir; do
- with_libpq_ldflags="$with_libpq_ldflags -L$dir"
- done
- fi
- else
- AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
- fi
+ with_libpq_cflags="`$PKG_CONFIG --cflags libpq`"
+ with_libpq_ldflags="`$PKG_CONFIG --libs-only-L libpq`"
+ with_libpq_libs="`$PKG_CONFIG --libs libpq`"
+fi
- SAVE_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $with_libpq_ldflags"
+if test "x$with_libpq" = "xyes"; then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_libpq_cflags"
- AC_CHECK_LIB([pq], [PQserverVersion],
- [with_libpq="yes"],
- [with_libpq="no (symbol 'PQserverVersion' not found)"])
+ # Look for libpq-fe.h
+ AC_CHECK_HEADERS([libpq-fe.h pgsql/libpq-fe.h],
+ [with_libpq="yes"],
+ [with_libpq="no (libpq-fe.h not found)"]
+ )
- LDFLAGS="$SAVE_LDFLAGS"
+ CPPFLAGS="$SAVE_CPPFLAGS"
fi
if test "x$with_libpq" = "xyes"; then
- BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
+ BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cflags"
BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
- BUILD_WITH_LIBPQ_LIBS="-lpq"
+ BUILD_WITH_LIBPQ_LIBS="$with_libpq_libs"
fi
AC_SUBST([BUILD_WITH_LIBPQ_CPPFLAGS])
-AC_SUBST([BUILD_WITH_LIBPQ_LDFLAGS])
AC_SUBST([BUILD_WITH_LIBPQ_LIBS])
# }}}
+
# --with-libpqos {{{
AC_ARG_WITH([libpqos],
[AS_HELP_STRING([--with-libpqos@<:@=PREFIX@:>@], [Path to libpqos.])],