]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Add configure option to independently enable/disable link-time optimization
authorIgor Putovny <igor.putovny@nic.cz>
Fri, 9 May 2025 17:56:24 +0000 (19:56 +0200)
committerMaria Matejka <mq@ucw.cz>
Sat, 10 May 2025 14:56:27 +0000 (16:56 +0200)
configure.ac

index 9793f6d33df0b076e088847c1111fa3ac6b353a3..be8e6716da232256355df037a86e0d859faaf074 100644 (file)
@@ -18,6 +18,12 @@ AC_ARG_ENABLE([debug],
   [enable_debug=no]
 )
 
+AC_ARG_ENABLE([lto],
+  [AS_HELP_STRING([--enable-lto], [enable link-time optimization @<:@no@:>@])],
+  [],
+  [enable_lto=auto]
+)
+
 AC_ARG_ENABLE([debug-generated],
   [AS_HELP_STRING([--enable-debug-generated], [enable this to abstain from generating #line @<:@no@:>@])],
   [],
@@ -149,8 +155,15 @@ if test "$bird_cflags_default" = yes ; then
   BIRD_CHECK_GCC_OPTION([bird_cv_c_option_wno_missing_init], [-Wno-missing-field-initializers], [-Wall -Wextra])
   BIRD_CHECK_GCC_OPTION([bird_cv_c_option_watomic_implicit_seq_cst], [-Watomic-implicit-seq-cst], [-Wall -Wextra])
 
-  if test "$enable_debug" = no; then
+  if test "$enable_lto" = no || (test "$enable_debug" = yes && test "$enable_lto" = auto); then
+    # LTO is not configured at all
+    true
+  else
     BIRD_CHECK_LTO
+
+    if test "$enable_lto" = yes && test "$bird_cv_c_lto" = no; then
+      AC_MSG_ERROR([LTO not available.])
+    fi
   fi
 
   if test "$bird_cv_c_lto" = yes; then
@@ -508,6 +521,7 @@ AC_MSG_RESULT([        Object directory:    $objdir])
 AC_MSG_RESULT([        Iproute2 directory:     $iproutedir])
 AC_MSG_RESULT([        System configuration:   $sysdesc])
 AC_MSG_RESULT([        Debugging:              $enable_debug])
+AC_MSG_RESULT([        Link-time optimization: $enable_lto])
 AC_MSG_RESULT([        Compact tries:          $enable_compact_tries])
 AC_MSG_RESULT([        Routing protocols:      $protocols])
 AC_MSG_RESULT([        LibSSH support in RPKI: $enable_libssh])