From: arnout Date: Wed, 27 Jul 2022 08:19:24 +0000 (+0200) Subject: Cross compile fixes (#4632) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=576c47f1ead3c30ed71762a8944cd2e7d9cd4b54;p=thirdparty%2Ffreeradius-server.git Cross compile fixes (#4632) * configure.ac: add option for libcap Signed-off-by: Jackie Huang Signed-off-by: Changqing Li Signed-off-by: David Gouarin Signed-off-by: Matt Weber Signed-off-by: Arnout Vandecappelle (Essensium/Mind) * configure.ac: allow cross-compilation The checking OpenSSL library and header version consistency will always fail in cross compiling, skip the check and give a warning instead for cross compiling. Signed-off-by: Jackie Huang Signed-off-by: Yi Zhao [update to new version 3.0.17 to fix patch warning] Signed-off-by: Changqing Li Signed-off-by: David Gouarin Signed-off-by: Matt Weber Signed-off-by: Arnout Vandecappelle (Essensium/Mind) * configure.ac: add option for pcap Signed-off-by: Arnout Vandecappelle (Essensium/Mind) * configure.ac: add option for collectdclient Signed-off-by: Arnout Vandecappelle (Essensium/Mind) * configure.ac: try execinfo in libc before searching libexecinfo execinfo is provided by glibc, so the usual case is that it is part of libc. Do this before starting a redundant search for libexecinfo. This is especially relevant for cross-compilation, where FR_SMART_CHECK_LIB can find an incompatible library. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Co-authored-by: Changqing Li --- diff --git a/configure.ac b/configure.ac index 2716a07791a..8e6614f3492 100644 --- a/configure.ac +++ b/configure.ac @@ -1135,50 +1135,100 @@ LIBS="$old_LIBS" dnl # dnl # Check for libpcap dnl # -smart_try_dir="$pcap_lib_dir" -FR_SMART_CHECK_LIB(pcap, pcap_open_live) -if test "x$ac_cv_lib_pcap_pcap_open_live" != "xyes"; then - AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=.]) -else - AC_CHECK_FUNCS(\ - pcap_fopen_offline \ - pcap_dump_fopen \ - pcap_create \ - pcap_activate - ) +dnl extra argument: --with-pcap=yes/no +WITH_PCAP=yes +AC_ARG_WITH(pcap, +[ --with-pcap use pcap library for the RADIUS sniffer. (default=yes)], +[ case "$withval" in + no) + WITH_PCAP=no + ;; + *) + WITH_PCAP=yes + ;; + esac ] +) + +if test "x$WITH_PCAP" = xyes; then + smart_try_dir="$pcap_lib_dir" + FR_SMART_CHECK_LIB(pcap, pcap_open_live) + if test "x$ac_cv_lib_pcap_pcap_open_live" != "xyes"; then + AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=.]) + else + AC_CHECK_FUNCS(\ + pcap_fopen_offline \ + pcap_dump_fopen \ + pcap_create \ + pcap_activate + ) - PCAP_LIBS="${smart_lib}" - PCAP_LDFLAGS="${smart_ldflags}" + PCAP_LIBS="${smart_lib}" + PCAP_LDFLAGS="${smart_ldflags}" + fi + dnl Set by FR_SMART_CHECK_LIB + LIBS="${old_LIBS}" fi -dnl Set by FR_SMART_CHECK_LIB -LIBS="${old_LIBS}" + +dnl extra argument: --with-collectdclient=yes/no +WITH_COLLECTDCLIENT=yes +AC_ARG_WITH(collectdclient, +[ --with-collectdclient use collectd client. (default=yes)], +[ case "$withval" in + no) + WITH_COLLECTDCLIENT=no + ;; + *) + WITH_COLLECTDCLIENT=yes + ;; + esac ] +) dnl # dnl # Check for collectdclient dnl # -smart_try_dir="$collectdclient_lib_dir" -FR_SMART_CHECK_LIB(collectdclient, lcc_connect) -if test "x$ac_cv_lib_collectdclient_lcc_connect" != "xyes"; then - AC_MSG_WARN([collectdclient library not found. Use --with-collectdclient-lib-dir=.]) -else - COLLECTDC_LIBS="${smart_lib}" - COLLECTDC_LDFLAGS="${smart_ldflags}" +if test "x$WITH_COLLECTDCLIENT" = xyes; then + smart_try_dir="$collectdclient_lib_dir" + FR_SMART_CHECK_LIB(collectdclient, lcc_connect) + if test "x$ac_cv_lib_collectdclient_lcc_connect" != "xyes"; then + AC_MSG_WARN([collectdclient library not found. Use --with-collectdclient-lib-dir=.]) + else + COLLECTDC_LIBS="${smart_lib}" + COLLECTDC_LDFLAGS="${smart_ldflags}" + fi + dnl Set by FR_SMART_CHECKLIB + LIBS="${old_LIBS}" fi -dnl Set by FR_SMART_CHECKLIB -LIBS="${old_LIBS}" + +dnl # +dnl # extra argument: --with-libcap +dnl # +WITH_LIBCAP=yes +AC_ARG_WITH(libcap, +[ --with-libcap use libcap for debugger checks. (default=yes)], +[ case "$withval" in + no) + WITH_LIBCAP=no + ;; + *) + WITH_LIBCAP=yes + ;; + esac ] +) dnl # dnl # Check for cap (Linux capabilities) dnl # -smart_try_dir="$cap_lib_dir" -FR_SMART_CHECK_LIB(cap, cap_get_proc) -if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then - AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=.]) -else - AC_DEFINE(HAVE_LIBCAP, 1, - [Define to 1 if you have the `cap' library (-lcap).] - ) - HAVE_LIBCAP=1 +if test "x$WITH_LIBCAP" = xyes; then + smart_try_dir="$cap_lib_dir" + FR_SMART_CHECK_LIB(cap, cap_get_proc) + if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then + AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=.]) + else + AC_DEFINE(HAVE_LIBCAP, 1, + [Define to 1 if you have the `cap' library (-lcap).] + ) + HAVE_LIBCAP=1 + fi fi dnl # @@ -2108,26 +2158,26 @@ dnl # smart_try_dir=$execinfo_include_dir FR_SMART_CHECK_INCLUDE(execinfo.h) if test "x$ac_cv_header_execinfo_h" = "xyes"; then - smart_try_dir=$execinfo_lib_dir - FR_SMART_CHECK_LIB(execinfo, backtrace_symbols) + dnl # Might be provided as part of libc + AC_MSG_CHECKING([if execinfo provided as part of libc]) + AC_TRY_LINK( + [ + #include + ], + [ + void *sym[1]; + backtrace_symbols(&sym, sizeof(sym)) ], + [ + AC_MSG_RESULT(yes) + ac_cv_lib_execinfo_backtrace_symbols="yes" + ], + [ + AC_MSG_RESULT(no) + ] + ) if test "x$ac_cv_lib_execinfo_backtrace_symbols" != "xyes"; then - dnl # Might be provided as part of libc - AC_MSG_CHECKING([if execinfo provided as part of libc]) - AC_TRY_LINK( - [ - #include - ], - [ - void *sym[1]; - backtrace_symbols(&sym, sizeof(sym)) ], - [ - AC_MSG_RESULT(yes) - ac_cv_lib_execinfo_backtrace_symbols="yes" - ], - [ - AC_MSG_RESULT(no) - ] - ) + smart_try_dir=$execinfo_lib_dir + FR_SMART_CHECK_LIB(execinfo, backtrace_symbols) fi if test "x$ac_cv_lib_execinfo_backtrace_symbols" = "xyes"; then diff --git a/src/modules/rlm_krb5/configure.ac b/src/modules/rlm_krb5/configure.ac index 2f2b257100a..c7fac3584f8 100644 --- a/src/modules/rlm_krb5/configure.ac +++ b/src/modules/rlm_krb5/configure.ac @@ -141,7 +141,8 @@ if test x$with_[]modname != xno; then FR_SMART_CHECK_LIB(krb5, krb5_is_thread_safe) if test "x$ac_cv_lib_krb5_krb5_is_thread_safe" = xyes; then AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include ]], [[return krb5_is_thread_safe() ? 0 : 1]])], - [krb5threadsafe="-DKRB5_IS_THREAD_SAFE"], [AC_MSG_WARN([[libkrb5 is not threadsafe]])]) + [krb5threadsafe="-DKRB5_IS_THREAD_SAFE"], [AC_MSG_WARN([[libkrb5 is not threadsafe]])], + [AC_MSG_WARN(cross compiling: not checking)]) fi else krb5threadsafe=""