summaryrefslogtreecommitdiff
blob: e5e713db212807043954487faa4a35c625ee7d48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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)])