@@ -211,10 +211,10 @@ test "x$enable_remote_functionality" = xno || enable_remote_functionality=yes
211211AC_MSG_RESULT ( $enable_remote_functionality )
212212
213213# We need curl for remote operations
214- AC_CHECK_LIB ( [ curl ] , [ curl_easy_setopt ] , [ found_curl=yes ] , [ found_curl=no ] )
215- if test "x$found_curl" = "xyes" ; then
216- AC_SEARCH_LIBS ( [ curl_easy_setopt ] , [ curl curl.dll cygcurl.dll ] , [ ] , [ ] )
217- fi
214+ AC_MSG_CHECKING ( [ whether we need to look for libcurl ] )
215+ AC_ARG_ENABLE ( [ curl ] ,
216+ [ AS_HELP_STRING ( [ --enable- curl] ,
217+ [ look for and link against libcurl ] ) ] )
218218
219219# # Capture the state of the --enable-dap flag => enable dap2+dap4
220220AC_MSG_CHECKING ( [ whether DAP client(s) are to be built] )
@@ -229,11 +229,6 @@ if test "x$enable_remote_functionality" = xno ; then
229229 enable_dap=no
230230fi
231231
232- if test "x$enable_dap" = xyes & test "x$found_curl" = xno ; then
233- AC_MSG_WARN ( [ curl required for dap access. DAP support disabled.] )
234- enable_dap=no
235- fi
236-
237232AC_MSG_CHECKING ( [ whether netcdf zarr storage format should be disabled] )
238233AC_ARG_ENABLE ( [ nczarr] ,
239234 [ AS_HELP_STRING ( [ --disable-nczarr] ,
@@ -243,7 +238,7 @@ AC_MSG_RESULT($enable_nczarr)
243238
244239# HDF5 | HDF4 | NCZarr => netcdf-4
245240if test "x$enable_hdf5" = xyes || test "x$enable_hdf4" = xyes || test "x$enable_nczarr" = xyes ; then
246- enable_netcdf4=yes
241+ enable_netcdf4=yes
247242fi
248243
249244AC_MSG_NOTICE ( [ checking user options] )
@@ -467,99 +462,153 @@ else
467462 enable_set_log_level=no
468463fi
469464
465+ # Does the user want to allow reading of remote data via range headers?
466+ AC_MSG_CHECKING ( [ whether byte range support is enabled] )
467+ AC_ARG_ENABLE ( [ byterange] ,
468+ [ AS_HELP_STRING ( [ --disable-byterange] ,
469+ [ allow byte-range I/O] ) ] )
470+ test "x$enable_byterange" = xno || enable_byterange=yes
471+ AC_MSG_RESULT ( $enable_byterange )
470472
471- # CURLOPT_USERNAME is not defined until curl version 7.19.1
472- # CURLOPT_PASSWORD is not defined until curl version 7.19.1
473- # CURLOPT_KEYPASSWD is not defined until curl version 7.16.4
474- # CURLINFO_RESPONSE_CODE is not defined until curl version 7.10.7
475- # CURLOPT_CHUNK_BGN_FUNCTION is not defined until curl version 7.21.0
476- # CURL_MAX_READ_SIZE is not defined until 7.59
473+ if test "x$enable_dap" = xno && test "x$enable_byterange" = xyes; then
474+ AC_MSG_WARN ( [ DAP required for byterange. Byterange support disabled.] )
475+ enable_byterange=no
476+ fi
477477
478- # Save/restore CFLAGS
479- SAVECFLAGS="$CFLAGS"
480- CFLAGS="${curl_cflags}"
478+ # ##
479+ # Stanza to check for functionality which requires linking against
480+ # libcurl.
481+ # ##
481482
482- AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
483- [ #include "curl/curl.h"] ,
484- [ [ int x = CURLOPT_USERNAME;] ] ) ] ,
485- [ haveusername=yes] ,
486- [ haveusername=no] )
487- AC_MSG_CHECKING ( [ whether CURLOPT_USERNAME is defined] )
488- AC_MSG_RESULT ( [ ${haveusername}] )
489- if test $haveusername = yes; then
490- AC_DEFINE ( [ HAVE_CURLOPT_USERNAME] ,[ 1] ,[ Is CURLOPT_USERNAME defined] )
483+ if test "x$enable_dap" = xyes || test "x$enable_nczarr" = xyes; then
484+ enable_curl=yes
491485fi
492486
493- AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
494- [ #include "curl/curl.h"] ,
495- [ [ int x = CURLOPT_PASSWORD;] ] ) ] ,
496- [ havepassword=yes] ,
497- [ havepassword=no] )
498- AC_MSG_CHECKING ( [ whether CURLOPT_PASSWORD is defined] )
499- AC_MSG_RESULT ( [ ${havepassword}] )
500- if test $havepassword = yes; then
501- AC_DEFINE ( [ HAVE_CURLOPT_PASSWORD] ,[ 1] ,[ Is CURLOPT_PASSWORD defined] )
502- fi
487+ if test "x$enable_curl" = xyes; then
503488
504- AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
505- [ #include "curl/curl.h"] ,
506- [ [ int x = CURLOPT_KEYPASSWD;] ] ) ] ,
507- [ havekeypassword=yes] ,
508- [ havekeypassword=no] )
509- AC_MSG_CHECKING ( [ whether CURLOPT_KEYPASSWD is defined] )
510- AC_MSG_RESULT ( [ ${havekeypassword}] )
511- if test $havekeypassword = yes; then
512- AC_DEFINE ( [ HAVE_CURLOPT_KEYPASSWD] ,[ 1] ,[ Is CURLOPT_KEYPASSWD defined] )
513- fi
514489
515- AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
516- [ #include "curl/curl.h"] ,
517- [ [ int x = CURLINFO_RESPONSE_CODE;] ] ) ] ,
518- [ haveresponsecode=yes] ,
519- [ haveresponsecode=no] )
520- AC_MSG_CHECKING ( [ whether CURLINFO_RESPONSE_CODE is defined] )
521- AC_MSG_RESULT ( [ ${haveresponsecode}] )
522- if test $haveresponsecode = yes; then
523- AC_DEFINE ( [ HAVE_CURLINFO_RESPONSE_CODE] ,[ 1] ,[ Is CURLINFO_RESPONSE_CODE defined] )
524- fi
490+ if test "x$enable_dap" = xyes && test "x$found_curl" = xno ; then
491+ AC_MSG_WARN ( [ curl required for dap access. DAP support disabled.] )
492+ enable_dap=no
493+ fi
525494
526- AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
527- [ #include "curl/curl.h"] ,
528- [ [ int x = CURLOPT_BUFFERSIZE;] ] ) ] ,
529- [ havecurloption=yes] ,
530- [ havecurloption=no] )
531- AC_MSG_CHECKING ( [ whether CURLOPT_BUFFERSIZE is defined] )
532- AC_MSG_RESULT ( [ ${havecurloption}] )
533- if test $havecurloption = yes; then
534- AC_DEFINE ( [ HAVE_CURLOPT_BUFFERSIZE] ,[ 1] ,[ Is CURLOPT_BUFFERSIZE defined] )
535- fi
495+ # Need curl for byte ranges
496+ if test "x$found_curl" = xno && test "x$enable_byterange" = xyes ; then
497+ AC_MSG_WARN ( [ curl required for byte range support. Install curl or build without --enable-byterange.] )
498+ enable_byterange=no
499+ fi
536500
537- AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
538- [ #include "curl/curl.h"] ,
539- [ [ int x = CURLOPT_TCP_KEEPALIVE;] ] ) ] ,
540- [ havecurloption=yes] ,
541- [ havecurloption=no] )
542- AC_MSG_CHECKING ( [ whether CURLOPT_TCP_KEEPALIVE is defined] )
543- AC_MSG_RESULT ( [ ${havecurloption}] )
544- if test $havecurloption = yes; then
545- AC_DEFINE ( [ HAVE_CURLOPT_KEEPALIVE] ,[ 1] ,[ Is CURLOPT_TCP_KEEPALIVE defined] )
546- fi
547-
548- # CURLOPT_VERIFYHOST semantics differ depending on version
549- AC_MSG_CHECKING ( [ whether libcurl is version 7.66 or later?] )
550- AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
551- [ #include "curl/curl.h"] ,
552- [ [
553- #if !CURL_AT_LEAST_VERSION(7,66,0)
554- error "<7.66";
555- #endif
556- ] ] ) ] , [ libcurl766=yes] , [ libcurl766=no] )
557- AC_MSG_RESULT ( [ $libcurl766] )
558- if test x$libcurl766 = xyes; then
559- AC_DEFINE ( [ HAVE_LIBCURL_766] ,[ 1] ,[ libcurl version is 7.66 or later] )
501+ if test "x$enable_byterange" = xyes; then
502+ AC_DEFINE ( [ NETCDF_ENABLE_BYTERANGE] , [ 1] , [ if true, support byte-range read of remote datasets.] )
503+ fi
504+
505+ AC_CHECK_LIB ( [ curl] ,[ curl_easy_setopt] ,[ found_curl=yes] ,[ found_curl=no] )
506+ if test "x$found_curl" = "xyes" ; then
507+ AC_SEARCH_LIBS ( [ curl_easy_setopt] ,[ curl curl.dll cygcurl.dll] , [ ] ,[ ] )
508+ fi
509+
510+ if test "x$enable_dap" = xyes & test "x$found_curl" = xno ; then
511+ AC_MSG_WARN ( [ curl required for dap access. DAP support disabled.] )
512+ enable_dap=no
513+ fi
514+
515+ # Save/restore CFLAGS
516+ SAVECFLAGS="$CFLAGS"
517+ CFLAGS="${curl_cflags}"
518+
519+ # CURLOPT_USERNAME is not defined until curl version 7.19.1
520+ # CURLOPT_PASSWORD is not defined until curl version 7.19.1
521+ # CURLOPT_KEYPASSWD is not defined until curl version 7.16.4
522+ # CURLINFO_RESPONSE_CODE is not defined until curl version 7.10.7
523+ # CURLOPT_CHUNK_BGN_FUNCTION is not defined until curl version 7.21.0
524+ # CURL_MAX_READ_SIZE is not defined until 7.59
525+
526+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
527+ [ #include "curl/curl.h"] ,
528+ [ [ int x = CURLOPT_USERNAME;] ] ) ] ,
529+ [ haveusername=yes] ,
530+ [ haveusername=no] )
531+ AC_MSG_CHECKING ( [ whether CURLOPT_USERNAME is defined] )
532+ AC_MSG_RESULT ( [ ${haveusername}] )
533+ if test $haveusername = yes; then
534+ AC_DEFINE ( [ HAVE_CURLOPT_USERNAME] ,[ 1] ,[ Is CURLOPT_USERNAME defined] )
535+ fi
536+
537+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
538+ [ #include "curl/curl.h"] ,
539+ [ [ int x = CURLOPT_PASSWORD;] ] ) ] ,
540+ [ havepassword=yes] ,
541+ [ havepassword=no] )
542+ AC_MSG_CHECKING ( [ whether CURLOPT_PASSWORD is defined] )
543+ AC_MSG_RESULT ( [ ${havepassword}] )
544+ if test $havepassword = yes; then
545+ AC_DEFINE ( [ HAVE_CURLOPT_PASSWORD] ,[ 1] ,[ Is CURLOPT_PASSWORD defined] )
546+ fi
547+
548+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
549+ [ #include "curl/curl.h"] ,
550+ [ [ int x = CURLOPT_KEYPASSWD;] ] ) ] ,
551+ [ havekeypassword=yes] ,
552+ [ havekeypassword=no] )
553+ AC_MSG_CHECKING ( [ whether CURLOPT_KEYPASSWD is defined] )
554+ AC_MSG_RESULT ( [ ${havekeypassword}] )
555+ if test $havekeypassword = yes; then
556+ AC_DEFINE ( [ HAVE_CURLOPT_KEYPASSWD] ,[ 1] ,[ Is CURLOPT_KEYPASSWD defined] )
557+ fi
558+
559+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
560+ [ #include "curl/curl.h"] ,
561+ [ [ int x = CURLINFO_RESPONSE_CODE;] ] ) ] ,
562+ [ haveresponsecode=yes] ,
563+ [ haveresponsecode=no] )
564+ AC_MSG_CHECKING ( [ whether CURLINFO_RESPONSE_CODE is defined] )
565+ AC_MSG_RESULT ( [ ${haveresponsecode}] )
566+ if test $haveresponsecode = yes; then
567+ AC_DEFINE ( [ HAVE_CURLINFO_RESPONSE_CODE] ,[ 1] ,[ Is CURLINFO_RESPONSE_CODE defined] )
568+ fi
569+
570+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
571+ [ #include "curl/curl.h"] ,
572+ [ [ int x = CURLOPT_BUFFERSIZE;] ] ) ] ,
573+ [ havecurloption=yes] ,
574+ [ havecurloption=no] )
575+ AC_MSG_CHECKING ( [ whether CURLOPT_BUFFERSIZE is defined] )
576+ AC_MSG_RESULT ( [ ${havecurloption}] )
577+ if test $havecurloption = yes; then
578+ AC_DEFINE ( [ HAVE_CURLOPT_BUFFERSIZE] ,[ 1] ,[ Is CURLOPT_BUFFERSIZE defined] )
579+ fi
580+
581+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
582+ [ #include "curl/curl.h"] ,
583+ [ [ int x = CURLOPT_TCP_KEEPALIVE;] ] ) ] ,
584+ [ havecurloption=yes] ,
585+ [ havecurloption=no] )
586+ AC_MSG_CHECKING ( [ whether CURLOPT_TCP_KEEPALIVE is defined] )
587+ AC_MSG_RESULT ( [ ${havecurloption}] )
588+ if test $havecurloption = yes; then
589+ AC_DEFINE ( [ HAVE_CURLOPT_KEEPALIVE] ,[ 1] ,[ Is CURLOPT_TCP_KEEPALIVE defined] )
590+ fi
591+
592+ # CURLOPT_VERIFYHOST semantics differ depending on version
593+ AC_MSG_CHECKING ( [ whether libcurl is version 7.66 or later?] )
594+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
595+ [ #include "curl/curl.h"] ,
596+ [ [
597+ #if !CURL_AT_LEAST_VERSION(7,66,0)
598+ error "<7.66";
599+ #endif
600+ ] ] ) ] , [ libcurl766=yes] , [ libcurl766=no] )
601+ AC_MSG_RESULT ( [ $libcurl766] )
602+ if test x$libcurl766 = xyes; then
603+ AC_DEFINE ( [ HAVE_LIBCURL_766] ,[ 1] ,[ libcurl version is 7.66 or later] )
604+ fi
605+
606+ CFLAGS="$SAVECFLAGS"
560607fi
561608
562- CFLAGS="$SAVECFLAGS"
609+ # ##
610+ # End libcurl-related stanza
611+ # ##
563612
564613# ##
565614# Libxml2 control block.
@@ -1381,28 +1430,13 @@ if test "x$enable_mmap" = xyes; then
13811430 AC_DEFINE ( [ USE_MMAP] , [ 1] , [ if true, use mmap for in-memory files] )
13821431fi
13831432
1384- # Does the user want to allow reading of remote data via range headers?
1385- AC_MSG_CHECKING ( [ whether byte range support is enabled] )
1386- AC_ARG_ENABLE ( [ byterange] ,
1387- [ AS_HELP_STRING ( [ --disable-byterange] ,
1388- [ allow byte-range I/O] ) ] )
1389- test "x$enable_byterange" = xno || enable_byterange=yes
1390- AC_MSG_RESULT ( $enable_byterange )
1433+
13911434
13921435if test "x$enable_remote_functionality" = xno ; then
13931436 AC_MSG_WARN ( [ --disable-remote-functionality => --disable-byterange] )
13941437 enable_byterange=no
13951438fi
13961439
1397- # Need curl for byte ranges
1398- if test "x$found_curl" = xno && test "x$enable_byterange" = xyes ; then
1399- AC_MSG_ERROR ( [ curl required for byte range support. Install curl or build without --enable-byterange.] )
1400- enable_byterange=no
1401- fi
1402-
1403- if test "x$enable_byterange" = xyes; then
1404- AC_DEFINE ( [ NETCDF_ENABLE_BYTERANGE] , [ 1] , [ if true, support byte-range read of remote datasets.] )
1405- fi
14061440
14071441# Does the user want to disable atexit?
14081442AC_MSG_CHECKING ( [ whether nc_finalize should be invoked at exit] )
0 commit comments