From: Ralf Hartmann Date: Thu, 30 Mar 2006 09:51:51 +0000 (+0000) Subject: Add -lnetcdf to make it link. Introduce new variable NETCDF_HEADER_AND_LIB_FOUND X-Git-Tag: v8.0.0~11952 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a920827e156c9dec8649c806b6e4a52d3f0b6d9;p=dealii.git Add -lnetcdf to make it link. Introduce new variable NETCDF_HEADER_AND_LIB_FOUND git-svn-id: https://svn.dealii.org/trunk@12766 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 1fb802ee03..cb7b48390e 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -4769,19 +4769,23 @@ AC_DEFUN(DEAL_II_CONFIGURE_NETCDF, dnl dnl Check for header, 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)) - + AC_CHECK_HEADER(netcdfcpp.h, AC_CHECK_LIB(netcdf, nc_open, + NETCDF_HEADER_AND_LIB_FOUND=1)) + dnl If the C library was found, but not the C++ library dnl abort configure with an error message - if test "x$DEAL_II_NETCDF_DIR" != "x" ; then - LIBS="-lnetcdf_c++ $LIBS" + if test "x$NETCDF_HEADER_AND_LIB_FOUND" == "x1" ; then + LIBS="-lnetcdf_c++ -lnetcdf $LIBS" 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 ]) diff --git a/deal.II/configure b/deal.II/configure index 8256144f01..5b7ee540b6 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.229 . +# From configure.in Revision: 1.230 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for deal.II 5.3.pre. # @@ -11052,7 +11052,7 @@ fi; 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 @@ -11190,8 +11190,7 @@ echo "${ECHO_T}$ac_cv_header_netcdfcpp_h" >&6 fi if test $ac_cv_header_netcdfcpp_h = yes; then - -echo "$as_me:$LINENO: checking for nc_open in -lnetcdf" >&5 + echo "$as_me:$LINENO: checking for nc_open in -lnetcdf" >&5 echo $ECHO_N "checking for nc_open in -lnetcdf... $ECHO_C" >&6 if test "${ac_cv_lib_netcdf_nc_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -11256,20 +11255,15 @@ 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 - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBNETCDF 1 -_ACEOF - - LIBS="-lnetcdf $LIBS" - + NETCDF_HEADER_AND_LIB_FOUND=1 fi fi - if test "x$DEAL_II_NETCDF_DIR" != "x" ; then - LIBS="-lnetcdf_c++ $LIBS" + if test "x$NETCDF_HEADER_AND_LIB_FOUND" == "x1" ; then + LIBS="-lnetcdf_c++ -lnetcdf $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -11309,7 +11303,10 @@ 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 +#define HAVE_LIBNETCDF 1 +_ACEOF + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5