[Libguestfs] [PATCH nbdkit v2 2/5] configure: Reorganise USE_LINKER_SCRIPT_FOR_SERVER conditional

Richard W.M. Jones
2022-04-07T09:42:46Z

There will be several reasons for disabling the linker script for
nbdkit (in forthcoming patches).  Make the
use_linker_script_for_server variable into a "global" (top level).
Move the AM_CONDITIONAL that checks this variable later.

This is just refactoring.
---
 configure.ac | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index f86215d9..81c75fda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -502,17 +502,19 @@ main (int argc, char *argv[])
     ])
 AM_CONDITIONAL([HAVE_ICONV], [test "x$iconv_working" =
"xyes"])

+use_linker_script_for_server=yes
+
 dnl Don't use linker script for the server on FreeBSD because
 dnl FreeBSD's linker is broken.  See eg:
 dnl https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190851
-AC_MSG_CHECKING([if we should use a linker script for the server])
+AC_MSG_CHECKING([if we should disable the linker script (FreeBSD only)])
 AS_CASE([$host_os],
-  [freebsd*], [use_linker_script_for_server=no],
-  [use_linker_script_for_server=yes]
+  [freebsd*], [
+      use_linker_script_for_server=no
+      AC_MSG_RESULT([yes])
+  ],
+  [AC_MSG_RESULT([no])]
 )
-AC_MSG_RESULT([$use_linker_script_for_server])
-AM_CONDITIONAL([USE_LINKER_SCRIPT_FOR_SERVER],
-               [test "x$use_linker_script_for_server" =
"xyes"])

 dnl Check if -rdynamic linker flag works.
 acx_nbdkit_save_LDFLAGS="${LDFLAGS}"
@@ -694,6 +696,9 @@ AS_IF([test "x$enable_libfuzzer" =
"xyes"],[
 ])
 AM_CONDITIONAL([ENABLE_LIBFUZZER],[test "x$enable_libfuzzer" =
"xyes"])

+AM_CONDITIONAL([USE_LINKER_SCRIPT_FOR_SERVER],
+               [test "x$use_linker_script_for_server" =
"xyes"])
+
 dnl Bash completion.
 PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [
     bash_completion=yes
@@ -1419,6 +1424,8 @@ feature "bash-completion ........................
" \
         test "x$HAVE_BASH_COMPLETION_TRUE" = "x"
 feature "libfuzzer .............................. " \
         test "x$ENABLE_LIBFUZZER_TRUE" = "x"
+feature "linker script .......................... " \
+        test "x$USE_LINKER_SCRIPT_FOR_SERVER_TRUE" = "x"
 feature "manual pages ........................... " \
         test "x$HAVE_POD_TRUE" = "x"
 feature "SELinux ................................ " \
--
2.35.1