Added an explicit check for CURLOPT_CHUNK_BGN_FUNCTION, otherwise we break the build on systems with libcurl older than version 7.21.0

This commit is contained in:
Ward Fisher 2014-12-27 22:59:06 -08:00
parent cdacc3a5f5
commit 3aa6c969e2
5 changed files with 35 additions and 9 deletions

View File

@ -586,6 +586,15 @@ IF(ENABLE_DAP)
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE)
# Check to see if CURLOPT_CHUNK_BGN_FUNCTION is defined.
# It showed up in curl 7.21.0.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_CHUNK_BGN_FUNCTION;}" HAVE_CURLOPT_CHUNK_BGN_FUNCTION)
ENDIF()
# Check to see if libtool supports

View File

@ -9,6 +9,8 @@ This file contains a high-level description of this package's evolution. Release
### 4.3.3-rc3 Released ?
* Added an explicit check in the build systems (autotools, cmake) for the CURL-related option `CURLOPT_CHUNK_BGN_FUNCTION`. This option was introduced in libcurl version `7.21.0`. On installations which require libcurl and have this version, `CURLOPT_CHUNK_BGN_FUNCTION` will be available. Otherwise, it will not.
* Added functionality to make it easier to build `netcdf-fortran` as part of the `netcdf-c` build. This functionality is enabled at configure time by using the following **Highly Experimental** options:
* CMake: `-DENABLE_REMOTE_FORTRAN_BOOTSTRAP=ON`

View File

@ -17,16 +17,16 @@ are set when opening a binary file on Windows. */
#define close _close
#define read _read
#define lseek _lseeki64
#define fstat _fstat64
#define off_t __int64
#define _off_t __int64
#ifndef _OFF_T_DEFINED
#define _OFF_T_DEFINED
#endif
#ifdef _WIN32
#ifndef strcasecmp
#define strcasecmp _stricmp
@ -104,6 +104,7 @@ are set when opening a binary file on Windows. */
#cmakedefine HAVE_CURLOPT_PASSWORD 1
#cmakedefine HAVE_CURLOPT_KEYPASSWD 1
#cmakedefine HAVE_CURLINFO_RESPONSE_CODE 1
#cmakedefine HAVE_CURLOPT_CHUNK_BGN_FUNCTION 1
#cmakedefine HAVE_DECL_SIGNBIT 1
#cmakedefine HAVE_DOPRNT
#cmakedefine HAVE_ALLOCA
@ -208,7 +209,7 @@ are set when opening a binary file on Windows. */
/* The size of `char` as computed by sizeof. */
#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
/* The size of `double` as computed by sizeof. */
#cmakedefine SIZEOF_DOUBLE @SIZEOF_DOUBLE@
#cmakedefine SIZEOF_DOUBLE @SIZEOF_DOUBLE@
/* The size of `float` as computed by sizeof. */
#cmakedefine SIZEOF_FLOAT @SIZEOF_FLOAT@
/* The size of `int` as computed by sizeof. */
@ -225,7 +226,7 @@ are set when opening a binary file on Windows. */
/* The size of `size_t` as computed by sizeof. */
#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
/* The size of `ssize_t` as computed by sizeof. */
#cmakedefine SIZEOF_SSIZE_T @SIZEOF_SSIZE_T@
#cmakedefine SIZEOF_SSIZE_T @SIZEOF_SSIZE_T@
/* The size of `uchar` as computed by sizeof. */
#cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
/* The size of `__int64` found on Windows systems. */
@ -273,8 +274,8 @@ are set when opening a binary file on Windows. */
/* Specifies if various libraries are present. */
#cmakedefine HAVE_LIBM 1
/* Define to 1 if the system has the type `uchar'.*/
#cmakedefine HAVE_UCHAR
/* Define to 1 if the system has the type `uchar'.*/
#cmakedefine HAVE_UCHAR
/* Misc defines copied from autotools config.h.in */
#cmakedefine CRAY_STACKSEG_END

View File

@ -586,6 +586,7 @@ AC_C_CONST
# CURLOPT_PASSWORD is not defined until curl version 7.19.1
# CURLOPT_KEYPASSWD is not defined until curl version 7.16.4
# CURLINFO_RESPONSE_CODE is not defined until curl version 7.10.7
# CURLOPT_CHUNK_BGN_FUNCTION is not defined until curl version 7.21.0
# Save/restore CFLAGS
SAVECFLAGS="$CFLAGS"
@ -635,6 +636,17 @@ if test $haveresponsecode = yes; then
AC_DEFINE([HAVE_CURLINFO_RESPONSE_CODE],[1],[Is CURLINFO_RESPONSE_CODE defined])
fi
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[#include "curl/curl.h"],
[[int x = CURLOPT_CHUNK_BGN_FUNCTION;]])],
[havebgnfunction=yes],
[havebgnfunction=no])
AC_MSG_CHECKING([whether CURLOPT_CHUNK_BGN_FUNCTION is defined])
AC_MSG_RESULT([${havebgnfunction}])
if test $havebgnfunction = yes; then
AC_DEFINE([HAVE_CURLOPT_CHUNK_BGN_FUNCTION],[1],[Is CURLOPT_CHUNK_BGN_FUNCTION defined])
fi
CFLAGS="$SAVECFLAGS"
# Set up libtool.

View File

@ -51,7 +51,9 @@ static struct OCCURLFLAG oc_allcurlflags[] = {
{"CURLOPT_CAINFO",CURLOPT_CAINFO,10065,CF_UNKNOWN},
{"CURLOPT_CAPATH",CURLOPT_CAPATH,10097,CF_UNKNOWN},
{"CURLOPT_CERTINFO",CURLOPT_CERTINFO,172,CF_UNKNOWN},
#ifdef HAVE_CURLOPT_CHUNK_BGN_FUNCTION
{"CURLOPT_CHUNK_BGN_FUNCTION",CURLOPT_CHUNK_BGN_FUNCTION,20198,CF_UNKNOWN},
#endif
{"CURLOPT_CHUNK_DATA",CURLOPT_CHUNK_DATA,10201,CF_UNKNOWN},
{"CURLOPT_CHUNK_END_FUNCTION",CURLOPT_CHUNK_END_FUNCTION,20199,CF_UNKNOWN},
{"CURLOPT_CLOSEPOLICY",CURLOPT_CLOSEPOLICY,72,CF_UNKNOWN},
@ -285,7 +287,7 @@ occurlflagbyname(const char* name)
const char* p;
char* q;
if(nflags == 0) initialize();
if(nflags == 0) initialize();
/* Force upper case */
for(p=name,q=flagname;*p;p++) {
int cc = touppercase(*p);
@ -307,7 +309,7 @@ occurlflagbyname(const char* name)
struct OCCURLFLAG*
occurlflagbyflag(int flag)
{
if(nflags == 0) initialize();
if(nflags == 0) initialize();
if(flag >= 0 || flag <= maxflag)
return flagindices[flag];
return NULL;