[asterisk-commits] branch group/autoconf_and_menuselect r19935 - /team/group/autoconf_and_menuse...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Apr 13 15:59:41 MST 2006


Author: kpfleming
Date: Thu Apr 13 17:59:41 2006
New Revision: 19935

URL: http://svn.digium.com/view/asterisk?rev=19935&view=rev
Log:
find PostgreSQL stuff the _right_ way

Modified:
    team/group/autoconf_and_menuselect/acinclude.m4
    team/group/autoconf_and_menuselect/configure.ac

Modified: team/group/autoconf_and_menuselect/acinclude.m4
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/acinclude.m4?rev=19935&r1=19934&r2=19935&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/acinclude.m4 (original)
+++ team/group/autoconf_and_menuselect/acinclude.m4 Thu Apr 13 17:59:41 2006
@@ -28,9 +28,7 @@
       if test "x${$1_DIR}" != "x"; then
          $1_LIB="-L${$1_DIR}/lib ${$1_LIB}"
 	 $1_INCLUDE="-I${$1_DIR}/include"
-	 AC_SUBST([$1_INCLUDE])
       fi
-      AC_SUBST([$1_LIB])
       PBX_LIB$1=1
    elif test ! -z "${$1_MANDATORY}";
    then
@@ -41,6 +39,8 @@
       exit 1
    fi
 fi
+AC_SUBST([$1_LIB])
+AC_SUBST([$1_INCLUDE])
 AC_SUBST([PBX_LIB$1])
 ])
 
@@ -86,9 +86,7 @@
       if test "x${$1_DIR}" != "x"; then
          $1_LIB="-L${$1_DIR}/lib${$1_SUFFIX} ${$1_LIB}"
 	 $1_INCLUDE="-I${$1_DIR}/include${$1_SUFFIX}"
-	 AC_SUBST([$1_INCLUDE])
       fi
-      AC_SUBST([$1_LIB])
       PBX_LIB$1=1
    elif test ! -z "${$1_MANDATORY}";
    then
@@ -99,5 +97,7 @@
       exit 1
    fi
 fi
+AC_SUBST([$1_LIB])
+AC_SUBST([$1_INCLUDE])
 AC_SUBST([PBX_LIB$1])
 ])

Modified: team/group/autoconf_and_menuselect/configure.ac
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/configure.ac?rev=19935&r1=19934&r2=19935&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/configure.ac (original)
+++ team/group/autoconf_and_menuselect/configure.ac Thu Apr 13 17:59:41 2006
@@ -155,13 +155,74 @@
 AST_EXT_LIB([mfcr2], [mfcr2_MakeCall], [MFCR2], [MFCR2])
 AST_EXT_LIB([osptk], [OSPPCryptoDecrypt], [OSPTK], [OSP Toolkit])
 AST_EXT_LIB([odbc], [SQLConnect], [UNIXODBC], [unixODBC])
-AST_EXT_LIB_SUFFIX([pq], [PQexec], [PQ], [PostgreSQL])
 AST_EXT_LIB([sqlite], [sqlite_exec], [SQLITE], [SQLite])
 AST_EXT_LIB([tds], [tds_version], [FREETDS], [FreeTDS])
 AST_EXT_LIB([popt], [poptStrerror], [POPT], [popt])
 AST_EXT_LIB([newt], [newtBell], [NEWT], [newt])
 AST_EXT_LIB([ssl], [ssl2_connect], [OPENSSL], [OpenSSL], [-lcrypto])
 AST_EXT_LIB([z], [compress], [ZLIB], [zlib])
+
+AC_ARG_WITH([pq], AC_HELP_STRING([--with-pq=PATH],[use PostgreSQL files in PATH]),[
+case ${withval} in
+     n|no)
+     USE_PQ=no
+     ;;
+     y|ye|yes)
+     PQ_MANDATORY="yes"
+     ;;
+     *)
+     PQ_DIR="${withval}"
+     PQ_MANDATORY="yes"
+     ;;
+esac
+])
+
+PBX_LIBpq=0
+
+if test "${USE_PQ}" != "no"; then	
+   if test "x${PQ_DIR}" != "x"; then
+      AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PQ_DIR}/bin])
+      if test x"${PG_CONFIG}" = xNo; then
+         echo "***"
+         echo "*** pg_config was not found in the path you specified:"
+         echo "*** ${PQ_DIR}/bin"
+         echo "*** Either correct the installation, or run configure"
+         echo "*** including --without-pq"
+         exit 1
+      fi
+   else
+      AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
+      if test x"${PG_CONFIG}" = xNo; then
+         echo "***"
+         echo "*** pg_config was not found in the PATH"
+         echo "*** Either correct the installation, or run configure"
+         echo "*** including --without-pq"
+         exit 1
+      fi
+   fi
+
+   PQ_libdir=`pg_config --libdir`
+   PQ_includedir=`pg_config --includedir`
+   
+   AC_CHECK_LIB([pq], [PQexec], AC_DEFINE_UNQUOTED([HAVE_PQ], 1,
+   [Define to indicate the PostgreSQL library]), [], -L${PQ_libdir} -lz)
+
+   if test "${ac_cv_lib_pq_PQexec}" = "yes"; then
+      pq_LIB="-L${PQ_libdir} -lpq -lz"
+      pq_INCLUDE="-I${PQ_includedir}"
+      PBX_LIBpq=1
+   elif test ! -z "${PQ_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The PostgreSQL installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** including --without-pq"
+      exit 1
+   fi
+fi
+AC_SUBST([pq_INCLUDE])
+AC_SUBST([pq_LIB])
+AC_SUBST([PBX_LIBpq])
 
 PBX_H323=0
 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [])



More information about the asterisk-commits mailing list