[libgda] Moved Oracle detection in its own M4 file
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Moved Oracle detection in its own M4 file
- Date: Mon, 4 Oct 2010 18:49:14 +0000 (UTC)
commit 51b182fdb038fe8cdd4c5f290f78ea3c981d6e10
Author: Vivien Malerba <malerba gnome-db org>
Date: Mon Oct 4 20:48:47 2010 +0200
Moved Oracle detection in its own M4 file
configure.ac | 51 +------------------
m4/oracle.m4 | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 161 insertions(+), 48 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index af69af2..1aa154c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,6 +9,7 @@ m4_include(m4/mdbtools.m4)
m4_include(m4/bdb.m4)
m4_include(m4/mysql.m4)
m4_include(m4/postgresql.m4)
+m4_include(m4/oracle.m4)
AC_INIT(GNU Data Access, major.minor.micro, gnome-db-list gnome org, libgda)
AC_PREREQ(2.59)
@@ -503,51 +504,7 @@ dnl Test for PostgreSQL
POSTGRES_CHECK($lib)
dnl test for ORACLE
-try_oracle=true
-AC_ARG_WITH(oracle,
-[ --with-oracle=<directory> use ORACLE backend in <directory>],[
-if test $withval = no
-then
- try_oracle=false
-elif test $withval = yes
-then
- dir="/usr/local"
-else
- dir=$withval
-fi
-])
-if test $try_oracle = true
-then
- AC_MSG_CHECKING(for ORACLE installation)
- for d in $dir $ORACLE_HOME /opt/oracle /usr
- do
- if test -f $d/$lib/libclntsh.so
- then
- AC_MSG_RESULT(found ORACLE in $d)
- oracledir=$d
- oraclelibdir=$lib
- break
- else
- if test -f $d/lib/libclntsh.so
- then
- AC_MSG_RESULT(found ORACLE in $d)
- oracledir=$d
- oraclelibdir="lib"
- break
- fi
- fi
- done
- if test x$oracledir = x
- then
- AC_MSG_WARN(ORACLE backend not used)
- else
- AC_DEFINE(HAVE_ORACLE, 1, [Have ORACLE])
- ORACLE_CFLAGS=" -I$oracledir/include -I$oracledir/include/oracle/client -I$oracledir/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/plsql/public -I$oracledir/network/public"
- ORACLE_LIBS="-L$oracledir/$oraclelibdir -lm -ldl -lclntsh"
- fi
-fi
-
-AM_CONDITIONAL(ORACLE, test x$oracledir != x)
+ORACLE_CHECK($lib)
dnl test for FireBird
try_firebird=true
@@ -987,8 +944,6 @@ AC_SUBST(LIBGDA_DTDDIR)
dnl ******************************
dnl Variables
dnl ******************************
-AC_SUBST(ORACLE_LIBS)
-AC_SUBST(ORACLE_CFLAGS)
AC_SUBST(FIREBIRD_LIBS)
AC_SUBST(FIREBIRD_CFLAGS)
AC_SUBST(JAVA_LIBS)
@@ -1156,7 +1111,7 @@ echo " Berkeley DB SQL = $bdbsql_found"
dnl echo " FireBird = `if test x$firebirddir != x; then echo yes; else echo no; fi`"
echo " MDB (MS Access) = $mdbtools_found"
echo " MySQL = $mysql_found"
-echo " Oracle = `if test x$oracledir != x; then echo yes; else echo no; fi`"
+echo " Oracle = $oracle_found"
echo " PostgreSQL = $postgres_found"
echo " SQLite = yes `if test x$have_sqlite = xyes; then echo '(from system installation)'; else echo '(embedded)'; fi`"
echo " SQLCipher = `if test x$have_crypto != xyes; then echo no; else echo yes; fi`"
diff --git a/m4/oracle.m4 b/m4/oracle.m4
new file mode 100644
index 0000000..fd0d99a
--- /dev/null
+++ b/m4/oracle.m4
@@ -0,0 +1,158 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2010 Vivien Malerba
+dnl
+dnl SYNOPSIS
+dnl
+dnl ORACLE_CHECK([libdirname])
+dnl
+dnl [libdirname]: defaults to "lib". Can be overridden by the --with-oracle-libdir-name option
+dnl
+dnl DESCRIPTION
+dnl
+dnl This macro tries to find the Oracle libraries and header files. If the ORACLE setup is found
+dnl then it also tries to find the SQL extension to ORACLE (starting from version 5.0)
+dnl
+dnl It defined two options:
+dnl --with-oracle=yes/no/<directory>
+dnl --with-oracle-libdir-name=<dir. name>
+dnl
+dnl If the 1st option is "yes" then the macro in several well known directories
+dnl
+dnl If the 1st option is "no" then the macro does not attempt at locating the
+dnl oracle package
+dnl
+dnl If the 1st option is a drectory name, then the macro tries to locate the oracle package
+dnl in the specified directory.
+dnl
+dnl If the macro has to try to locate the oracle package in one or more directories, it will
+dnl try to locate the header files in $dir/include and the library files in $dir/lib, unless
+dnl the second option is used to specify a directory name to be used instead of "lib" (for
+dnl example lib64).
+dnl
+dnl USED VARIABLES
+dnl
+dnl $linklibext: contains the library suffix (like ".so"). If not specified ".so" is used.
+dnl $platform_win32: contains "yes" on Windows platforms. If not specified, assumes "no"
+dnl
+dnl
+dnl DEFINED VARIABLES
+dnl
+dnl This macro always calls:
+dnl
+dnl AC_SUBST(ORACLE_LIBS)
+dnl AC_SUBST(ORACLE_CFLAGS)
+dnl oracle_found=yes/no
+dnl
+dnl and if the oracle package is found:
+dnl
+dnl AM_CONDITIONAL(ORACLE, true)
+dnl
+dnl
+dnl LICENSE
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+m4_define([_ORACLE_CHECK_INTERNAL],
+[
+ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+ oracle_loclibdir=$1
+ if test "x$oracle_loclibdir" = x
+ then
+ if test "x$platform_win32" = xyes
+ then
+ oracle_loclibdir=bin
+ else
+ oracle_loclibdir=lib
+ fi
+ fi
+
+ # determine if Oracle should be searched for
+ # and use pkg-config if the "yes" option is used
+ oracle_found=no
+ try_oracle=true
+ ORACLE_LIBS=""
+ oracle_test_dir="$ORACLE_HOME /usr /opt/oracle /local"
+ AC_ARG_WITH(oracle,
+ AS_HELP_STRING([--with-oracle[=@<:@yes/no/<directory>@:>@]],
+ [Locate Oracle's client libraries]),[
+ if test $withval = no
+ then
+ try_oracle=false
+ elif test $withval != yes
+ then
+ oracle_test_dir=$withval
+ fi])
+ AC_ARG_WITH(oracle-libdir-name,
+ AS_HELP_STRING([--with-oracle-libdir-name[=@<:@<dir. name>@:>@]],
+ [Locate ORACLE library file, related to the prefix specified from --with-oracle]),
+ [oracle_loclibdir=$withval])
+
+ # try to locate files
+ if test $try_oracle = true
+ then
+ if test "x$linklibext" = x
+ then
+ oracle_libext=".so"
+ else
+ oracle_libext="$linklibext"
+ fi
+ oracledir=""
+ for d in $oracle_test_dir
+ do
+ oracledir=""
+ AC_MSG_CHECKING([for Oracle files in $d])
+ if test -f $d/$oracle_loclibdir/libclntsh$oracle_libext
+ then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -I$d/include -I$d/include/oracle/client -I$d/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/plsql/public -I$d/network/public"
+ save_LIBS="$LIBS"
+ LIBS="$LIBS -L$d/$oracle_loclibdir -lm -ldl -lclntsh"
+ AC_LINK_IFELSE([[
+#include <oci.h>
+int main() {
+ printf("%p", OCIInitialize);
+ return 0;
+}
+]],
+ oracledir=$d)
+ CFLAGS="$save_CFLAGS"
+ LIBS="$save_LIBS"
+ fi
+
+ if test x$oracledir != x
+ then
+ AC_MSG_RESULT([found])
+ ORACLE_CFLAGS="-I${oracledir}/include -I${oracledir}/include/oracle/client -I${oracledir}/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/plsql/public -I${oracledir}/network/public"
+ ORACLE_LIBS="-L${oracledir}/$oracle_loclibdir -lm -ldl -lclntsh"
+ break
+ else
+ AC_MSG_RESULT([not found])
+ fi
+ done
+
+ if test "x$ORACLE_LIBS" = x
+ then
+ AC_MSG_NOTICE([ORACLE backend not used])
+ else
+ oracle_found=yes
+ fi
+ fi
+
+ AM_CONDITIONAL(ORACLE,[test "$oracle_found" = "yes"])
+ AC_SUBST(ORACLE_LIBS)
+ AC_SUBST(ORACLE_CFLAGS)
+])
+
+dnl Usage:
+dnl ORACLE_CHECK([libdirname])
+
+AC_DEFUN([ORACLE_CHECK],
+[
+ _ORACLE_CHECK_INTERNAL([$1])
+])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]