--- parser3/configure.ac 2026/09/27 13:14:56 1.76 +++ parser3/configure.ac 2026/10/22 16:08:24 1.90 @@ -59,6 +59,34 @@ AC_MSG_RESULT($dll_extension) AC_SUBST(dll_extension) +dnl Checks for libraries +case "$host" in + *-freebsd4*) + AC_DEFINE(FREEBSD4,,FreeBSD4.X target platform) + ;; + *-freebsd1*) + AC_DEFINE(FREEBSD1X,,FreeBSD1X.X target platform) + ;; + *-sunos5.6* | *-solaris2.6*) + AC_CHECK_LIB(xnet, main) + ;; + *-sunos5* | *-solaris2*) + AC_CHECK_LIB(socket, main) + AC_CHECK_LIB(nsl, main) + ;; + *-nec-sysv4*) + AC_CHECK_LIB(nsl, gethostbyname) + AC_CHECK_LIB(socket, socket) + ;; + *-cygwin*) + AC_DEFINE(WIN32,,Windows32 target platform) + ;; +esac + +AC_CHECK_LIB(m, sin) +AC_CHECK_LIB(crypt, crypt) + + dnl Misc arguments AC_ARG_WITH(build-warnings, [ --with-build-warnings to enable build-time compiler warnings if gcc is used], AC_MSG_WARN(enabling compiler warnings) @@ -353,10 +381,13 @@ AC_ARG_WITH(amqp,[ --with-amqp=DIR AMQP_INCLUDES="" AMQP_LIBS="-lrabbitmq" AC_MSG_WARN([--with-amqp value was not specified, hoping linker would find it]) + + dnl SSL with the system librabbitmq only: it brings OpenSSL as its dependency + AC_CHECK_HEADER([amqp_ssl_socket.h],[AC_DEFINE([WITH_AMQP_SSL],,[librabbitmq with SSL support])]) else AMQP_INCLUDES="-I$AMQP/include" - if test -f $AMQP/lib/librabbitmq.la; then - AMQP_LIBS="$AMQP/lib/librabbitmq.la" + if test -f $AMQP/lib/librabbitmq.a; then + AMQP_LIBS="$AMQP/lib/librabbitmq.a" else AMQP_LIBS="-L$AMQP/lib -lrabbitmq" fi @@ -364,7 +395,7 @@ AC_ARG_WITH(amqp,[ --with-amqp=DIR AC_MSG_CHECKING(for librabbitmq) SAVE_LIBS=$LIBS - LIBS="$LIBS $AMQP_LIBS $AMQP_INCLUDES" + LIBS="$AMQP_LIBS $AMQP_INCLUDES $LIBS" PA_TRY_LINK([ #include ],[ amqp_connection_state_t c = 0; ], AC_MSG_RESULT(yes) , @@ -382,6 +413,51 @@ AC_ARG_WITH(amqp,[ --with-amqp=DIR AC_SUBST(AMQP_INCLUDES) AC_SUBST(AMQP_LIBS) + +dnl Redis library argument +AC_ARG_WITH(redis,[ --with-redis=DIR DIR is the directory where + Redis C library (hiredis) is installed],[ + REDIS=$withval + + if test -z "$REDIS" -o "$REDIS" = "yes"; then + REDIS_INCLUDES="" + REDIS_LIBS="-lhiredis" + AC_MSG_WARN([--with-redis value was not specified, hoping linker would find it]) + + dnl SSL with the system hiredis_ssl only: it brings OpenSSL as its dependency + AC_CHECK_HEADER([hiredis/hiredis_ssl.h],[ + AC_DEFINE(WITH_REDIS_SSL,,hiredis with SSL support) + REDIS_LIBS="-lhiredis_ssl $REDIS_LIBS" + ],,[#include ]) + else + REDIS_INCLUDES="-I$REDIS/include" + if test -f $REDIS/lib/libhiredis.a; then + REDIS_LIBS="$REDIS/lib/libhiredis.a" + else + REDIS_LIBS="-L$REDIS/lib -lhiredis" + fi + fi + + AC_MSG_CHECKING(for hiredis) + SAVE_LIBS=$LIBS + LIBS="$REDIS_LIBS $REDIS_INCLUDES $LIBS" + PA_TRY_LINK([ #include ],[ redisContext *c = redisConnect("", 0); ], + AC_MSG_RESULT(yes) + , + AC_MSG_RESULT(no) + if test -z "$REDIS"; then + AC_MSG_ERROR(please specify path to hiredis: --with-redis=DIR) + else + AC_MSG_ERROR($REDIS does not seem to be valid hiredis installation directory) + fi + ) + LIBS=$SAVE_LIBS + AC_DEFINE(WITH_REDIS,,has redis) +]) + +AC_SUBST(REDIS_INCLUDES) +AC_SUBST(REDIS_LIBS) + dnl Sendmail argument AC_ARG_WITH(sendmail,[ \"--with-sendmail=COMMAND\" forces this command to send mail. example: \"--with-sendmail=/usr/sbin/sendmail -t\" @@ -453,34 +529,6 @@ AC_CHECK_HEADERS(errno.h dirent.h fcntl. AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h netdb.h) -dnl Checks for libraries -case "$host" in - *-freebsd4*) - AC_DEFINE(FREEBSD4,,FreeBSD4.X target platform) - ;; - *-freebsd1*) - AC_DEFINE(FREEBSD1X,,FreeBSD1X.X target platform) - ;; - *-sunos5.6* | *-solaris2.6*) - AC_CHECK_LIB(xnet, main) - ;; - *-sunos5* | *-solaris2*) - AC_CHECK_LIB(socket, main) - AC_CHECK_LIB(nsl, main) - ;; - *-nec-sysv4*) - AC_CHECK_LIB(nsl, gethostbyname) - AC_CHECK_LIB(socket, socket) - ;; - *-cygwin*) - AC_DEFINE(WIN32,,Windows32 target platform) - ;; -esac - -AC_CHECK_LIB(m, sin) -AC_CHECK_LIB(crypt, crypt) - - dnl Checks for functions AC_CHECK_FUNCS(flock fcntl lockf ftruncate fchmod) AC_CHECK_FUNCS(getrusage gettimeofday crypt sigsetjmp siglongjmp unsetenv syslog)