summaryrefslogtreecommitdiff
blob: a5ffdcb3d24934d5eacfa9c0475520df61f2fe54 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
diff -Nur atheme-1.2.1.orig/configure.ac atheme-1.2.1/configure.ac
--- atheme-1.2.1.orig/configure.ac	2006-07-10 13:23:14.000000000 +0000
+++ atheme-1.2.1/configure.ac	2006-10-22 11:52:40.281188612 +0000
@@ -196,43 +196,61 @@
 
 POSTGRESQL="yes"
 
-AC_MSG_CHECKING(for PostgreSQL include directory)
-if test -d /usr/include/pgsql ; then
- 	pg_inc_dir="/usr/include/pgsql"
-elif test -f /usr/local/include/libpq-fe.h ; then
-# kludge for freebsd ports, found on liveharmony boxes. --nenolod
-	pg_inc_dir="/usr/local/include"
-	LDFLAGS="-L/usr/local/lib"
-elif test -d /usr/include/postgresql ; then
- 	pg_inc_dir="/usr/include/postgresql"
-elif test -d /usr/local/psql/include ; then
- 	pg_inc_dir="/usr/local/psql/include"
-elif test -d /usr/local/include/postgresql ; then
-	pg_inc_dir="/usr/local/include/postgresql"
-elif test -d /usr/local/pgsql/include ; then
-	pg_inc_dir="/usr/local/pgsql/include"
-elif test -d /usr/local/include/psql ; then
-	pg_inc_dir="/usr/local/include/psql"
-elif test -d /opt/psql/include ; then
- 	pg_inc_dir="/opt/psql/include"
-else
-	pg_inc_dir="no"
- 	PQLIB=""
-	POSTGRESQL="no"
-fi
+AC_ARG_ENABLE(postgresql,
+AC_HELP_STRING([--enable-postgresql], [Enables PostgreSQL backend support.]),
+[
+	case "$enableval" in
+		yes|no)
+			POSTGRESQL="$enableval"
+			;;
+		*)
+			AC_MSG_ERROR([Invalid argument to --enable-postgresql (expecting either 'yes' or 'no')])
+			;;
+	esac
+])
+ 
+AC_MSG_CHECKING([whether to enable PostgreSQL backend support])
+AC_MSG_RESULT($POSTGRESQL)
+ 
+if test "x$POSTGRESQL" = xyes; then
+	AC_MSG_CHECKING(for PostgreSQL include directory)
+	if test -d /usr/include/pgsql ; then
+ 		pg_inc_dir="/usr/include/pgsql"
+	elif test -f /usr/local/include/libpq-fe.h ; then
+	# kludge for freebsd ports, found on liveharmony boxes. --nenolod
+		pg_inc_dir="/usr/local/include"
+		LDFLAGS="-L/usr/local/lib"
+	elif test -d /usr/include/postgresql ; then
+ 		pg_inc_dir="/usr/include/postgresql"
+	elif test -d /usr/local/psql/include ; then
+ 		pg_inc_dir="/usr/local/psql/include"
+	elif test -d /usr/local/include/postgresql ; then
+		pg_inc_dir="/usr/local/include/postgresql"
+	elif test -d /usr/local/pgsql/include ; then
+		pg_inc_dir="/usr/local/pgsql/include"
+	elif test -d /usr/local/include/psql ; then
+		pg_inc_dir="/usr/local/include/psql"
+	elif test -d /opt/psql/include ; then
+ 		pg_inc_dir="/opt/psql/include"
+	else
+		pg_inc_dir="no"
+	 	PQLIB=""
+		POSTGRESQL="no"
+	fi
 
-POSTGRESQL_C=""
+	POSTGRESQL_C=""
 
-AC_MSG_RESULT($pg_inc_dir)
+	AC_MSG_RESULT($pg_inc_dir)
 
-if test "$pg_inc_dir" != "no"; then
-	AC_CHECK_HEADER($pg_inc_dir/libpq-fe.h, [
-		PGINC="-I$pg_inc_dir"
-	AC_CHECK_LIB(pq, PQconnectdb, [PQLIB="-lpq"
-		POSTGRESQL_C="postgresql.c"])
-	])
-else
-	POSTGRESQL="no"
+	if test "$pg_inc_dir" != "no"; then
+		AC_CHECK_HEADER($pg_inc_dir/libpq-fe.h, [
+			PGINC="-I$pg_inc_dir"
+		AC_CHECK_LIB(pq, PQconnectdb, [PQLIB="-lpq"
+			POSTGRESQL_C="postgresql.c"])
+		])
+	else
+		POSTGRESQL="no"
+	fi
 fi
 
 AC_SUBST(POSTGRESQL_C)