From 8d00af005f2388abe700c7d6409d03c977c29cb0 Mon Sep 17 00:00:00 2001 Message-Id: <8d00af005f2388abe700c7d6409d03c977c29cb0.1714810220.git.mdw@distorted.org.uk> From: Mark Wooding Date: Tue, 12 Jun 2018 11:21:17 +0100 Subject: [PATCH] configure.ac: Hack around Termux syslog weirdness. Organization: Straylight/Edgeware From: Mark Wooding Termux's has weird macros to redirect to Android's logcat machinery, but these need a separate library to be linked in. Notice this weirdness and cope. --- configure.ac | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/configure.ac b/configure.ac index b1037ae..bb7eb4b 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,29 @@ AC_CHECK_FUNCS([setgroups]) AC_CHECK_FUNCS([getnetbyname]) AC_CHECK_FUNCS([strsignal]) +dnl Logging is weird under Termux. Unfortunately, it involves macros, so we +dnl have to do this the hard way. +AC_CACHE_CHECK( + [library needed for syslog], [mdw_cv_syslog_lib], + [mdw_ORIG_LIBS=$LIBS LIBS= + for i in 0 1; do + AC_TRY_LINK([#include ], + [openlog("test", LOG_PID, LOG_DAEMON); + syslog(LOG_ERR, "this is a test");], + [ok=t], [ok=nil]) + case $i,$ok in + *,t) mdw_cv_syslog_lib=${LIBS:-none}; break ;; + 0,nil) LIBS="-llog" ;; + 1,nil) AC_MSG_ERROR("failed to link test program") ;; + esac + done + LIBS=$mdw_ORIG_LIBS]) +case $mdw_cv_syslog_lib in + none) ;; + *) LIBS="$LIBS $mdw_cv_syslog_lib" ;; +esac +AC_SUBST([LOGLIBS]) + dnl-------------------------------------------------------------------------- dnl Output. -- [mdw]