[Freeswitch-svn] [commit] r11615 - in freeswitch/trunk: . build/config
FreeSWITCH SVN
mikej at freeswitch.org
Tue Feb 3 12:31:24 PST 2009
Author: mikej
Date: Tue Feb 3 14:31:24 2009
New Revision: 11615
Log:
autoconf detect odbc library FSBUILD-8
Added:
freeswitch/trunk/build/config/odbc.m4
Modified:
freeswitch/trunk/acinclude.m4
freeswitch/trunk/configure.in
Modified: freeswitch/trunk/acinclude.m4
==============================================================================
--- freeswitch/trunk/acinclude.m4 (original)
+++ freeswitch/trunk/acinclude.m4 Tue Feb 3 14:31:24 2009
@@ -6,5 +6,6 @@
m4_include([build/config/ac_gcc_x86_cpuid.m4])
m4_include([build/config/ax_lib_mysql.m4])
m4_include([build/config/ax_check_java.m4])
+m4_include([build/config/odbc.m4])
m4_include([libs/apr/build/apr_common.m4])
m4_include([build/config/libcurl.m4])
Added: freeswitch/trunk/build/config/odbc.m4
==============================================================================
--- (empty file)
+++ freeswitch/trunk/build/config/odbc.m4 Tue Feb 3 14:31:24 2009
@@ -0,0 +1,141 @@
+dnl Derrick Brashear
+dnl from KTH krb and Arla
+
+AC_DEFUN([ODBC_INC_WHERE1], [
+ac_cv_found_odbc_inc=no
+if test -f "$1/sql.h" ; then
+ ac_cv_found_odbc_inc=yes
+fi
+])
+
+AC_DEFUN([ODBC_INC_WHERE], [
+ for i in $1; do
+ AC_MSG_CHECKING(for odbc header in $i)
+ ODBC_INC_WHERE1($i)
+ if test "$ac_cv_found_odbc_inc" = "yes"; then
+ ac_cv_odbc_where_inc=$i
+ AC_MSG_RESULT(found)
+ break
+ else
+ AC_MSG_RESULT(no found)
+ fi
+ done
+])
+
+AC_DEFUN([ODBC_LIB_WHERE1], [
+saved_LIBS=$LIBS
+LIBS="$saved_LIBS -L$1 -lodbc"
+AC_TRY_LINK(,
+[SQLHDBC con;SQLDisconnect(con);],
+[ac_cv_found_odbc_lib=yes],
+ac_cv_found_odbc_lib=no)
+LIBS=$saved_LIBS
+])
+
+AC_DEFUN([TEST_LIBPATH], [
+changequote(<<, >>)
+define(<<AC_CV_FOUND>>, translit(ac_cv_found_$2_lib, <<- *>>, <<__p>>))
+changequote([, ])
+if test "$AC_CV_FOUND" = "yes"; then
+ if test \! -r "$1/lib$2.a" -a \! -r "$1/lib$2.so" -a \! -r "$1/lib$2.sl" -a \! -r "$1/lib$2.dylib"; then
+ AC_CV_FOUND=no
+ fi
+fi
+])
+
+
+AC_DEFUN([ODBC_LIB_WHERE], [
+ for i in $1; do
+ AC_MSG_CHECKING(for odbc library in $i)
+ ODBC_LIB_WHERE1($i)
+ TEST_LIBPATH($i, odbc)
+ if test "$ac_cv_found_odbc_lib" = "yes" ; then
+ ac_cv_odbc_where_lib=$i
+ AC_MSG_RESULT(found)
+ break
+ else
+ AC_MSG_RESULT(no found)
+ fi
+ done
+])
+
+AC_DEFUN([FIND_LIB_SUBDIR],
+[dnl
+AC_ARG_WITH([lib-subdir], AC_HELP_STRING([--with-lib-subdir=DIR],[Find libraries in DIR instead of lib]))
+AC_CHECK_SIZEOF(long)
+AC_CACHE_CHECK([what directory libraries are found in], [ac_cv_cmu_lib_subdir],
+[test "X$with_lib_subdir" = "Xyes" && with_lib_subdir=
+test "X$with_lib_subdir" = "Xno" && with_lib_subdir=
+ if test "X$with_lib_subdir" = "X" ; then
+ ac_cv_cmu_lib_subdir=lib
+ if test $ac_cv_sizeof_long -eq 4 ; then
+ test -d /usr/lib32 && ac_cv_cmu_lib_subdir=lib32
+ fi
+ if test $ac_cv_sizeof_long -eq 8 ; then
+ test -d /usr/lib64 && ac_cv_cmu_lib_subdir=lib64
+ fi
+ else
+ ac_cv_cmu_lib_subdir=$with_lib_subdir
+ fi])
+ AC_SUBST(LIB_SUBDIR, $ac_cv_cmu_lib_subdir)
+ ])
+
+
+AC_DEFUN([AX_LIB_ODBC], [
+AC_REQUIRE([FIND_LIB_SUBDIR])
+AC_ARG_WITH(odbc,
+ [ --with-odbc=PREFIX Compile with ODBC support],
+ [if test "X$with_odbc" = "X"; then
+ with_odbc=yes
+ fi])
+AC_ARG_WITH(odbc-lib,
+ [ --with-odbc-lib=dir use odbc libraries in dir],
+ [if test "$withval" = "yes" -o "$withval" = "no"; then
+ AC_MSG_ERROR([No argument for --with-odbc-lib])
+ fi])
+AC_ARG_WITH(odbc-include,
+ [ --with-odbc-include=dir use odbc headers in dir],
+ [if test "$withval" = "yes" -o "$withval" = "no"; then
+ AC_MSG_ERROR([No argument for --with-odbc-include])
+ fi])
+
+ if test "X$with_odbc" != "X"; then
+ if test "$with_odbc" != "yes"; then
+ ac_cv_odbc_where_lib=$with_odbc
+ ac_cv_odbc_where_inc=$with_odbc/include
+ fi
+ fi
+
+ if test "X$with_odbc_lib" != "X"; then
+ ac_cv_odbc_where_lib=$with_odbc_lib
+ fi
+ if test "X$ac_cv_odbc_where_lib" = "X"; then
+ ODBC_LIB_WHERE(/usr/$LIB_SUBDIR /usr/local/$LIB_SUBDIR)
+ fi
+
+ if test "X$with_odbc_include" != "X"; then
+ ac_cv_odbc_where_inc=$with_odbc_include
+ fi
+ if test "X$ac_cv_odbc_where_inc" = "X"; then
+ ODBC_INC_WHERE(/usr/include /usr/local/include)
+ fi
+
+ AC_MSG_CHECKING(whether to include odbc)
+ if test "X$ac_cv_odbc_where_lib" = "X" -a "X$ac_cv_odbc_where_inc" = "X"; then
+ ac_cv_found_odbc=no
+ AC_MSG_RESULT(no)
+ else
+ ac_cv_found_odbc=yes
+ AC_MSG_RESULT(yes)
+ ODBC_INC_DIR=$ac_cv_pcap_where_inc
+ ODBC_LIB_DIR=$ac_cv_pcap_where_lib
+ ODBC_INC_FLAGS="-I${ODBC_INC_DIR}"
+ ODBC_LIB_FLAGS="-L${ODBC_LIB_DIR} -lodbc"
+ AC_SUBST(ODBC_INC_DIR)
+ AC_SUBST(ODBC_LIB_DIR)
+ AC_SUBST(ODBC_INC_FLAGS)
+ AC_SUBST(ODBC_LIB_FLAGS)
+ AC_DEFINE([HAVE_ODBC],[1],[libodbc])
+ fi
+ ])
+
Modified: freeswitch/trunk/configure.in
==============================================================================
--- freeswitch/trunk/configure.in (original)
+++ freeswitch/trunk/configure.in Tue Feb 3 14:31:24 2009
@@ -505,6 +505,11 @@
AX_CHECK_JAVA
+AX_LIB_ODBC
+if test "$ac_cv_found_odbc" = "yes" ; then
+ enable_core_odbc_support="yes"
+fi
+
AM_CONDITIONAL([ADD_ODBC],[test "x$enable_core_odbc_support" != "xno"])
AM_CONDITIONAL([ADD_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"])
AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"])
More information about the Freeswitch-svn
mailing list