From: Ruben Kerkhof Date: Mon, 6 Jan 2014 13:16:17 +0000 (+0100) Subject: Move oracle checks to separate macro X-Git-Tag: rec-3.6.0-rc1~264^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=391019d9e0bedfe848248522148bc07aaeea1e13;p=pdns Move oracle checks to separate macro Conflicts: configure.ac --- diff --git a/configure.ac b/configure.ac index e8fadfc46..d18294086 100644 --- a/configure.ac +++ b/configure.ac @@ -278,72 +278,8 @@ do done AM_CONDITIONAL(ORACLE,test x"$needoracle" = "xyes") -if test "$needoracle" -then - AC_ARG_WITH(oracle_includes, AS_HELP_STRING([--with-oracle-includes=],[instantclient sdk include dir])) - AC_ARG_WITH(oracle_libs, AS_HELP_STRING([--with-oracle-libs=],[instantclient oracle library dir])) - - if test x"$with_oracle_includes" = "x" - then - # check possible locations - for p1 in /usr/include/oracle /usr/local/include/oracle - do - for p2 in $p1/*/client* - do -if test -d "$p2" -then -with_oracle_includes=$p2 -fi - done - done - fi - - if test x"$with_oracle_includes" = x && test "$ORACLE_HOME/rdbms/public" != "/rdbms/public"; then -if test -d $ORACLE_HOME/rdbms/public; then - with_oracle_includes=$ORACLE_HOME/rdbms/public -fi - fi - - # test header - old_CXXFLAGS="$CXXFLAGS" - old_CFLAGS="$CFLAGS" - CXXFLAGS="$CXXFLAGS -I$with_oracle_includes" - CPPFLAGS="$CPPFLAGS -I$with_oracle_includes" - AC_CHECK_HEADER([oci.h], ORACLE_CFLAGS="-I$with_oracle_includes", AC_MSG_ERROR([Could not find oci.h])) - CXXFLAGS="$old_CXXFLAGS" - CPPFLAGS="$old_CPPFLAGS" - AC_SUBST([ORACLE_CFLAGS]) - AC_SUBST([ORACLE_LIBS]) - - if test x"$with_oracle_libs" = "x" - then - # check possible locationse - for p1 in /usr/lib/oracle /usr/local/lib/oracle - do - for p2 in $p1/*/client*/lib - do -if test -d "$p2" -then -with_oracle_libs=$p2 -fi - done - done - fi - - if test x"$with_oracle_libs" = x && test "$ORACLE_HOME/lib" != "/lib"; then -if test -d $ORACLE_HOME/lib; then - with_oracle_libs=$ORACLE_HOME/lib -fi - fi - - # we have to check for client9 as well... - - # test -lclntsh - old_LDFLAGS="$LDFLAGS" - LDFLAGS="-L$with_oracle_libs -lnnz11 -locci" - AC_CHECK_LIB([clntsh],[OCIEnvInit],ORACLE_LIBS="-L$with_oracle_libs -lnnz11 -lclntsh -locci", - AC_CHECK_LIB([client9], [OCIEnvInit],ORACLE_LIBS="-L$with_oracle_libs -lclient9 -lclntsh9",AC_MSG_ERROR([Could not find client libraries]))) - LDFLAGS="$old_LDFLAGS" +if test "$needoracle"; then + PDNS_WITH_ORACLE fi if test "$needmysql" diff --git a/m4/pdns_with_oracle.m4 b/m4/pdns_with_oracle.m4 new file mode 100644 index 000000000..08d73540d --- /dev/null +++ b/m4/pdns_with_oracle.m4 @@ -0,0 +1,62 @@ +AC_DEFUN([PDNS_WITH_ORACLE],[ + AC_ARG_WITH(oracle_includes, AS_HELP_STRING([--with-oracle-includes=],[instantclient sdk include dir])) + AC_ARG_WITH(oracle_libs, AS_HELP_STRING([--with-oracle-libs=],[instantclient oracle library dir])) + + if test x"$with_oracle_includes" = "x"; then + # check possible locations + for p1 in /usr/include/oracle /usr/local/include/oracle; do + for p2 in $p1/*/client*; do + if test -d "$p2"; then + with_oracle_includes=$p2 + fi + done + done + fi + + if test x"$with_oracle_includes" = x && test "$ORACLE_HOME/rdbms/public" != "/rdbms/public"; then + if test -d $ORACLE_HOME/rdbms/public; then + with_oracle_includes=$ORACLE_HOME/rdbms/public + fi + fi + + # test header + old_CXXFLAGS="$CXXFLAGS" + old_CFLAGS="$CFLAGS" + CXXFLAGS="$CXXFLAGS -I$with_oracle_includes" + CPPFLAGS="$CPPFLAGS -I$with_oracle_includes" + AC_CHECK_HEADER([oci.h], ORACLE_CFLAGS="-I$with_oracle_includes", AC_MSG_ERROR([Could not find oci.h])) + CXXFLAGS="$old_CXXFLAGS" + CPPFLAGS="$old_CPPFLAGS" + AC_SUBST([ORACLE_CFLAGS]) + AC_SUBST([ORACLE_LIBS]) + + if test x"$with_oracle_libs" = "x"; then + # check possible locationse + for p1 in /usr/lib/oracle /usr/local/lib/oracle; do + for p2 in $p1/*/client*/lib; do + if test -d "$p2"; then + with_oracle_libs=$p2 + fi + done + done + fi + + if test x"$with_oracle_libs" = x && test "$ORACLE_HOME/lib" != "/lib"; then + if test -d $ORACLE_HOME/lib; then + with_oracle_libs=$ORACLE_HOME/lib + fi + fi + + # we have to check for client9 as well... + # test -lclntsh + old_LDFLAGS="$LDFLAGS" + LDFLAGS="-L$with_oracle_libs -lnnz11 -locci" + AC_CHECK_LIB([clntsh],[OCIEnvInit], + [ORACLE_LIBS="-L$with_oracle_libs -lnnz11 -lclntsh -locci"], + AC_CHECK_LIB([client9], [OCIEnvInit], + [ORACLE_LIBS="-L$with_oracle_libs -lclient9 -lclntsh9"], + [AC_MSG_ERROR([Could not find client libraries])] + ) + ) + LDFLAGS="$old_LDFLAGS" +])