Add m4/ax_find_common_prefixes.m4 to search for common places where libraries and...
authorAri Johnson <ari@theari.com>
Thu, 28 Apr 2011 19:03:31 +0000 (15:03 -0400)
committerAri Johnson <ari@theari.com>
Thu, 28 Apr 2011 19:03:31 +0000 (15:03 -0400)
Makefile.in
acinclude.m4
configure.ac
m4/ax_find_common_prefixes.m4 [new file with mode: 0644]

index 4fcf75d4371c5264db0a482e8b233d677bde3b5d..98318d8d0b9f2562fa9e39cda0183ea3260a979b 100644 (file)
@@ -20,6 +20,7 @@ CC=@CC@
 SQL_CFLAGS=@MYSQL_CFLAGS@ @POSTGRESQL_CFLAGS@ @SQLITE3_CFLAGS@
 SQL_LDFLAGS=@MYSQL_LDFLAGS@ @POSTGRESQL_LDFLAGS@ @SQLITE3_LDFLAGS@
 
+CPPFLAGS=@CPPFLAGS@
 CCFLAGS=@CFLAGS@ -I.. -I../hdrs @OPENSSL_INCLUDES@ @CPPFLAGS@ @PCRE_CFLAGS@ -Werror
 LDFLAGS=@LDFLAGS@  @OPENSSL_INCLUDES@
 CLIBS=@LIBS@ @PCRE_LIBS@ @LIBLTDL@ @LIBLUA@ @OPENSSL_LIBS@
index 9d29bfc8e6e16a2b948750bd4ed948ceb908497a..ebf8b877c69fead88a6f32649fbd4518a45c3e2e 100644 (file)
@@ -1,3 +1,4 @@
+m4_include([m4/ax_find_common_prefixes.m4])
 m4_include([m4/ltdl.m4])
 # SQL Includes
 m4_include(m4/lib_mysql.m4)
index b41cf49049428c5ed375c09891d3cf1a1f01f812..e324915fc72c08ed5eae09d777dd8132ec0c8ead 100644 (file)
@@ -9,6 +9,7 @@
 AC_PREREQ([2.65])
 AC_INIT([CobraMUSH], [0.80], [http://redmine.cobramush.org])
 AC_CONFIG_HEADERS(config.h)
+AX_FIND_COMMON_PREFIXES([lua5.1])
 
 m4_include(m4/confsetup.m4)
 
diff --git a/m4/ax_find_common_prefixes.m4 b/m4/ax_find_common_prefixes.m4
new file mode 100644 (file)
index 0000000..f9fefa3
--- /dev/null
@@ -0,0 +1,42 @@
+dnl AX_FIND_COMMON_PREFIXES([list of include subdirectories])
+AC_DEFUN([AX_FIND_COMMON_PREFIXES], [
+  AC_MSG_NOTICE([Scanning for common include/library prefixes...])
+  if test -n "$1"; then
+    for subdirectory in $1; do
+      AC_MSG_CHECKING([for /usr/include/$subdirectory])
+      if test -d "/usr/include/$subdirectory"; then
+        AC_MSG_RESULT([yes])
+        CPPFLAGS="$CPPFLAGS -I/usr/include/$subdirectory"
+      else
+        AC_MSG_RESULT([no])
+      fi
+    done
+  fi
+  for prefix in /usr/local /opt /opt/local /opt/ports /sw; do
+    AC_MSG_CHECKING([for $prefix/include])
+    if test -d "$prefix/include"; then
+      AC_MSG_RESULT([yes])
+      CPPFLAGS="$CPPFLAGS -I$prefix/include"
+      if test -n "$1"; then
+        for subdirectory in $1; do
+          AC_MSG_CHECKING([for $prefix/include/$subdirectory])
+          if test -d "$prefix/include/$subdirectory"; then
+            AC_MSG_RESULT([yes])
+            CPPFLAGS="$CPPFLAGS -I$prefix/include/$subdirectory"
+          else
+            AC_MSG_RESULT([no])
+          fi
+        done
+      fi
+    else
+      AC_MSG_RESULT([no])
+    fi
+    AC_MSG_CHECKING([for $prefix/lib])
+    if test -d "$prefix/lib"; then
+      AC_MSG_RESULT([yes])
+      LDFLAGS="$LDFLAGS -L$prefix/lib"
+    else
+      AC_MSG_RESULT([no])
+    fi
+  done
+])dnl