@@ -148,6 +148,19 @@ AC_MSG_RESULT([${CONFIG_FLAGS}])
148148AC_DEFINE_UNQUOTED ( [ CONFIG_FLAGS] ,[ "${CONFIG_FLAGS}"] ,[ Flags passed to configure script] )
149149AC_SUBST ( CONFIG_FLAGS )
150150
151+ dnl Some versions of ccache take poorly to an exported empty CCACHE_DIR etc.
152+ dnl ccache: error: CCACHE_DIR must not be the empty string
153+ dnl and this breaks "checking for C compiler version" in a standard step below
154+ AS_IF ( [ set | ${EGREP} '^CCACHE_DIR(=|=""|='"''"')$'] , [
155+ AC_MSG_NOTICE ( [ Unsetting a provided but empty CCACHE_DIR environment variable] )
156+ AS_UNSET ( [ CCACHE_DIR] )
157+ ] )
158+
159+ AS_IF ( [ set | ${EGREP} '^CCACHE_PATH(=|=""|='"''"')$'] , [
160+ AC_MSG_NOTICE ( [ Resetting a provided but empty CCACHE_PATH environment variable to current PATH] )
161+ CCACHE_PATH="${PATH}"
162+ ] )
163+
151164AC_CHECK_PROGS ( [ MKTEMP] , [ mktemp] , [ ] )
152165AS_IF ( [ test x"${MKTEMP}" = x] , [
153166dnl # Have a simple (unsafe, unfeatured) fallback implementation:
@@ -260,7 +273,14 @@ dnl But OpenBSD 6.5 requires autoconf-2.65 and automake-1.13 or newer...
260273AS_IF ( [ test x"${nut_enable_configure_debug}" = xyes] , [
261274 AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) CFLAGS_BEFORE_ACPROG="${CFLAGS-}"] )
262275 AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) CXXFLAGS_BEFORE_ACPROG="${CXXFLAGS-}"] )
276+ dnl Find and report the location of attempted compiler
277+ dnl (maybe wrapped with something like ccache, distcc, etc.)
278+ AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) PATH='${PATH}'] )
279+ AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) CCACHE_PATH='${CCACHE_PATH}'] )
280+ AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) Compiler location: CC: '${CC}' => '`command -v ${CC}`'] )
281+ AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) Compiler location: CXX: '${CXX}' => '`command -v ${CXX}`'] )
263282] )
283+
264284AC_MSG_CHECKING ( for autoconf macro to enable system extensions )
265285m4_version_prereq ( 2.61 , [
266286 AC_MSG_RESULT ( yes )
@@ -278,6 +298,9 @@ dnl Macro AC_PROG_CC_C99 is obsolete; use AC_PROG_CC
278298dnl Note that NUT does not support building with C89 anyway
279299dnl AC_PROG_CC_C99
280300dnl Needed for per-target flags
301+ dnl NOTE: The AM macro below wraps its AC name-sake to perform
302+ dnl additional tricks needed for automake. There seems to not be
303+ dnl a CXX variant of that however, or at least not ubiquitoisly.
281304AM_PROG_CC_C_O
282305AC_PROG_CPP
283306AC_PROG_CXX
@@ -2297,6 +2320,22 @@ printf("%ld ", GetAdaptersInfo(buf, &bufsz))
22972320AC_SUBST ( [ NETLIBS_GETADDRS] )
22982321AC_CACHE_VAL ( [ nut_cv_var_NETLIBS_GETADDRS] , [ nut_cv_var_NETLIBS_GETADDRS="${NETLIBS_GETADDRS}"] )
22992322
2323+ dnl ----------------------------------------------------------------------
2324+ dnl Simple check that it exists and can be executed
2325+ AC_PATH_PROGS ( [ PERL] , perl , [ none] )
2326+ AS_IF ( [ test x"${PERL}" != xnone] , [
2327+ AC_MSG_CHECKING ( [ whether PERL interpreter is basically usable: '${PERL}'] )
2328+ AS_IF ( [ ${PERL} -e 1 >/dev/null] , [
2329+ AC_MSG_RESULT ( [ yes] )
2330+ ] , [
2331+ AC_MSG_RESULT ( [ no] )
2332+ PERL=none
2333+ ] )
2334+ ] )
2335+
2336+ AC_SUBST ( [ PERL] )
2337+ AM_CONDITIONAL([ HAVE_PERL] , [ test x"$PERL" != xnone] )
2338+
23002339dnl ----------------------------------------------------------------------
23012340dnl First remember if caller wants a custom Python package location?
23022341NUT_ARG_WITH([ python-modules-dir] , [ install the PyNUT module files under specified path for default Python interpreter (auto for its reported site-packages location, if not with UI app)] , [ auto] )
@@ -4263,14 +4302,18 @@ dnl not fail if we have no tools to generate it (so add to SKIP list).
42634302
42644303 esac
42654304done
4266- rm -rf "${DOCTESTDIR}"
42674305
42684306AS_IF ( [ test x"${nut_enable_configure_debug}" = xyes] , [
42694307 AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) DOC_BUILD_LIST: '${DOC_BUILD_LIST}'] )
42704308 AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) DOC_CANNOTBUILD_LIST: '${DOC_CANNOTBUILD_LIST}'] )
42714309 AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) DOC_SKIPBUILD_LIST: '${DOC_SKIPBUILD_LIST}'] )
42724310 AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) DOC_INSTALL_DISTED_MANS: '${DOC_INSTALL_DISTED_MANS}'] )
42734311 AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) DOC_INSTALL_SELECTED_MANS: '${DOC_INSTALL_SELECTED_MANS}'] )
4312+ AC_MSG_NOTICE ( [ (CONFIGURE-DEVEL-DEBUG) This script's DOCTESTDIR: '${DOCTESTDIR}'] )
4313+ ] ,[
4314+ dnl If we are debugging, and doc generation fails, we want the directory
4315+ dnl else remove it later (after confirming success) below
4316+ rm -rf "${DOCTESTDIR}"
42744317] )
42754318
42764319case "${nut_with_doc}" in
@@ -4315,6 +4358,11 @@ AM_CONDITIONAL(WITH_PDF_NONASCII_TITLES, [test x"$can_build_doc_pdf_nonascii_tit
43154358NUT_REPORT_FEATURE([ would build specific documentation format ( s ) ] , [ ${nut_with_doc}] , [ ${DOC_BUILD_LIST} ${DOC_INSTALL_SELECTED_MANS}] ,
43164359 [ WITH_DOCS] , [ Define to enable overall documentation generation] , [ -] )
43174360
4361+ AS_IF ( [ test x"${nut_enable_configure_debug}" = xyes] , [
4362+ dnl Delayed clean-up after success of desired doc types:
4363+ rm -rf "${DOCTESTDIR}"
4364+ ] )
4365+
43184366# To cater for less portable make's, precalculate the target list
43194367# for "make check" in "docs/" here...
43204368DOC_CHECK_LIST=""
@@ -6627,18 +6675,20 @@ dnl # -Wno-c11-extensions -- clang-21 on Ubuntu 26.04 at least complains a lot
66276675dnl # about system headers (string.h, cdefs.h, etc.) using __glibc_const_generic
66286676dnl # -Wno-used-but-marked-unused -- openssl and clang do not always agree...
66296677dnl # -Wno-thread-safety-negative -- clang bug, it seems (https://reviews.llvm.org/D84604)
6678+ dnl # -Wno-unused-command-line-argument -- avoid the likes of (clang++)
6679+ dnl # error: argument unused during compilation: '-pthread'
66306680AS_CASE ( [ "${nut_enable_warnings}"] ,
66316681 [ all] , [
66326682 CFLAGS="${CFLAGS} -Wall"
66336683 CXXFLAGS="${CXXFLAGS} -Wall"
66346684 ] ,
66356685 [ clang-hard] , [
6636- CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c11-extensions -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-thread-safety-negative"
6637- CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-thread-safety-negative"
6686+ CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c11-extensions -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-thread-safety-negative -Wno-unused-command-line-argument "
6687+ CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-thread-safety-negative -Wno-unused-command-line-argument "
66386688 ] ,
66396689 [ clang-medium] , [
6640- CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c11-extensions -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-float-conversion -Wno-double-promotion -Wno-implicit-float-conversion -Wno-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-incompatible-function-pointer-types-strict -Wno-nullable-to-nonnull-conversion -Wno-used-but-marked-unused -Wno-thread-safety-negative"
6641- CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-global-constructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-nullable-to-nonnull-conversion -Wno-used-but-marked-unused -Wno-thread-safety-negative"
6690+ CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c11-extensions -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-float-conversion -Wno-double-promotion -Wno-implicit-float-conversion -Wno-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-incompatible-function-pointer-types-strict -Wno-nullable-to-nonnull-conversion -Wno-used-but-marked-unused -Wno-thread-safety-negative -Wno-unused-command-line-argument "
6691+ CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-global-constructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-nullable-to-nonnull-conversion -Wno-used-but-marked-unused -Wno-thread-safety-negative -Wno-unused-command-line-argument "
66426692 ] ,
66436693 [ clang-minimal] , [
66446694 CFLAGS="${CFLAGS} -ferror-limit=0 -Wall -Wextra -Wno-documentation -Wno-documentation-unknown-command -fcomment-block-commands=retval"
@@ -7028,8 +7078,9 @@ AC_ARG_VAR(CCACHE_DIR)
70287078AC_ARG_VAR ( CCACHE_PATH )
70297079
70307080dnl Some versions of ccache take poorly to an exported empty CCACHE_DIR etc.
7031- dnl Avoid exporting them if not set at the configure time (assuming ci_build.sh
7032- dnl integration or user's shell profile sets them persistently)
7081+ dnl ccache: error: CCACHE_DIR must not be the empty string
7082+ dnl Avoid exporting them if NOT set at the configure time (assuming ci_build.sh
7083+ dnl integration or user's shell profile sets them persistently... or empty)
70337084AS_IF ( [ test x"${CCACHE_NAMESPACE-}" = x] , [ NUT_AM_EXPORT_CCACHE_NAMESPACE="#"] , [ NUT_AM_EXPORT_CCACHE_NAMESPACE=""] )
70347085AC_SUBST ( NUT_AM_EXPORT_CCACHE_NAMESPACE )
70357086AS_IF ( [ test x"${CCACHE_BASEDIR-}" = x] , [ NUT_AM_EXPORT_CCACHE_BASEDIR="#"] , [ NUT_AM_EXPORT_CCACHE_BASEDIR=""] )
0 commit comments