]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use --with-netcdf to override NETCDF_DIR
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Thu, 22 Sep 2005 13:51:34 +0000 (13:51 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Thu, 22 Sep 2005 13:51:34 +0000 (13:51 +0000)
git-svn-id: https://svn.dealii.org/trunk@11502 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/configure

index 53df04d9156a5363c4c9fc8125078f85ea74f3ff..b00e8c37af4060dfd2653dc1ebe670c7173744b7 100644 (file)
@@ -4485,39 +4485,59 @@ AC_DEFUN(DEAL_II_CONFIGURE_TECPLOT, dnl
 
 
 dnl -------------------------------------------------------------
-dnl Check for the NetCDF API. If it is found we will be able read
+dnl Check whether NetCDF is installed. If so we will be able to read
 dnl from and write to NetCDF binary or ascii files.
 dnl
-dnl We assume that $NETCDF_DIR points to the NetCDF installation
-dnl directory, which includes the lib and include directory. I.e.
-dnl   cd $NETCDF_DIR; ls
-dnl would result in something like
-dnl   bin  include  lib  man  src
-dnl   netcdf-3.6.0-p1>
+dnl The NetCDF installation directory (including the lib and include
+dnl directory) is given to the --with-netcdf configure option or to
+dnl the NETCDF_DIR environment variable
 dnl
 dnl Usage: DEAL_II_CONFIGURE_NETCDF
 dnl
 dnl -------------------------------------------------------------
 AC_DEFUN(DEAL_II_CONFIGURE_NETCDF, dnl
 [
-  AC_CHECK_FILE($NETCDF_DIR/lib/libnetcdf.a,
-               NETCDF_LIB=$NETCDF_DIR/lib/libnetcdf.a)
-  AC_CHECK_FILE($NETCDF_DIR/lib/libnetcdf_c++.a,
-               NETCDF_LIB="$NETCDF_DIR/lib/libnetcdf_c++.a $NETCDF_LIB",
-                NETCDF_LIB="")
-  AC_CHECK_FILE($NETCDF_DIR/include/netcdfcpp.h,
-               NETCDF_INCLUDE_DIR=-I$NETCDF_DIR/include,
-               NETCDF_LIB="")
-
-  if (test "x$NETCDF_LIB" != "x") ; then
-    AC_DEFINE(DEAL_II_HAVE_NETCDF, 1,
-             [Flag indicating whether the library shall be compiled to use the NetCDF interface])
-
-    AC_MSG_CHECKING(for NetCDF version)
-    DEAL_II_NETCDF_VERSION=`cat $NETCDF_DIR/src/VERSION`
-    AC_MSG_RESULT($DEAL_II_NETCDF_VERSION)
-
-    LIBS="$NETCDF_LIB $LIBS"
+  AC_MSG_CHECKING(for NetCDF library directory)
+
+  AC_ARG_WITH(netcdf,
+  [  --with-netcdf=/path/to/netcdf  Specify the path to the NetCDF installation,
+                                    of which the include and library directories
+                                    are subdirs; use this if you want to
+                                    override the NETCDF_DIR environment variable],
+     [
+        DEAL_II_NETCDF_DIR=$withval
+     ],
+     [
+        dnl Take something from the environment variables, if it is there
+        if test "x$NETCDF_DIR" != "x" ; then
+         DEAL_II_NETCDF_DIR="$NETCDF_DIR"
+        else
+         DEAL_II_NETCDF_DIR=""
+          AC_MSG_RESULT(not found)
+        fi
+     ])
+
+  if test "x$DEAL_II_NETCDF_DIR" != "x" ; then
+    AC_MSG_RESULT($DEAL_II_NETCDF_DIR)
+    AC_CHECK_FILE($DEAL_II_NETCDF_DIR/lib/libnetcdf.a,
+                 NETCDF_LIB=$DEAL_II_NETCDF_DIR/lib/libnetcdf.a)
+    AC_CHECK_FILE($DEAL_II_NETCDF_DIR/lib/libnetcdf_c++.a,
+                 NETCDF_LIB="$DEAL_II_NETCDF_DIR/lib/libnetcdf_c++.a $NETCDF_LIB",
+                  NETCDF_LIB="")
+    AC_CHECK_FILE($DEAL_II_NETCDF_DIR/include/netcdfcpp.h,
+                 NETCDF_INCLUDE_DIR=-I$DEAL_II_NETCDF_DIR/include,
+                 NETCDF_LIB="")
+
+    if (test "x$NETCDF_LIB" != "x") ; then
+      AC_DEFINE(DEAL_II_HAVE_NETCDF, 1,
+               [Flag indicating whether the library shall be compiled to use the NetCDF interface])
+
+      AC_MSG_CHECKING(for NetCDF version)
+      DEAL_II_NETCDF_VERSION=`cat $DEAL_II_NETCDF_DIR/src/VERSION`
+      AC_MSG_RESULT($DEAL_II_NETCDF_VERSION)
+
+      LIBS="$NETCDF_LIB $LIBS"
+    fi
   fi
 ])
 
index aba3f493fafc6529a6cb51ddbff0950c098c1f4d..94c17b22ebbcb523e841c09133810241a430b482 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.209 .
+# From configure.in Revision: 1.210 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59 for deal.II 5.3.pre.
 #
@@ -843,6 +843,10 @@ Optional Packages:
    the path to the libary is searched by ld, since it is included
    by the argument -lblaslib. If no argument is given, use -lblas.
    Default is to use -lblas only if required by other libraries.
+  --with-netcdf=/path/to/netcdf  Specify the path to the NetCDF installation,
+                                    of which the include and library directories
+                                    are subdirs; use this if you want to
+                                    override the NETCDF_DIR environment variable
   --with-metis=/path/to/metis   Specify the path to the Metis installation,
                                    of which the include and library directories
                                    are subdirs; use this if you want to
@@ -9676,9 +9680,34 @@ _ACEOF
 
 
 
-  as_ac_File=`echo "ac_cv_file_$NETCDF_DIR/lib/libnetcdf.a" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $NETCDF_DIR/lib/libnetcdf.a" >&5
-echo $ECHO_N "checking for $NETCDF_DIR/lib/libnetcdf.a... $ECHO_C" >&6
+  echo "$as_me:$LINENO: checking for NetCDF library directory" >&5
+echo $ECHO_N "checking for NetCDF library directory... $ECHO_C" >&6
+
+
+# Check whether --with-netcdf or --without-netcdf was given.
+if test "${with_netcdf+set}" = set; then
+  withval="$with_netcdf"
+
+        DEAL_II_NETCDF_DIR=$withval
+
+else
+
+                if test "x$NETCDF_DIR" != "x" ; then
+         DEAL_II_NETCDF_DIR="$NETCDF_DIR"
+        else
+         DEAL_II_NETCDF_DIR=""
+          echo "$as_me:$LINENO: result: not found" >&5
+echo "${ECHO_T}not found" >&6
+        fi
+
+fi;
+
+  if test "x$DEAL_II_NETCDF_DIR" != "x" ; then
+    echo "$as_me:$LINENO: result: $DEAL_II_NETCDF_DIR" >&5
+echo "${ECHO_T}$DEAL_II_NETCDF_DIR" >&6
+    as_ac_File=`echo "ac_cv_file_$DEAL_II_NETCDF_DIR/lib/libnetcdf.a" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $DEAL_II_NETCDF_DIR/lib/libnetcdf.a" >&5
+echo $ECHO_N "checking for $DEAL_II_NETCDF_DIR/lib/libnetcdf.a... $ECHO_C" >&6
 if eval "test \"\${$as_ac_File+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9686,7 +9715,7 @@ else
   { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
    { (exit 1); exit 1; }; }
-if test -r "$NETCDF_DIR/lib/libnetcdf.a"; then
+if test -r "$DEAL_II_NETCDF_DIR/lib/libnetcdf.a"; then
   eval "$as_ac_File=yes"
 else
   eval "$as_ac_File=no"
@@ -9695,12 +9724,12 @@ fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
 if test `eval echo '${'$as_ac_File'}'` = yes; then
-  NETCDF_LIB=$NETCDF_DIR/lib/libnetcdf.a
+  NETCDF_LIB=$DEAL_II_NETCDF_DIR/lib/libnetcdf.a
 fi
 
-  as_ac_File=`echo "ac_cv_file_$NETCDF_DIR/lib/libnetcdf_c++.a" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $NETCDF_DIR/lib/libnetcdf_c++.a" >&5
-echo $ECHO_N "checking for $NETCDF_DIR/lib/libnetcdf_c++.a... $ECHO_C" >&6
+    as_ac_File=`echo "ac_cv_file_$DEAL_II_NETCDF_DIR/lib/libnetcdf_c++.a" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $DEAL_II_NETCDF_DIR/lib/libnetcdf_c++.a" >&5
+echo $ECHO_N "checking for $DEAL_II_NETCDF_DIR/lib/libnetcdf_c++.a... $ECHO_C" >&6
 if eval "test \"\${$as_ac_File+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9708,7 +9737,7 @@ else
   { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
    { (exit 1); exit 1; }; }
-if test -r "$NETCDF_DIR/lib/libnetcdf_c++.a"; then
+if test -r "$DEAL_II_NETCDF_DIR/lib/libnetcdf_c++.a"; then
   eval "$as_ac_File=yes"
 else
   eval "$as_ac_File=no"
@@ -9717,14 +9746,14 @@ fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
 if test `eval echo '${'$as_ac_File'}'` = yes; then
-  NETCDF_LIB="$NETCDF_DIR/lib/libnetcdf_c++.a $NETCDF_LIB"
+  NETCDF_LIB="$DEAL_II_NETCDF_DIR/lib/libnetcdf_c++.a $NETCDF_LIB"
 else
   NETCDF_LIB=""
 fi
 
-  as_ac_File=`echo "ac_cv_file_$NETCDF_DIR/include/netcdfcpp.h" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $NETCDF_DIR/include/netcdfcpp.h" >&5
-echo $ECHO_N "checking for $NETCDF_DIR/include/netcdfcpp.h... $ECHO_C" >&6
+    as_ac_File=`echo "ac_cv_file_$DEAL_II_NETCDF_DIR/include/netcdfcpp.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $DEAL_II_NETCDF_DIR/include/netcdfcpp.h" >&5
+echo $ECHO_N "checking for $DEAL_II_NETCDF_DIR/include/netcdfcpp.h... $ECHO_C" >&6
 if eval "test \"\${$as_ac_File+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9732,7 +9761,7 @@ else
   { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
    { (exit 1); exit 1; }; }
-if test -r "$NETCDF_DIR/include/netcdfcpp.h"; then
+if test -r "$DEAL_II_NETCDF_DIR/include/netcdfcpp.h"; then
   eval "$as_ac_File=yes"
 else
   eval "$as_ac_File=no"
@@ -9741,26 +9770,27 @@ fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
 if test `eval echo '${'$as_ac_File'}'` = yes; then
-  NETCDF_INCLUDE_DIR=-I$NETCDF_DIR/include
+  NETCDF_INCLUDE_DIR=-I$DEAL_II_NETCDF_DIR/include
 else
   NETCDF_LIB=""
 fi
 
 
-  if (test "x$NETCDF_LIB" != "x") ; then
+    if (test "x$NETCDF_LIB" != "x") ; then
 
 cat >>confdefs.h <<\_ACEOF
 #define DEAL_II_HAVE_NETCDF 1
 _ACEOF
 
 
-    echo "$as_me:$LINENO: checking for NetCDF version" >&5
+      echo "$as_me:$LINENO: checking for NetCDF version" >&5
 echo $ECHO_N "checking for NetCDF version... $ECHO_C" >&6
-    DEAL_II_NETCDF_VERSION=`cat $NETCDF_DIR/src/VERSION`
-    echo "$as_me:$LINENO: result: $DEAL_II_NETCDF_VERSION" >&5
+      DEAL_II_NETCDF_VERSION=`cat $DEAL_II_NETCDF_DIR/src/VERSION`
+      echo "$as_me:$LINENO: result: $DEAL_II_NETCDF_VERSION" >&5
 echo "${ECHO_T}$DEAL_II_NETCDF_VERSION" >&6
 
-    LIBS="$NETCDF_LIB $LIBS"
+      LIBS="$NETCDF_LIB $LIBS"
+    fi
   fi
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.