From: Guido Kanschat Date: Thu, 30 Mar 2006 12:30:18 +0000 (+0000) Subject: allow unlinkable libnetcdf_c++ X-Git-Tag: v8.0.0~11949 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad0017f2c4bd42b1940472106703030982258076;p=dealii.git allow unlinkable libnetcdf_c++ git-svn-id: https://svn.dealii.org/trunk@12769 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 2c7e00ae5e..8fa2ff8eee 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -4768,24 +4768,24 @@ AC_DEFUN(DEAL_II_CONFIGURE_NETCDF, dnl fi dnl Check for header, if found check for C library, + dnl if found check for C++ library, dnl if successful, HAVE_LIBNETCDF will be set - dnl As we cannot ask "x$HAVE_LIBNETCDF"!="x" we must - dnl introduce second variable NETCDF_HEADER_AND_LIB_FOUND - dnl - dnl if the C++ library is missing, the test will fail - AC_CHECK_HEADER(netcdfcpp.h, AC_CHECK_LIB(netcdf, nc_open)) - dnl If the C library was found, but not the C++ library - dnl abort configure with an error message - if perl -e ["exit(1) if (\"$LIBS\" =~ m/netcdf/)"] ; then - LIBS="-lnetcdf_c++ $LIBS" - AC_LINK_IFELSE( - [ AC_LANG_PROGRAM([[#include + AC_CHECK_HEADER(netcdfcpp.h, AC_CHECK_LIB(netcdf, nc_open, + [ OLD_LIBS=$LIBS + LIBS="-lnetcdf_c++ -lnetcdf $LIBS" + AC_MSG_CHECKING([for NcFile::NcFile in -lnetcdf_c++]) + AC_LINK_IFELSE( + [ AC_LANG_PROGRAM([[#include ]], [[NcFile test("test")]]) - ], - AC_DEFINE(HAVE_LIBNETCDF), - AC_MSG_FAILURE([Your NetCDF installation is incomplete: C++ library missing])) - fi + ], + [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_LIBNETCDF,1,[Define to 1 if you have the `NetCDF' library (-lnetcdf).]) + ], + [ AC_MSG_RESULT(no) + LIBS=$OLD_LIBS + ]) + ])) ]) diff --git a/deal.II/base/include/base/config.h.in b/deal.II/base/include/base/config.h.in index 133d5a827d..ff1feb69b5 100644 --- a/deal.II/base/include/base/config.h.in +++ b/deal.II/base/include/base/config.h.in @@ -234,7 +234,7 @@ /* Define to 1 if you have the `lapack' library (-llapack). */ #undef HAVE_LIBLAPACK -/* Define to 1 if you have the `netcdf' library (-lnetcdf). */ +/* Define to 1 if you have the `NetCDF' library (-lnetcdf). */ #undef HAVE_LIBNETCDF /* Define if the std c++ library provides a demangler conforming to the GCC diff --git a/deal.II/configure b/deal.II/configure index 5b7ee540b6..1028b011df 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.230 . +# From configure.in Revision: 1.231 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for deal.II 5.3.pre. # @@ -888,6 +888,9 @@ Optional Packages: 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-zlib=zlib use the compression library zlib for gzipped input and output + and link it with -lzlib (the default is -lz). + Make sure the library is in the search path of ld. --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 @@ -906,9 +909,6 @@ Optional Packages: is included by the argument -llapacklib. If no argument is given, use -llapack. Default is not to use -llapack. - --with-zlib=zlib use the compression library zlib for gzipped input and output - and link it with -lzlib (the default is -lz). - Make sure the library is in the search path of ld. --with-cpu=cpu Optimize specifically for the given CPU type, rather than just generating code for this processor family. @@ -10962,6 +10962,170 @@ echo "${ECHO_T}Adding FORTRAN libraries $F77LIBS" >&6 fi +if test "x$with_zlib" = "x" ; then + with_zlib="yes" +fi + + +# Check whether --with-zlib or --without-zlib was given. +if test "${with_zlib+set}" = set; then + withval="$with_zlib" + + if test "x$withval" != "xyes" ; then + as_ac_Lib=`echo "ac_cv_lib_$withval''_crc32" | $as_tr_sh` +echo "$as_me:$LINENO: checking for crc32 in -l$withval" >&5 +echo $ECHO_N "checking for crc32 in -l$withval... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$withval $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char crc32 (); +int +main () +{ +crc32 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Lib=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + LIBS="-l$withval $LIBS" + cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBZ 1 +_ACEOF + + +fi + + else + +echo "$as_me:$LINENO: checking for crc32 in -lz" >&5 +echo $ECHO_N "checking for crc32 in -lz... $ECHO_C" >&6 +if test "${ac_cv_lib_z_crc32+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char crc32 (); +int +main () +{ +crc32 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_z_crc32=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_z_crc32=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_z_crc32" >&5 +echo "${ECHO_T}$ac_cv_lib_z_crc32" >&6 +if test $ac_cv_lib_z_crc32 = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBZ 1 +_ACEOF + + LIBS="-lz $LIBS" + +fi + + fi + +fi; + + for i in $TECHOME $TEC100HOME $TEC90HOME $TEC80HOME ; do as_ac_File=`echo "ac_cv_file_$i/lib/tecio.a" | $as_tr_sh` @@ -11045,14 +11209,14 @@ else fi; if test "x$DEAL_II_NETCDF_DIR" != "x" ; then - CPPFLAGS="-I$DEAL_II_NETCDF_DIR/include $CPPFLAGS" + CXXFLAGS="-I$DEAL_II_NETCDF_DIR/include $CXXFLAGS" LDFLAGS="-L$DEAL_II_NETCDF_DIR/lib $LDFLAGS" if test "$LD_PATH_OPTION" != "no" ; then LDFLAGS="$LD_PATH_OPTION$DEAL_II_NETCDF_DIR/lib $LDFLAGS" fi fi - if test "${ac_cv_header_netcdfcpp_h+set}" = set; then + if test "${ac_cv_header_netcdfcpp_h+set}" = set; then echo "$as_me:$LINENO: checking for netcdfcpp.h" >&5 echo $ECHO_N "checking for netcdfcpp.h... $ECHO_C" >&6 if test "${ac_cv_header_netcdfcpp_h+set}" = set; then @@ -11255,16 +11419,11 @@ fi echo "$as_me:$LINENO: result: $ac_cv_lib_netcdf_nc_open" >&5 echo "${ECHO_T}$ac_cv_lib_netcdf_nc_open" >&6 if test $ac_cv_lib_netcdf_nc_open = yes; then - NETCDF_HEADER_AND_LIB_FOUND=1 -fi - -fi - - - - if test "x$NETCDF_HEADER_AND_LIB_FOUND" == "x1" ; then - LIBS="-lnetcdf_c++ -lnetcdf $LIBS" - cat >conftest.$ac_ext <<_ACEOF + OLD_LIBS=$LIBS + LIBS="-lnetcdf_c++ -lnetcdf $LIBS" + echo "$as_me:$LINENO: checking for NcFile::NcFile in -lnetcdf_c++" >&5 +echo $ECHO_N "checking for NcFile::NcFile in -lnetcdf_c++... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11303,23 +11462,31 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF #define HAVE_LIBNETCDF 1 _ACEOF + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: Your NetCDF installation is incomplete: C++ library missing -See \`config.log' for more details." >&5 -echo "$as_me: error: Your NetCDF installation is incomplete: C++ library missing -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + LIBS=$OLD_LIBS + fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - fi + +fi + +fi + + @@ -11750,169 +11917,6 @@ fi fi; -if test "x$with_zlib" = "x" ; then - with_zlib="yes" -fi - - -# Check whether --with-zlib or --without-zlib was given. -if test "${with_zlib+set}" = set; then - withval="$with_zlib" - - if test "x$withval" != "xyes" ; then - as_ac_Lib=`echo "ac_cv_lib_$withval''_crc32" | $as_tr_sh` -echo "$as_me:$LINENO: checking for crc32 in -l$withval" >&5 -echo $ECHO_N "checking for crc32 in -l$withval... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Lib+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$withval $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char crc32 (); -int -main () -{ -crc32 (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Lib=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Lib=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -if test `eval echo '${'$as_ac_Lib'}'` = yes; then - LIBS="-l$withval $LIBS" - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBZ 1 -_ACEOF - - -fi - - else - -echo "$as_me:$LINENO: checking for crc32 in -lz" >&5 -echo $ECHO_N "checking for crc32 in -lz... $ECHO_C" >&6 -if test "${ac_cv_lib_z_crc32+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char crc32 (); -int -main () -{ -crc32 (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_z_crc32=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_z_crc32=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_z_crc32" >&5 -echo "${ECHO_T}$ac_cv_lib_z_crc32" >&6 -if test $ac_cv_lib_z_crc32 = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBZ 1 -_ACEOF - - LIBS="-lz $LIBS" - -fi - - fi - -fi; -