@@ -301,18 +301,37 @@ AC_ARG_WITH([proj-lib-path],
301301 [ PROJ_LIB="-lproj -lpthread"] )
302302
303303# Get optional netCDF library and include locations
304+ # #if test "x$enable_netcdf" = xyes; then
305+ # # AC_ARG_WITH([netcdf-include-path],
306+ # # [AS_HELP_STRING([--with-netcdf-include-path],
307+ # # [location of the netCDF headers])],
308+ # # [NETCDF_INCL="-I$withval"],
309+ # # [NETCDF_INCL=""])
310+ # # AC_ARG_WITH([netcdf-lib-path],
311+ # # [AS_HELP_STRING([--with-netcdf-lib-path], [location of the netCDF libraries])],
312+ # # [NETCDF_LIB="-L$withval -lnetcdf -lhdf5 -lm -lz -ldl -lxml2"],
313+ # # [NETCDF_LIB=" -lnetcdf -lhdf5 -lm -lz -ldl -lxml2"])
314+ # #fi XX
315+ #
304316if test "x$enable_netcdf" = xyes; then
305- AC_ARG_WITH ( [ netcdf-include-path] ,
306- [ AS_HELP_STRING ( [ --with-netcdf-include-path] ,
307- [ location of the netCDF headers] ) ] ,
308- [ NETCDF_INCL="-I$withval"] ,
309- [ NETCDF_INCL=""] )
310- AC_ARG_WITH ( [ netcdf-lib-path] ,
311- [ AS_HELP_STRING ( [ --with-netcdf-lib-path] , [ location of the netCDF libraries] ) ] ,
312- [ NETCDF_LIB="-L$withval -lnetcdf -lm -ldl -lxml2 -lcurl"] ,
313- [ NETCDF_LIB="-lnetcdf -lm -ldl -lxml2 -lcurl"] )
317+ AC_ARG_WITH ( [ netcdf-include-path] ,
318+ [ AS_HELP_STRING ( [ --with-netcdf-include-path] ,[ location of NetCDF headers] ) ] ,
319+ [ NETCDF_INCL="-I$withval"] ,
320+ [ NETCDF_INCL=""] )
321+
322+ AC_ARG_WITH ( [ netcdf-lib-path] ,
323+ [ AS_HELP_STRING ( [ --with-netcdf-lib-path] ,[ location of NetCDF libraries] ) ] ,
324+ [ NETCDF_LIB="-L$withval -lnetcdf"] ,
325+ [ NETCDF_LIB="-lnetcdf"] )
326+
327+ # Optional: HDF5 support if NetCDF-4 is enabled
328+ AC_ARG_WITH ( [ netcdf-extra-libs] ,
329+ [ AS_HELP_STRING ( [ --netcdf-extra-libs] ,[ location of NetCDF extra libraries, ie hdf5] ) ] ,
330+ [ NETCDF_EXTRALIBS="-L$withval -lhdf5 -lhdf5_hl -lz -ldl -lm -lxml2"] ,
331+ [ NETCDF_EXTRALIBS=""] )
314332fi
315333
334+
316335# Get optional HDF5 library and include locations
317336if test "x$enable_hdf5" = xyes; then
318337 AC_ARG_WITH ( [ hdf5-include-path] ,
@@ -961,20 +980,19 @@ AC_CHECK_LIB(proj, proj_create_crs_to_crs, [AC_CHECK_HEADER([proj.h], [], [AC_MS
961980# ], [AC_INCLUDES_DEFAULT])],[AC_MSG_ERROR(["Curl library not found; use --with-curl-lib-path"])], [???? -lssl -lcrypto])
962981
963982
964- # Check optional NetCDF library
983+ # # Check optional NetCDF library
965984if test "x$enable_netcdf" = xyes; then
966985 echo "Checking for NetCDF library"
967986 CFLAGS="$NETCDF_INCL $CHECK_CFLAGS"
968- LDFLAGS="$CHECK_LDFLAGS $NETCDF_LIB"
987+ LDFLAGS="$CHECK_LDFLAGS $NETCDF_LIB $NETCDF_EXTRALIBS "
969988 AC_CHECK_LIB ( netcdf , nc_create ,
970989 [ AM_CONDITIONAL(UCVM_HAVE_NETCDF, true)] ,
971990 [ AC_MSG_ERROR ( [ NetCDF library not found; use --with-netcdf-include-path"] ) ] ,
972- [ -lm -ldl -lxml2 -lcurl ] )
991+ [ ] )
973992 AC_CHECK_HEADER ( netcdf.h ,
974993 [ ] ,
975994 [ AC_MSG_ERROR ( [ NetCDF header not found; use --with-netcdf-lib-path"] ) ] ,
976995 [ AC_INCLUDES_DEFAULT ] )
977-
978996else
979997 AM_CONDITIONAL(UCVM_HAVE_NETCDF, false)
980998fi
10011019#
10021020
10031021CFLAGS="$CHECK_CFLAGS $ETREE_INCL $CURL_INCL $OPENSSL_INCL $PROJ_INCL $FFTW_INCL $NETCDF_INCL $HDF5_INCL"
1004- LDFLAGS="$CHECK_LDFLAGS $ETREE_LIB $CURL_LIB $OPENSSL_LIB $PROJ_LIB $FFTW_LIB $NETCDF_LIB $HDF5_LIB"
1022+ LDFLAGS="$CHECK_LDFLAGS $ETREE_LIB $CURL_LIB $OPENSSL_LIB $PROJ_LIB $FFTW_LIB $NETCDF_LIB $NETCDF_EXTRALIBS $ HDF5_LIB"
10051023LDFLAGS="$LDFLAGS -lm"
10061024
10071025# Check optional USGS CenCalVM installation
0 commit comments