From e67196812c2ab45e15de09922084082d887b8473 Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Thu, 28 Apr 2011 15:03:31 -0400 Subject: [PATCH] Add m4/ax_find_common_prefixes.m4 to search for common places where libraries and headers may be installed --- Makefile.in | 1 + acinclude.m4 | 1 + configure.ac | 1 + m4/ax_find_common_prefixes.m4 | 42 +++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 m4/ax_find_common_prefixes.m4 diff --git a/Makefile.in b/Makefile.in index 4fcf75d..98318d8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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@ diff --git a/acinclude.m4 b/acinclude.m4 index 9d29bfc..ebf8b87 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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) diff --git a/configure.ac b/configure.ac index b41cf49..e324915 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 0000000..f9fefa3 --- /dev/null +++ b/m4/ax_find_common_prefixes.m4 @@ -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 -- 2.30.2