File: 31_usepqsql.dpatch

package info (click to toggle)
bandwidthd 2.0.1%2Bcvs20090917-4.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,064 kB
  • ctags: 560
  • sloc: sh: 13,357; ansic: 2,743; php: 1,235; yacc: 216; makefile: 160; lex: 36; sql: 27
file content (60 lines) | stat: -rw-r--r-- 2,555 bytes parent folder | download
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
#! /bin/sh /usr/share/dpatch/dpatch-run
## 31_usepgqsql.dpatch by Andreas Henriksson <andreas@fatal.se>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add configure option --enable-pgsql to manually be able to select 
## DP: instead of automagically choosing at build-time, to be able to build 
## DP: both the static- and postgresql-version of bandwidthd

@DPATCH@
diff -urNad bandwidthd-2.0.1+cvs20071208~/configure.in bandwidthd-2.0.1+cvs20071208/configure.in
--- bandwidthd-2.0.1+cvs20071208~/configure.in	2007-12-11 13:51:23.000000000 +0100
+++ bandwidthd-2.0.1+cvs20071208/configure.in	2007-12-11 13:51:50.000000000 +0100
@@ -55,10 +55,35 @@
 	[AC_CHECK_LIB(wpcap, pcap_open_live, ,[AC_MSG_ERROR([Bandwidthd requires but cannot find libpcap])])])
 
 # Optional Library
-AC_CHECK_FILE(/usr/local/pgsql/lib, LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib")
-AC_CHECK_FILE(/usr/local/pgsql/include, CPPFLAGS="$CPPFLAGS -I/usr/local/pgsql/include")
-AC_CHECK_LIB(pq, PQconnectdb,
-	[AC_CHECK_LIB(pq,PQexecParams, ,AC_MSG_WARN([libpq exists but is too old... bandwidthd requires support for PQexecParams]))])
+AC_PATH_PROG(PG_CONFIG, pg_config)
+
+use_pgsql=no
+
+if test x$enable_pgsql = xyes ; then
+  if test "x$PG_CONFIG" = "x" ; then
+    echo "*** Couldn't find pg_config. Disabling PostgreSQL support."
+  else
+    LDFLAGS="$LDFLAGS -L`$PG_CONFIG --libdir` -lpq"
+
+    pgsql_cflags=`$PG_CONFIG --includedir`
+    if test "x$pgsql_cflags" != "x/usr/include" ; then
+      CPPFLAGS="$CPPFLAGS -I$pgsql_cflags"
+    fi
+     
+    use_pgsql=yes
+    AC_DEFINE(HAVE_LIBPQ, 1, "Enable PostgreSQL compiletime option")
+  fi
+fi
+
+#AM_CONDITIONAL(HAVE_PGSQL, test x$use_pgsql != xno)
+
+#AC_SUBST(PG_LIBS)
+#AC_SUBST(PG_CFLAGS)
+
+#AC_CHECK_FILE(/usr/local/pgsql/lib, LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib")
+#AC_CHECK_FILE(/usr/local/pgsql/include, CPPFLAGS="$CPPFLAGS -I/usr/local/pgsql/include")
+#AC_CHECK_LIB(pq, PQconnectdb,
+#	[AC_CHECK_LIB(pq,PQexecParams, ,AC_MSG_WARN([libpq exists but is too old... bandwidthd requires support for PQexecParams]))])
 
 # Checks for header files.
 AC_HEADER_DIRENT
@@ -133,4 +158,7 @@
 AC_DEFINE_DIR(LOG_DIR, log_dir, [Name of log directory])
 AC_DEFINE_DIR(HTDOCS_DIR, htdocs_dir, [Name of htdocs directory])
 AC_DEFINE_DIR(EXTENSION_DIR, extension_dir, [Name of the extensions directory])
+AC_ARG_ENABLE([pgsql], AC_HELP_STRING([--enable-pgsql],
+	[Enable PostgreSQL support. Default is yes, if available.]),
+	enable_pgsql="$enableval", enable_pgsql=yes)
 AC_OUTPUT(Makefile)