]> granicus.if.org Git - pdns/commitdiff
Move oracle checks to separate macro
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 6 Jan 2014 13:16:17 +0000 (14:16 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 6 Jan 2014 13:27:09 +0000 (14:27 +0100)
Conflicts:
configure.ac

configure.ac
m4/pdns_with_oracle.m4 [new file with mode: 0644]

index e8fadfc4627ce184a04ef55b1ee1df4eb4ef7973..d18294086908d0caa0d920e9d698bb97fbd7930d 100644 (file)
@@ -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=<path>],[instantclient sdk include dir]))
-        AC_ARG_WITH(oracle_libs, AS_HELP_STRING([--with-oracle-libs=<path>],[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 (file)
index 0000000..08d7354
--- /dev/null
@@ -0,0 +1,62 @@
+AC_DEFUN([PDNS_WITH_ORACLE],[
+  AC_ARG_WITH(oracle_includes, AS_HELP_STRING([--with-oracle-includes=<path>],[instantclient sdk include dir]))
+  AC_ARG_WITH(oracle_libs, AS_HELP_STRING([--with-oracle-libs=<path>],[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"
+])