diff -Naur nagios-plugins-1.4.12.orig/configure.in nagios-plugins-1.4.12/configure.in --- nagios-plugins-1.4.12.orig/configure.in 2008-05-28 00:01:05.000000000 +0200 +++ nagios-plugins-1.4.12/configure.in 2008-07-20 18:02:42.000000000 +0200 @@ -182,27 +182,34 @@ PGSQL=$withval,) AC_CHECK_LIB(crypt,main) if test "$ac_cv_lib_crypt_main" = "yes" -a "x$PGSQL" != "xno"; then - if test -n "$PGSQL"; then - LDFLAGS="$LDFLAGS -L$PGSQL/lib" - CPPFLAGS="$CPPFLAGS -I$PGSQL/include" + if test -x $with_pgsql/bin/pg_config ; then + np_pg_config="$with_pgsql/bin/pg_config" fi - AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt) - if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then - AC_CHECK_HEADERS(pgsql/libpq-fe.h) - AC_CHECK_HEADERS(postgresql/libpq-fe.h) - AC_CHECK_HEADERS(libpq-fe.h) - if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then - PGLIBS="-L$PGSQL/lib -lpq -lcrypt" - PGINCLUDE="-I$PGSQL/include" - elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then - PGLIBS="-lpq -lcrypt" - PGINCLUDE="-I/usr/include/pgsql" - elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then - PGLIBS="-L$PGSQL/lib -lpq -lcrypt" - PGINCLUDE="-I/usr/include/postgresql" - elif test "$ac_cv_header_libpq_fe_h" = "yes"; then - PGLIBS="-L$PGSQL/lib -lpq -lcrypt" - PGINCLUDE="-I$PGSQL/include" + if test -z "$np_pg_config"; then + with_pgsql="no" + else + if test -n "$PGSQL"; then + LDFLAGS="$LDFLAGS -L`$np_pg_config --libdir`" + CPPFLAGS="$CPPFLAGS -I`$np_pg_config --includedir`" + fi + AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt) + if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then + AC_CHECK_HEADERS(pgsql/libpq-fe.h) + AC_CHECK_HEADERS(postgresql/libpq-fe.h) + AC_CHECK_HEADERS(libpq-fe.h) + if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then + PGLIBS="-L`$np_pg_config --libdir` -lpq -lcrypt" + PGINCLUDE="-I`$np_pg_config --includedir`" + elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then + PGLIBS="-lpq -lcrypt" + PGINCLUDE="-I`$np_pg_config --includedir`" + elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then + PGLIBS="-L`$np_pg_config --libdir` -lpq -lcrypt" + PGINCLUDE="-I`$np_pg_config --includedir`" + elif test "$ac_cv_header_libpq_fe_h" = "yes"; then + PGLIBS="-L`$np_pg_config --libdir` -lpq -lcrypt" + PGINCLUDE="-I`$np_pg_config --includedir`" + fi fi if test -z "$PGINCLUDE"; then AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)]) @@ -212,10 +219,6 @@ AC_SUBST(PGINCLUDE) EXTRAS="$EXTRAS check_pgsql" fi - else - AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)]) - AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"]) - AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).]) fi else AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])