diff --git a/configure b/configure index 423bccba..6e9b4bcf 100755 --- a/configure +++ b/configure @@ -644,6 +644,7 @@ HAVE_HTTP1 HAVE_LIBNGHTTP2 enable_netsnmp with_restconf +with_libcurl LINKAGE LIBSTATIC_SUFFIX SH_SUFFIX @@ -724,6 +725,7 @@ enable_debug with_cligen enable_yang_patch enable_yang_schema_mount +with_libcurl enable_publish with_restconf enable_http1 @@ -1391,6 +1393,8 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-cligen=dir Use CLIGEN installation in this dir + --without-libcurl Disable use of libcurl, affects publish + notification, including clixon_util_stream --with-restconf=native Integration with embedded web server (DEFAULT) --with-restconf=fcgi FCGI interface for stand-alone web rev-proxy eg nginx @@ -4699,25 +4703,16 @@ $as_echo "#define CLIXON_YANG_SCHEMA_MOUNT 1" >>confdefs.h fi -# Experimental: Curl publish notification stream to eg Nginx nchan. -# Check whether --enable-publish was given. -if test "${enable_publish+set}" = set; then : - enableval=$enable_publish; - if test "$enableval" = no; then - ac_enable_publish=no - else - ac_enable_publish=yes - fi +# publish streams uses libcurl +# Check whether --with-libcurl was given. +if test "${with_libcurl+set}" = set; then : + withval=$with_libcurl; with_libcurl=$withval else - ac_enable_publish=no + with_libcurl=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: publish is $ac_enable_publish" >&5 -$as_echo "publish is $ac_enable_publish" >&6; } - -if test "$ac_enable_publish" = "yes"; then - # publish streams uses libcurl +if test "x${with_libcurl}" != "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } @@ -4978,16 +4973,16 @@ fi done -for ac_header in curl.h +for ac_header in curl/curl.h do : - ac_fn_c_check_header_mongrel "$LINENO" "curl.h" "ac_cv_header_curl_h" "$ac_includes_default" -if test "x$ac_cv_header_curl_h" = xyes; then : + ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default" +if test "x$ac_cv_header_curl_curl_h" = xyes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_CURL_H 1 +#define HAVE_CURL_CURL_H 1 _ACEOF else - as_fn_error $? "curl missing" "$LINENO" 5 + as_fn_error $? "curl header(s) missing" "$LINENO" 5 fi done @@ -5039,10 +5034,32 @@ else as_fn_error $? "libcurl missing" "$LINENO" 5 fi +fi + +# Experimental: Curl publish notification stream to eg Nginx nchan. +# Check whether --enable-publish was given. +if test "${enable_publish+set}" = set; then : + enableval=$enable_publish; + if test "$enableval" = no; then + ac_enable_publish=no + else + ac_enable_publish=yes + fi + +else + ac_enable_publish=no +fi + +if test "$ac_enable_publish" = "yes"; then + if test "x${with_libcurl}" = "xno"; then + as_fn_error $? "--enable-publish conflicts with --without-libcurl" "$LINENO" 5 + fi $as_echo "#define CLIXON_PUBLISH_STREAMS 1" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: publish is $ac_enable_publish" >&5 +$as_echo "publish is $ac_enable_publish" >&6; } for ac_header in cligen/cligen.h do : diff --git a/configure.ac b/configure.ac index 27f3f5b7..0b645cd4 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,7 @@ AC_SUBST(LIBS) AC_SUBST(SH_SUFFIX) AC_SUBST(LIBSTATIC_SUFFIX) AC_SUBST(LINKAGE) +AC_SUBST(with_libcurl) AC_SUBST(with_restconf) # Set to native or fcgi -> compile apps/restconf AC_SUBST(enable_netsnmp) # Enable build of apps/snmp AC_SUBST(HAVE_LIBNGHTTP2,false) # consider using neutral constant such as with-http2 @@ -213,8 +214,19 @@ if test "${enable_yang_schema_mount}" = "yes"; then AC_DEFINE(CLIXON_YANG_SCHEMA_MOUNT, 1, [Enable YANG schema mount, RFC 8528]) fi +# publish streams uses libcurl +AC_ARG_WITH([libcurl], + [AS_HELP_STRING([--without-libcurl], + [Disable use of libcurl, affects publish notification, including clixon_util_stream])], + [with_libcurl=$withval],[with_libcurl=yes]) +if test "x${with_libcurl}" != "xno"; then + AC_CHECK_HEADERS(curl/curl.h,[], AC_MSG_ERROR([curl header(s) missing])) + AC_CHECK_LIB(curl, curl_global_init,, AC_MSG_ERROR([libcurl missing])) +fi + # Experimental: Curl publish notification stream to eg Nginx nchan. -AC_ARG_ENABLE(publish, AS_HELP_STRING([--enable-publish],[Enable publish of notification streams using SSE and curl]),[ +AC_ARG_ENABLE(publish, AS_HELP_STRING([--enable-publish], + [Enable publish of notification streams using SSE and curl]),[ if test "$enableval" = no; then ac_enable_publish=no else @@ -222,14 +234,13 @@ AC_ARG_ENABLE(publish, AS_HELP_STRING([--enable-publish],[Enable publish of noti fi ], [ ac_enable_publish=no]) -AC_MSG_RESULT(publish is $ac_enable_publish) - if test "$ac_enable_publish" = "yes"; then - # publish streams uses libcurl - AC_CHECK_HEADERS(curl.h,[], AC_MSG_ERROR([curl missing])) - AC_CHECK_LIB(curl, curl_global_init,, AC_MSG_ERROR([libcurl missing])) + if test "x${with_libcurl}" = "xno"; then + AC_MSG_ERROR([--enable-publish conflicts with --without-libcurl]) + fi AC_DEFINE(CLIXON_PUBLISH_STREAMS, 1, [Enable publish of notification streams using SSE and curl]) fi +AC_MSG_RESULT(publish is $ac_enable_publish) AC_CHECK_HEADERS(cligen/cligen.h,, AC_MSG_ERROR([CLIgen missing. Try: git clone https://github.com/clicon/cligen.git])) diff --git a/include/clixon_config.h.in b/include/clixon_config.h.in index 142e7611..fa506fc5 100644 --- a/include/clixon_config.h.in +++ b/include/clixon_config.h.in @@ -30,8 +30,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CLIGEN_CLIGEN_H -/* Define to 1 if you have the header file. */ -#undef HAVE_CURL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_CURL_CURL_H /* Define to 1 if you have the `getpeereid' function. */ #undef HAVE_GETPEEREID diff --git a/util/Makefile.in b/util/Makefile.in index 1afa0e51..536a8a65 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -46,6 +46,7 @@ localstatedir = @localstatedir@ sysconfdir = @sysconfdir@ HOST_VENDOR = @host_vendor@ with_restconf = @with_restconf@ +with_libcurl = @with_libcurl@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ SH_SUFFIX = @SH_SUFFIX@ @@ -102,7 +103,9 @@ APPSRC += clixon_util_dispatcher.c APPSRC += clixon_netconf_ssh_callhome.c APPSRC += clixon_netconf_ssh_callhome_client.c ifdef with_restconf -APPSRC += clixon_util_stream.c # Needs curl +ifdef with_libcurl +APPSRC += clixon_util_stream.c +endif ifeq ($(with_restconf), native) APPSRC += clixon_restconf_callhome_client.c endif