Check if the "-flto" link time optimzation flag is available.

[CONFIGURATION]
* BUG: Check if the "-flto" link time optimzation flag is available.
This commit is contained in:
gambas 2018-05-08 18:44:31 +02:00
parent 85376261ea
commit 14614f4e67
2 changed files with 16 additions and 3 deletions

View file

@ -322,6 +322,18 @@ AC_DEFUN([GB_INIT],
AC_DEFINE(HAVE_GCC_VISIBILITY, 1, [Whether gcc supports -fvisibility=hidden])
fi
dnl ---- check for -flto compiler flag
GB_CFLAGS_GCC_OPTION([-flto],,
[
GB_CFLAGS_LTO=" -flto"
have_gcc_lto=yes
])
if test "$have_gcc_lto" = "yes"; then
AC_DEFINE(HAVE_GCC_LTO, 1, [Whether gcc supports -flto])
fi
dnl ---- Debug flags
if test "$gambas_debug" = "yes"; then
@ -350,6 +362,7 @@ AC_DEFUN([GB_INIT],
AC_SUBST(AM_CFLAGS_OPT)
AC_SUBST(AM_CXXFLAGS)
AC_SUBST(AM_CXXFLAGS_OPT)
AC_SUBST(GB_CFLAGS_LTO)
rm -f DISABLED DISABLED.*
])

View file

@ -1,5 +1,5 @@
AM_CFLAGS += -I$(top_srcdir)/share @INTL_INC@ @CONV_INC@ @GBX_THREAD_INC@ @FFI_INC@
AM_CFLAGS_OPT += -I$(top_srcdir)/share
AM_CFLAGS += $(GB_CFLAGS_LTO) -I$(top_srcdir)/share @INTL_INC@ @CONV_INC@ @GBX_THREAD_INC@ @FFI_INC@
AM_CFLAGS_OPT += $(GB_CFLAGS_LTO) -I$(top_srcdir)/share
bin_PROGRAMS = gbx3
noinst_LIBRARIES = libgbx.a
@ -9,7 +9,7 @@ libgbx_a_CFLAGS = -DGAMBAS_PATH="\"$(bindir)\"" $(AM_CFLAGS_OPT)
gbx3_LDADD = @C_LIB@ @GBX_THREAD_LIB@ libgbx.a @MATH_LIB@ @INTL_LIB@ @CONV_LIB@ @GETTEXT_LIB@ @DL_LIB@ @FFI_LIB@ @RT_LIB@
gbx3_LDFLAGS = @LD_FLAGS@ @GBX_THREAD_LDFLAGS@ @INTL_LDFLAGS@ @CONV_LDFLAGS@ @GETTEXT_LDFLAGS@ @FFI_LDFLAGS@ @RT_LDFLAGS@
gbx3_CFLAGS = -DGAMBAS_PATH="\"$(bindir)\"" $(AM_CFLAGS) -flto
gbx3_CFLAGS = -DGAMBAS_PATH="\"$(bindir)\"" $(AM_CFLAGS)
gb_la_LIBADD = @C_LIB@ @GBX_THREAD_LIB@ @MATH_LIB@ @INTL_LIB@ @CONV_LIB@ @GETTEXT_LIB@ @DL_LIB@ @FFI_LIB@ @RT_LIB@
gb_la_LDFLAGS = -module @LD_FLAGS@ @INTL_LDFLAGS@ @CONV_LDFLAGS@ @GETTEXT_LDFLAGS@ @FFI_LDFLAGS@ @RT_LDFLAGS@