$NetBSD: patch-ag,v 1.3 2006/01/31 19:54:43 wiz Exp $ --- configure.orig 2003-05-20 21:15:55.000000000 +0200 +++ configure @@ -3696,66 +3696,75 @@ done -echo "$as_me:$LINENO: checking for netcdf library" >&5 -echo $ECHO_N "checking for netcdf library... $ECHO_C" >&6 - if test -d /opt/netcdf/include ; then - # - # Solaris often has it here - CXXFLAGS="$CXXFLAGS -I/opt/netcdf/include" - LIBS="$LIBS -L/opt/netcdf/lib -lnetcdf" - if test $gri_cv_is_sun = yes ; then - LIBS="$LIBS -lnsl" - fi - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBNETCDF 1 +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 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnetcdf $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - echo "yes (in /opt/netcdf/include/netcdf.h and /opt/netcdf/lib/libnetcdf.a)" - else - if test -f /usr/local/include/netcdf.h ; then - CXXFLAGS="$CPPFLAGS -I/usr/local/include" - LIBS="$LIBS -L/usr/local/lib -lnetcdf" - if test $gri_cv_is_sun = yes ; then - LIBS="$LIBS -lnsl" - fi - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBNETCDF 1 +/* 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 nc_open (); +int +main () +{ +nc_open (); + ; + return 0; +} _ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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_netcdf_nc_open=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_netcdf_nc_open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +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 + HAVE_LIBNETCDF="YES" +else + HAVE_LIBNETCDF="" +fi - echo "yes (in /usr/local/include/netcdf.h and /usr/local/lib/libnetcdf.a)" - else - # - # Linux/debian often has it here. - if test -f /usr/include/netcdf.h ; then - CXXFLAGS="$CPPFLAGS -I/usr/include/netcdf" - LIBS="$LIBS -L/usr/lib/netcdf -lnetcdf" - if test $gri_cv_is_sun = yes ; then - LIBS="$LIBS -lnsl" - fi - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBNETCDF 1 -_ACEOF - echo "yes (in /usr/include/netcdf.h and /usr/lib/libnetcdf.a)" - else - if test -f /boot/home/lib/netcdf ; then - CXXFLAGS="$CPPFLAGS -I/boot/home/include/netcdf" - LIBS="$LIBS -L/boot/home/lib/netcdf -lnetcdf" - if test $gri_cv_is_sun = yes ; then - LIBS="$LIBS -lnsl" - fi - echo "yes (in /boot/home/netcdf)" +if test -n "$HAVE_LIBNETCDF" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_LIBNETCDF 1 _ACEOF - else - echo "no" - fi - fi - fi - fi + LIBS="-lnetcdf $LIBS" +fi