Changed --with-restconf directive to have package as argument, with either null, evhtp or fcgi.

This effects configure script and makefiles
This commit is contained in:
Olof hagsand 2020-06-04 11:26:38 +02:00
parent bb3593bb99
commit a455b15f03
6 changed files with 399 additions and 217 deletions

View file

@ -48,7 +48,7 @@ SUBDIRS += cli
SUBDIRS += netconf SUBDIRS += netconf
# See configure.ac # See configure.ac
ifeq ($(with_restconf),yes) ifdef with_restconf
SUBDIRS += restconf SUBDIRS += restconf
endif endif

View file

@ -1510,8 +1510,10 @@ verify_nacm_user(enum nacm_credentials_t mode,
if (mode == NC_EXCEPT){ if (mode == NC_EXCEPT){
if (strcmp(peername, "root") == 0) if (strcmp(peername, "root") == 0)
goto ok; goto ok;
#ifdef WITH_RESTCONF
if (strcmp(peername, WWWUSER) == 0) if (strcmp(peername, WWWUSER) == 0)
goto ok; goto ok;
#endif
} }
if (strcmp(peername, nacmname) != 0){ if (strcmp(peername, nacmname) != 0){
if ((cbmsg = cbuf_new()) == NULL){ if ((cbmsg = cbuf_new()) == NULL){

View file

@ -32,6 +32,9 @@
# #
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
# #
# This makefile supports several restconf web packages in compile-time depending
# on the value of the with_restconf configure option
#
VPATH = @srcdir@ VPATH = @srcdir@
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
@ -55,8 +58,8 @@ HOST_VENDOR = @host_vendor@
# XXX why is not wwwdir under prefix? # XXX why is not wwwdir under prefix?
wwwdir = @wwwdir@ wwwdir = @wwwdir@
wwwuser = @wwwuser@ wwwuser = @wwwuser@
with_libhttp = @with_libhttp@ # one of fcgi or evhtp:
with_evhtp = @with_evhtp@ with_restconf = @with_restconf@
SH_SUFFIX = @SH_SUFFIX@ SH_SUFFIX = @SH_SUFFIX@
CLIXON_MAJOR = @CLIXON_VERSION_MAJOR@ CLIXON_MAJOR = @CLIXON_VERSION_MAJOR@
@ -69,64 +72,47 @@ CLIXON_LIB = libclixon$(SH_SUFFIX).$(CLIXON_MAJOR).$(CLIXON_MINOR)
LIBDEPS = $(top_srcdir)/lib/src/$(CLIXON_LIB) LIBDEPS = $(top_srcdir)/lib/src/$(CLIXON_LIB)
LIBS = -L$(top_srcdir)/lib/src @LIBS@ $(top_srcdir)/lib/src/$(CLIXON_LIB) LIBS = -L$(top_srcdir)/lib/src @LIBS@ $(top_srcdir)/lib/src/$(CLIXON_LIB)
ifeq ($(with_libhttp),yes) #LIBS += -lpthread -levent -levent_openssl -lssl -lcrypto
LIBS += -ldl -lpthread
endif
ifeq ($(with_evhtp),yes)
LIBS += -lpthread -levent -levent_openssl -lssl -lcrypto
endif
CPPFLAGS = @CPPFLAGS@ -fPIC CPPFLAGS = @CPPFLAGS@ -fPIC
INCLUDES = -I. -I$(top_srcdir)/lib/src -I$(top_srcdir)/lib -I$(top_srcdir)/include -I$(top_srcdir) @INCLUDES@ INCLUDES = -I. -I$(top_srcdir)/lib/src -I$(top_srcdir)/lib -I$(top_srcdir)/include -I$(top_srcdir) @INCLUDES@
# Applications # Applications
APPLS = clixon_restconf # fcgi / nginx ifeq ($(with_restconf),fcgi)
ifeq ($(with_libhttp),yes) APPL = clixon_restconf # fcgi / nginx
APPLS += clixon_restconf_libhttp else
endif APPL = clixon_restconf_$(with_restconf)
ifeq ($(with_evhtp),yes)
APPLS += clixon_restconf_evhtp
endif endif
# Common source - not accessible from plugin - independent of fcgi # Common source - not accessible from plugin - independent of restconf package (fcgi|evhtp)
APPSRC = restconf_lib.c APPSRC = restconf_lib.c
APPOBJ = $(APPSRC:.c=.o)
# Fcgi-specific source including main # Fcgi-specific source including main
APPFCGI = restconf_fcgi_lib.c ifeq ($(with_restconf),fcgi)
APPFCGI += restconf_fcgi_main.c APPSRC += restconf_fcgi_lib.c
APPFCGI += restconf_methods.c # These should be moved ^ APPSRC += restconf_fcgi_main.c
APPFCGI += restconf_methods_post.c APPSRC += restconf_methods.c # These should be moved ^
APPFCGI += restconf_methods_get.c APPSRC += restconf_methods_post.c
APPFCGI += restconf_stream.c APPSRC += restconf_methods_get.c
APPFCGIOBJ = $(APPFCGI:.c=.o) APPSRC += restconf_stream.c
ifeq ($(with_libhttp),yes)
# Libhttp-specific source including main
APPLIBH = restconf_libhttp_main.c
APPLIBHOBJ = $(APPLIBH:.c=.o)
endif endif
ifeq ($(with_evhtp),yes)
# Evhtp-specific source including main # Evhtp-specific source including main
APPEVHTPH = restconf_evhtp_main.c ifeq ($(with_restconf),evhtp)
APPEVHTPOBJ = $(APPEVHTPH:.c=.o) APPSRC += restconf_evhtp_main.c
endif endif
all: $(APPLS) APPOBJ = $(APPSRC:.c=.o)
all: $(APPL)
# Dependency of clixon library # Dependency of clixon library
$(top_srcdir)/lib/src/$(CLIXON_LIB): $(top_srcdir)/lib/src/$(CLIXON_LIB):
(cd $(top_srcdir)/lib/src && $(MAKE) $(MFLAGS) $(CLIXON_LIB)) (cd $(top_srcdir)/lib/src && $(MAKE) $(MFLAGS) $(CLIXON_LIB))
clean: clean:
rm -f *.core $(APPLS) $(APPOBJ) $(APPFCGIOBJ) rm -f *.core $(APPL) $(APPOBJ) *.o # extra .o to clean residue if with_restconf changes
ifeq ($(with_libhttp),yes)
rm -f $(APPLIBHOBJ)
endif
ifeq ($(with_evhtp),yes)
rm -f $(APPEVHTPOBJ)
endif
distclean: clean distclean: clean
rm -f Makefile *~ .depend rm -f Makefile *~ .depend
@ -136,18 +122,18 @@ distclean: clean
# Also create a libexec/ directory for writeable/temporary files. # Also create a libexec/ directory for writeable/temporary files.
# Put config file in etc/ # Put config file in etc/
# Also a rule for letting www-dir be owned by www-data, which only works for sudo # Also a rule for letting www-dir be owned by www-data, which only works for sudo
install: $(APPLS) install: $(APPL)
ifeq ($(shell whoami),root) ifeq ($(shell whoami),root)
install -d -m 0755 -o $(wwwuser) -g $(wwwuser) $(DESTDIR)$(wwwdir) install -d -m 0755 -o $(wwwuser) -g $(wwwuser) $(DESTDIR)$(wwwdir)
else else
install -d -m 0755 $(DESTDIR)$(wwwdir) install -d -m 0755 $(DESTDIR)$(wwwdir)
endif endif
install -m 0755 $(INSTALLFLAGS) $(APPLS) $(DESTDIR)$(wwwdir) install -m 0755 $(INSTALLFLAGS) $(APPL) $(DESTDIR)$(wwwdir)
install-include: install-include:
uninstall: uninstall:
rm -f $(DESTDIR)$(wwwdir)/$(APPLS) rm -f $(DESTDIR)$(wwwdir)/$(APPL)
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -155,18 +141,8 @@ uninstall:
.c.o: .c.o:
$(CC) $(INCLUDES) -D__PROGRAM__=\"clixon_restconf\" $(CPPFLAGS) $(CFLAGS) -c $< $(CC) $(INCLUDES) -D__PROGRAM__=\"clixon_restconf\" $(CPPFLAGS) $(CFLAGS) -c $<
clixon_restconf : $(APPOBJ) $(APPFCGIOBJ) $(APPL) : $(APPOBJ)
$(CC) $(LDFLAGS) $(APPOBJ) $(APPFCGIOBJ) -L. $(LIBS) -o $@ $(CC) $(LDFLAGS) $(APPOBJ) $(LIBS) -o $@
ifeq ($(with_libhttp),yes)
clixon_restconf_libhttp : $(APPOBJ) $(APPLIBHOBJ) $(LIBDEPS)
$(CC) $(LDFLAGS) $(APPOBJ) $(APPLIBHOBJ) -L. $(LIBS) -o $@
endif
ifeq ($(with_evhtp),yes)
clixon_restconf_evhtp : $(APPOBJ) $(APPEVHTPOBJ) $(LIBDEPS)
$(CC) $(LDFLAGS) $(APPOBJ) $(APPEVHTPOBJ) -L. $(LIBS) -o $@
endif
TAGS: TAGS:
find . -name '*.[chyl]' -print | etags - find . -name '*.[chyl]' -print | etags -

429
configure vendored
View file

@ -634,8 +634,6 @@ CPP
wwwuser wwwuser
wwwdir wwwdir
enable_optyangs enable_optyangs
with_evhtp
with_libhttp
with_restconf with_restconf
SH_SUFFIX SH_SUFFIX
CLIXON_DEFAULT_CONFIG CLIXON_DEFAULT_CONFIG
@ -717,8 +715,6 @@ enable_optyangs
enable_publish enable_publish
with_restconf with_restconf
with_wwwuser with_wwwuser
with_libhttp
with_evhtp
with_configfile with_configfile
with_libxml2 with_libxml2
with_yang_installdir with_yang_installdir
@ -1367,11 +1363,12 @@ Optional Features:
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-cligen=dir --with-cligen=dir Use CLIGEN installation in this dir
--without-restconf disable support for restconf --with-restconf=fcgi FCGI interface for stand-alone web rev-proxy eg
nginx (default)
--with-restconf=evhtp Integrate restconf with libevhtp server
--without-restconf Disable restconf altogether
--with-wwwuser=<user> Set www user different from www-data --with-wwwuser=<user> Set www user different from www-data
--with-libhttp Use libhttp as restconf server
--with-evhtp Use evhtp as restconf server
--with-configfile=FILE Set default path to config file --with-configfile=FILE Set default path to config file
--with-libxml2 Use gnome/libxml2 regex engine --with-libxml2 Use gnome/libxml2 regex engine
--with-yang-installdir=DIR --with-yang-installdir=DIR
@ -3306,8 +3303,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# If yes, compile apps/restconf # If yes, compile apps/restconf
# If yes, use libhttp+restconf server (https://www.libhttp.org/)
# If yes, use libevhp+restconf server (https://github.com/criticalstack/libevhtp)
wwwdir=/www-data wwwdir=/www-data
@ -4248,7 +4243,7 @@ SH_SUFFIX=".so"
# Check whether --with-cligen was given. # Check whether --with-cligen was given.
if test "${with_cligen+set}" = set; then : if test "${with_cligen+set}" = set; then :
withval=$with_cligen; Use CLIGEN here withval=$with_cligen;
fi fi
if test "${with_cligen}"; then if test "${with_cligen}"; then
@ -4672,16 +4667,22 @@ else
fi fi
# This is for restconf (and fastcgi) # This is for restconf. There are three options:
# --without-restconf No restconf support
# --with-restconf=fcgi FCGI interface for separate web reverse proxy like nginx
# --with-restconf=evhtp Integration with embedded web server libevhtp
# Real one
# Check whether --with-restconf was given. # Check whether --with-restconf was given.
if test "${with_restconf+set}" = set; then : if test "${with_restconf+set}" = set; then :
withval=$with_restconf; withval=$with_restconf;
else else
with_restconf=yes with_restconf=fcgi
fi fi
if test "x${with_restconf}" == xyes; then
# Actions for each specific package
if test "x${with_restconf}" == xfcgi; then
# Lives in libfcgi-dev # Lives in libfcgi-dev
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FCGX_Init in -lfcgi" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FCGX_Init in -lfcgi" >&5
$as_echo_n "checking for FCGX_Init in -lfcgi... " >&6; } $as_echo_n "checking for FCGX_Init in -lfcgi... " >&6; }
@ -4730,114 +4731,7 @@ else
as_fn_error $? "libfcgi-dev missing" "$LINENO" 5 as_fn_error $? "libfcgi-dev missing" "$LINENO" 5
fi fi
fi elif test "x${with_restconf}" == xevhtp; then
# This is for changing web user default www-data
# Check whether --with-wwwuser was given.
if test "${with_wwwuser+set}" = set; then :
withval=$with_wwwuser;
fi
if test "${with_wwwuser}"; then
wwwuser=${with_wwwuser}
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: www user is $wwwuser" >&5
$as_echo "www user is $wwwuser" >&6; }
cat >>confdefs.h <<_ACEOF
#define WWWUSER "$wwwuser"
_ACEOF
# OBSOLETE: This is for libhttp server (https://www.libhttp.org/) to be used as restconf client
# Out-of-the box it comes as static lib .a
# Check whether --with-libhttp was given.
if test "${with_libhttp+set}" = set; then :
withval=$with_libhttp;
else
with_libhttp=no
fi
if test "x${with_libhttp}" == xyes; then
for ac_header in libhttp/libhttp.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "libhttp/libhttp.h" "ac_cv_header_libhttp_libhttp_h" "$ac_includes_default"
if test "x$ac_cv_header_libhttp_libhttp_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBHTTP_LIBHTTP_H 1
_ACEOF
else
as_fn_error $? "libhttp header missing. See https://www.libhttp.org" "$LINENO" 5
fi
done
# In github repo default install this is a static lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for httplib_start in -lhttp" >&5
$as_echo_n "checking for httplib_start in -lhttp... " >&6; }
if ${ac_cv_lib_http_httplib_start+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lhttp -lpthread -ldl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char httplib_start ();
int
main ()
{
return httplib_start ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_http_httplib_start=yes
else
ac_cv_lib_http_httplib_start=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_http_httplib_start" >&5
$as_echo "$ac_cv_lib_http_httplib_start" >&6; }
if test "x$ac_cv_lib_http_httplib_start" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBHTTP 1
_ACEOF
LIBS="-lhttp $LIBS"
else
as_fn_error $? "libhttplib missing" "$LINENO" 5
fi
fi
# This is for libevhtp server (https://github.com/criticalstack/libevhtp)
# Check whether --with-evhtp was given.
if test "${with_evhtp+set}" = set; then :
withval=$with_evhtp;
else
with_evhtp=no
fi
#echo "with_evhtp:${with_evhtp}"
if test "x${with_evhtp}" == xyes; then
for ac_header in evhtp/evhtp.h for ac_header in evhtp/evhtp.h
do : do :
ac_fn_c_check_header_mongrel "$LINENO" "evhtp/evhtp.h" "ac_cv_header_evhtp_evhtp_h" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "evhtp/evhtp.h" "ac_cv_header_evhtp_evhtp_h" "$ac_includes_default"
@ -4852,6 +4746,242 @@ fi
done done
#LIBS += -lpthread -levent -levent_openssl -lssl -lcrypto
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
if ${ac_cv_lib_pthread_pthread_create+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pthread_create ();
int
main ()
{
return pthread_create ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pthread_pthread_create=yes
else
ac_cv_lib_pthread_pthread_create=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPTHREAD 1
_ACEOF
LIBS="-lpthread $LIBS"
else
as_fn_error $? "libpthread missing" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for event_init in -levent" >&5
$as_echo_n "checking for event_init in -levent... " >&6; }
if ${ac_cv_lib_event_event_init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-levent $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char event_init ();
int
main ()
{
return event_init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_event_event_init=yes
else
ac_cv_lib_event_event_init=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_event_event_init" >&5
$as_echo "$ac_cv_lib_event_event_init" >&6; }
if test "x$ac_cv_lib_event_event_init" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBEVENT 1
_ACEOF
LIBS="-levent $LIBS"
else
as_fn_error $? "libevent missing" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bufferevent_openssl_socket_new in -levent_openssl" >&5
$as_echo_n "checking for bufferevent_openssl_socket_new in -levent_openssl... " >&6; }
if ${ac_cv_lib_event_openssl_bufferevent_openssl_socket_new+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-levent_openssl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char bufferevent_openssl_socket_new ();
int
main ()
{
return bufferevent_openssl_socket_new ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_event_openssl_bufferevent_openssl_socket_new=yes
else
ac_cv_lib_event_openssl_bufferevent_openssl_socket_new=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_event_openssl_bufferevent_openssl_socket_new" >&5
$as_echo "$ac_cv_lib_event_openssl_bufferevent_openssl_socket_new" >&6; }
if test "x$ac_cv_lib_event_openssl_bufferevent_openssl_socket_new" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBEVENT_OPENSSL 1
_ACEOF
LIBS="-levent_openssl $LIBS"
else
as_fn_error $? "libevent_openssl missing" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL_init_ssl in -lssl" >&5
$as_echo_n "checking for OPENSSL_init_ssl in -lssl... " >&6; }
if ${ac_cv_lib_ssl_OPENSSL_init_ssl_+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lssl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char OPENSSL_init_ssl ();
int
main ()
{
return OPENSSL_init_ssl ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ssl_OPENSSL_init_ssl_=yes
else
ac_cv_lib_ssl_OPENSSL_init_ssl_=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_OPENSSL_init_ssl_" >&5
$as_echo "$ac_cv_lib_ssl_OPENSSL_init_ssl_" >&6; }
if test "x$ac_cv_lib_ssl_OPENSSL_init_ssl_" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSSL 1
_ACEOF
LIBS="-lssl $LIBS"
else
as_fn_error $? "libssl missing" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AES_encrypt in -lcrypto" >&5
$as_echo_n "checking for AES_encrypt in -lcrypto... " >&6; }
if ${ac_cv_lib_crypto_AES_encrypt+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcrypto $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char AES_encrypt ();
int
main ()
{
return AES_encrypt ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_crypto_AES_encrypt=yes
else
ac_cv_lib_crypto_AES_encrypt=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_AES_encrypt" >&5
$as_echo "$ac_cv_lib_crypto_AES_encrypt" >&6; }
if test "x$ac_cv_lib_crypto_AES_encrypt" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
LIBS="-lcrypto $LIBS"
else
as_fn_error $? "libcrypto missing" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for evhtp_new in -levhtp" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for evhtp_new in -levhtp" >&5
$as_echo_n "checking for evhtp_new in -levhtp... " >&6; } $as_echo_n "checking for evhtp_new in -levhtp... " >&6; }
if ${ac_cv_lib_evhtp_evhtp_new+:} false; then : if ${ac_cv_lib_evhtp_evhtp_new+:} false; then :
@ -4899,6 +5029,61 @@ else
as_fn_error $? "libevhtp missing" "$LINENO" 5 as_fn_error $? "libevhtp missing" "$LINENO" 5
fi fi
elif test "x${with_restconf}" == xno; then
# Cant get around "no" as an answer for --without-restconf that is reset here to undefined
with_restconf=
else
as_fn_error $? "No such restconf package: ${with_restconf}" "$LINENO" 5
fi
if test "x${with_restconf}" != "x"; then
# This is so it appears in config.h
cat >>confdefs.h <<_ACEOF
#define WITH_RESTCONF ${with_restconf}
_ACEOF
fi
# These are dummies just to get the help strings right
# Check whether --with-restconf was given.
if test "${with_restconf+set}" = set; then :
withval=$with_restconf;
fi
# Check whether --with-restconf was given.
if test "${with_restconf+set}" = set; then :
withval=$with_restconf;
fi
# Check whether --with-restconf was given.
if test "${with_restconf+set}" = set; then :
withval=$with_restconf;
fi
# Common actions for all restconf packages
if test "x${with_restconf}" != "x"; then
# This is for changing web user default www-data
# Check whether --with-wwwuser was given.
if test "${with_wwwuser+set}" = set; then :
withval=$with_wwwuser;
fi
if test "${with_wwwuser}"; then
wwwuser=${with_wwwuser}
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: www user is $wwwuser" >&5
$as_echo "www user is $wwwuser" >&6; }
cat >>confdefs.h <<_ACEOF
#define WWWUSER "$wwwuser"
_ACEOF
fi fi
# Set default config file location # Set default config file location

View file

@ -94,8 +94,6 @@ AC_SUBST(CLIXON_DEFAULT_CONFIG)
AC_SUBST(LIBS) AC_SUBST(LIBS)
AC_SUBST(SH_SUFFIX) AC_SUBST(SH_SUFFIX)
AC_SUBST(with_restconf) # If yes, compile apps/restconf AC_SUBST(with_restconf) # If yes, compile apps/restconf
AC_SUBST(with_libhttp) # If yes, use libhttp+restconf server (https://www.libhttp.org/)
AC_SUBST(with_evhtp) # If yes, use libevhp+restconf server (https://github.com/criticalstack/libevhtp)
AC_SUBST(enable_optyangs) AC_SUBST(enable_optyangs)
AC_SUBST(wwwdir,/www-data) AC_SUBST(wwwdir,/www-data)
AC_SUBST(wwwuser,www-data) AC_SUBST(wwwuser,www-data)
@ -147,7 +145,8 @@ fi
SH_SUFFIX=".so" SH_SUFFIX=".so"
# This is for cligen # This is for cligen
AC_ARG_WITH(cligen, [ --with-cligen=dir],[Use CLIGEN here ] ) AC_ARG_WITH([cligen],
AS_HELP_STRING([--with-cligen=dir],[Use CLIGEN installation in this dir]))
if test "${with_cligen}"; then if test "${with_cligen}"; then
echo "Using CLIGEN here: ${with_cligen}" echo "Using CLIGEN here: ${with_cligen}"
CPPFLAGS="-I${with_cligen}/include ${CPPFLAGS}" CPPFLAGS="-I${with_cligen}/include ${CPPFLAGS}"
@ -190,16 +189,51 @@ AC_CHECK_HEADERS(cligen/cligen.h,, AC_MSG_ERROR([CLIgen missing. Try: git clone
AC_CHECK_LIB(cligen, cligen_init,, AC_MSG_ERROR([CLIgen missing. Try: git clone https://github.com/olofhagsand/cligen.git])) AC_CHECK_LIB(cligen, cligen_init,, AC_MSG_ERROR([CLIgen missing. Try: git clone https://github.com/olofhagsand/cligen.git]))
# This is for restconf (and fastcgi) # This is for restconf. There are three options:
# --without-restconf No restconf support
# --with-restconf=fcgi FCGI interface for separate web reverse proxy like nginx
# --with-restconf=evhtp Integration with embedded web server libevhtp
# Real one
AC_ARG_WITH([restconf], AC_ARG_WITH([restconf],
[AS_HELP_STRING([--without-restconf],[disable support for restconf])], AS_HELP_STRING([--with-restconf=fcgi],[FCGI interface for stand-alone web rev-proxy eg nginx (default)]),
[], ,
[with_restconf=yes]) [with_restconf=fcgi])
if test "x${with_restconf}" == xyes; then
# Actions for each specific package
if test "x${with_restconf}" == xfcgi; then
# Lives in libfcgi-dev # Lives in libfcgi-dev
AC_CHECK_LIB(fcgi, FCGX_Init,, AC_MSG_ERROR([libfcgi-dev missing])) AC_CHECK_LIB(fcgi, FCGX_Init,, AC_MSG_ERROR([libfcgi-dev missing]))
elif test "x${with_restconf}" == xevhtp; then
AC_CHECK_HEADERS(evhtp/evhtp.h,, AC_MSG_ERROR([evhtp header missing. See https://github.com/criticalstack/libevhtp]))
#LIBS += -lpthread -levent -levent_openssl -lssl -lcrypto
AC_CHECK_LIB(pthread, pthread_create,, AC_MSG_ERROR([libpthread missing]))
AC_CHECK_LIB(event, event_init,, AC_MSG_ERROR([libevent missing]))
AC_CHECK_LIB(event_openssl, bufferevent_openssl_socket_new,, AC_MSG_ERROR([libevent_openssl missing]))
AC_CHECK_LIB(ssl, OPENSSL_init_ssl ,, AC_MSG_ERROR([libssl missing]))
AC_CHECK_LIB(crypto, AES_encrypt,, AC_MSG_ERROR([libcrypto missing]))
AC_CHECK_LIB(evhtp, evhtp_new,, AC_MSG_ERROR([libevhtp missing]),[-lpthread -levent -levent_openssl -lssl -lcrypto])
elif test "x${with_restconf}" == xno; then
# Cant get around "no" as an answer for --without-restconf that is reset here to undefined
with_restconf=
else
AC_MSG_ERROR([No such restconf package: ${with_restconf}])
fi fi
if test "x${with_restconf}" != "x"; then
# This is so it appears in config.h
AC_DEFINE_UNQUOTED(WITH_RESTCONF, ${with_restconf}, [Restconf package])
fi
# These are dummies just to get the help strings right
AC_ARG_WITH([restconf],
AS_HELP_STRING([--with-restconf=fcgi],[FCGI interface for stand-alone web rev-proxy eg nginx (default)]))
AC_ARG_WITH([restconf],
AS_HELP_STRING([--with-restconf=evhtp],[Integrate restconf with libevhtp server]))
AC_ARG_WITH([restconf],
AS_HELP_STRING([--without-restconf],[Disable restconf altogether]))
# Common actions for all restconf packages
if test "x${with_restconf}" != "x"; then
# This is for changing web user default www-data # This is for changing web user default www-data
AC_ARG_WITH([wwwuser], AC_ARG_WITH([wwwuser],
[AS_HELP_STRING([--with-wwwuser=<user>],[Set www user different from www-data])]) [AS_HELP_STRING([--with-wwwuser=<user>],[Set www user different from www-data])])
@ -208,30 +242,6 @@ if test "${with_wwwuser}"; then
fi fi
AC_MSG_RESULT(www user is $wwwuser) AC_MSG_RESULT(www user is $wwwuser)
AC_DEFINE_UNQUOTED(WWWUSER, "$wwwuser", [WWW user for restconf daemon]) AC_DEFINE_UNQUOTED(WWWUSER, "$wwwuser", [WWW user for restconf daemon])
# OBSOLETE: This is for libhttp server (https://www.libhttp.org/) to be used as restconf client
# Out-of-the box it comes as static lib .a
AC_ARG_WITH([libhttp],
[AS_HELP_STRING([--with-libhttp],[Use libhttp as restconf server])],
,
[with_libhttp=no])
if test "x${with_libhttp}" == xyes; then
AC_CHECK_HEADERS(libhttp/libhttp.h,, AC_MSG_ERROR([libhttp header missing. See https://www.libhttp.org]))
# In github repo default install this is a static lib
AC_CHECK_LIB(http, httplib_start,, AC_MSG_ERROR([libhttplib missing]),[-lpthread -ldl])
fi
# This is for libevhtp server (https://github.com/criticalstack/libevhtp)
AC_ARG_WITH([evhtp],
[AS_HELP_STRING([--with-evhtp],[Use evhtp as restconf server])],
,
[with_evhtp=no])
#echo "with_evhtp:${with_evhtp}"
if test "x${with_evhtp}" == xyes; then
AC_CHECK_HEADERS(evhtp/evhtp.h,, AC_MSG_ERROR([evhtp header missing. See https://github.com/criticalstack/libevhtp]))
AC_CHECK_LIB(evhtp, evhtp_new,, AC_MSG_ERROR([libevhtp missing]),[-lpthread -levent -levent_openssl -lssl -lcrypto])
fi fi
# Set default config file location # Set default config file location

View file

@ -24,6 +24,9 @@
/* Define to 1 if you have the <cligen/cligen.h> header file. */ /* Define to 1 if you have the <cligen/cligen.h> header file. */
#undef HAVE_CLIGEN_CLIGEN_H #undef HAVE_CLIGEN_CLIGEN_H
/* Define to 1 if you have the <evhtp/evhtp.h> header file. */
#undef HAVE_EVHTP_EVHTP_H
/* Define to 1 if you have the `getpeereid' function. */ /* Define to 1 if you have the `getpeereid' function. */
#undef HAVE_GETPEEREID #undef HAVE_GETPEEREID
@ -42,6 +45,9 @@
/* Define to 1 if you have the `dl' library (-ldl). */ /* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL #undef HAVE_LIBDL
/* Define to 1 if you have the `evhtp' library (-levhtp). */
#undef HAVE_LIBEVHTP
/* Define to 1 if you have the `fcgi' library (-lfcgi). */ /* Define to 1 if you have the `fcgi' library (-lfcgi). */
#undef HAVE_LIBFCGI #undef HAVE_LIBFCGI
@ -120,6 +126,9 @@
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
/* Restconf package */
#undef WITH_RESTCONF
/* WWW user for restconf daemon */ /* WWW user for restconf daemon */
#undef WWWUSER #undef WWWUSER