From e7caf92731dd02024e62d694e78cd1b2aeb2f01b Mon Sep 17 00:00:00 2001
From: dbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Tue, 19 Jan 2010 20:38:17 +0000
Subject: [PATCH] Start making autoconf more tolerant of other distributions
 (looking at you, Fedora)

git-svn-id: svn://svn.open-ils.org/ILS/trunk@15342 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 configure.ac | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 547d8add6b..01bcf66aef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -174,6 +174,19 @@ AC_ARG_WITH([apxs],
 [  --with-apxs=path            location of the apxs Apache configuration tool (default is /usr/bin/apxs2)],
 [APXS2=${withval}],
 [APXS2=/usr/bin/apxs2])
+
+# If the passed in value doesn't work, try some reasonable defaults
+# Fedora puts the file in /usr/sbin/apxs, for example
+if ! test -x "$APXS2"; then
+	for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
+		for j in apxs apxs2 ; do
+			if test -x "$i/$j"; then
+				APXS2="$i/$j"
+				break
+			fi
+		done
+	done
+fi
 AC_SUBST([APXS2])
 
 AC_ARG_WITH([apache],
@@ -195,9 +208,20 @@ AC_ARG_WITH([libxml2],
 AC_SUBST([LIBXML2_HEADERS])
 
 AC_ARG_WITH([dbi],
-[  --with-dbi=path             location of the libdbi libraries (default is /usr/local/lib/dbd)],
+[  --with-dbi=path             location of the libdbi driver libraries (default is /usr/local/lib/dbd)],
 [DBI_LIBS=${withval}],
 [DBI_LIBS=/usr/local/lib/dbd/])
+
+# If the passed in value doesn't work, fall back to reasonable defaults
+# Distributions are starting to package a good version of libdbi / libdbd
+if ! test -d "$DBI_LIBS"; then
+	for i in /usr/lib/dbd/ /usr/local/lib/dbd/ ; do
+		if test -d "$i"; then
+			DBI_LIBS="$i"
+			break
+		fi
+	done
+fi
 AC_SUBST([DBI_LIBS])
 
 if test "x$openils_core" = "xtrue"; then
@@ -312,7 +336,7 @@ if test "x$build_apachemods" = "xtrue"; then
 	if test -x "${APXS2}"; then
 	AC_MSG_RESULT([yes])
 	else
-	AC_MSG_ERROR([*** apxs not found, aborting])
+	AC_MSG_ERROR([*** apxs not found in ${APXS2}, aborting])
 	fi  
 
 	AC_CONFIG_FILES([Open-ILS/src/apachemods/Makefile])
-- 
2.11.0