DFLAGS += $(REQUIRE_NLS)
endif
+ifndef LTO
+LTO = @LTO@
+endif
+ifndef GCC_AR
+GCC_AR = @GCC_AR@
+endif
+ifeq ($(LTO),y)
+AR = $(GCC_AR)
+CFLAGS += -flto
+LD = gcc
+LDFLAGS += $(CFLAGS)
+endif
+
ifndef INSTALL_CRON
INSTALL_CRON = @INSTALL_CRON@
endif
--- /dev/null
+
+Link Time Optimization (LTO) gives the compiler the opportunity to optimize
+as a single module all the different compilation units that make up a single
+executable. The downside is an increased compile time.
+Answer y to compile sysstat commands with link time optimizations.
+The default answer is n (no).
+
compressafter
HISTORY
history
+LTO
+GCC_AR
NLS
LFINTL
SYSCONFIG_FILE
enable_sensors
enable_largefile
enable_nls
+enable_lto
enable_file_attr
enable_compress_manpg
enable_clean_sa_dir
--disable-sensors disable sensors support
--disable-largefile omit support for large files
--disable-nls disable National Language Support
+ --enable-lto enable Link Time Optimization
--disable-file-attr do not set attributes on files being installed
--disable-compress-manpg
do not compress sysstat manual pages
# --disable-stripping do not strip object files
# --enable-copy-only only copy files when installing sysstat
# --enable-use-crond use standard cron daemon
+# --enable-lto compile with Link Time Optimizations
#
# Some influential environment variables:
# rcdir directory where startup scripts are installed
fi
+# Link Time Optimization
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Link Time Optimization support" >&5
+$as_echo_n "checking Link Time Optimization support... " >&6; }
+# Check whether --enable-lto was given.
+if test "${enable_lto+set}" = set; then :
+ enableval=$enable_lto; AUX_LTO=$enableval
+else
+ AUX_LTO=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AUX_LTO" >&5
+$as_echo "$AUX_LTO" >&6; }
+LTO="n"
+if test $AUX_LTO = "yes"; then
+ # Extract the first word of "gcc-ar", so it can be a program name with args.
+set dummy gcc-ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_GCC_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$GCC_AR"; then
+ ac_cv_prog_GCC_AR="$GCC_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_GCC_AR="gcc-ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+GCC_AR=$ac_cv_prog_GCC_AR
+if test -n "$GCC_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCC_AR" >&5
+$as_echo "$GCC_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test x$GCC_AR != x"gcc-ar"; then
+ echo "WARNING: gcc-ar command not found! Disabling LTO support"
+ AUX_LTO="no"
+ else
+ LTO="y"
+ fi
+fi
+
+
# Data history to keep by sa2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking number of daily data files to keep" >&5
$as_echo_n "checking number of daily data files to keep... " >&6; }
# --disable-stripping do not strip object files
# --enable-copy-only only copy files when installing sysstat
# --enable-use-crond use standard cron daemon
+# --enable-lto compile with Link Time Optimizations
#
# Some influential environment variables:
# rcdir directory where startup scripts are installed
fi
AC_SUBST(NLS)
+# Link Time Optimization
+AC_MSG_CHECKING(Link Time Optimization support)
+AC_ARG_ENABLE(lto,
+ AC_HELP_STRING([--enable-lto],
+ [enable Link Time Optimization]),
+ AUX_LTO=$enableval,AUX_LTO=no)
+AC_MSG_RESULT($AUX_LTO)
+LTO="n"
+if test $AUX_LTO = "yes"; then
+ AC_CHECK_PROG(GCC_AR, gcc-ar, gcc-ar)
+ if test x$GCC_AR != x"gcc-ar"; then
+ echo "WARNING: gcc-ar command not found! Disabling LTO support"
+ AUX_LTO="no"
+ else
+ LTO="y"
+ fi
+fi
+AC_SUBST(LTO)
+
# Data history to keep by sa2
AC_MSG_CHECKING(number of daily data files to keep)
AC_ARG_VAR([history],[number of daily data files to keep (default value is 7)])
then
make distclean
./configure sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests --enable-debuginfo
+elif [ "$1" = "conflto" ]
+then
+ make distclean
+ ./configure sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests --enable-debuginfo --enable-lto
elif [ "$1" = "comp" ]
then
make TFLAGS="-DTEST"
echo "Parameter --disable-nls is NOT set"
fi
+# Link Time Optimization support
+LTO=`${ASK} 'Compile with Link Time Optimizations (LTO)? (y/n)' "--enable-lto" "lto"`
+if [ "${LTO}" = "y" ]; then
+ LTO="--enable-lto "
+else
+ LTO=""
+ echo "Parameter --enable-lto is NOT set"
+fi
+
# Sensors support
SENSORS=`${ASK} 'Disable sensors support? (y/n)' "--disable-sensors" "sensors"`
if [ "${SENSORS}" = "y" ]; then
echo
echo -n "./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
-${CLEAN_SA_DIR}${NLS}${HISTORY}${DELAY_RANGE}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR} \
+${CLEAN_SA_DIR}${NLS}${LTO}${HISTORY}${DELAY_RANGE}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR} \
${CRON}${USE_CROND}${RCDIR}"
if [ "${SADC_OPT}" != "" ];
then
echo
./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
-${CLEAN_SA_DIR}${NLS} \
+${CLEAN_SA_DIR}${NLS}${LTO} \
${HISTORY}${DELAY_RANGE}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${USE_CROND}${RCDIR} \
sadc_options="${SADC_OPT}" ${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS} \
${PCP}${STRIP}${COPY_ONLY}