=== modified file 'INSTALL' --- INSTALL 2014-03-27 19:41:57 +0000 +++ INSTALL 2014-04-01 16:08:38 +0000 @@ -331,12 +331,17 @@ there should be no warnings; on older and on non-GNU systems the generated warnings may still be useful. -Use --enable-link-time-optimization to enable link-time optimizer, which -is available in GNU compiler since version 4.5.0. If your compiler is not -GNU or older than version 4.5.0, this option does nothing. If `configure' -can determine number of online CPUS on your system, final link-time -optimization and code generation is executed in parallel using one job -per each available online CPU. +Use --enable-link-time-optimization to enable link-time optimizer. If +you're using GNU compiler, this feature is supported since version 4.5.0. +If `configure' can determine number of online CPUS on your system, final +link-time optimization and code generation is executed in parallel using +one job per each available online CPU. + +This option is also supported for clang. You should have GNU binutils +with `gold' linker and plugin support, and clang with LLVMgold.so plugin. +Read http://llvm.org/docs/GoldPlugin.html for details. Also note that +this feature is still experimental, so prepare to build binutils and +clang snapshots from their source code repositories. The `--prefix=PREFIXDIR' option specifies where the installation process should put emacs and its data files. This defaults to `/usr/local'. === modified file 'configure.ac' --- configure.ac 2014-03-31 05:02:08 +0000 +++ configure.ac 2014-04-01 16:07:34 +0000 @@ -764,32 +764,6 @@ [gl_gcc_warnings=no] ) -AC_ARG_ENABLE(link-time-optimization, -[AS_HELP_STRING([--enable-link-time-optimization], - [build emacs with link-time optimization. - This is supported only for GCC since 4.5.0.])], -if test "${enableval}" != "no"; then - AC_MSG_CHECKING([whether link-time optimization is supported]) - ac_lto_supported=no - if test x$GCC = xyes; then - CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null` - if test x$CPUS != x; then - LTO="-flto=$CPUS" - else - LTO="-flto" - fi - old_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $LTO" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [ac_lto_supported=yes], [ac_lto_supported=no]) - CFLAGS="$old_CFLAGS" - fi - AC_MSG_RESULT([$ac_lto_supported]) - if test "$ac_lto_supported" = "yes"; then - CFLAGS="$CFLAGS $LTO" - fi -fi) - # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found]) # ------------------------------------------------ # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND. @@ -926,7 +900,48 @@ AC_SUBST([GNULIB_WARN_CFLAGS]) fi - +AC_ARG_ENABLE(link-time-optimization, +[AS_HELP_STRING([--enable-link-time-optimization], + [build emacs with link-time optimization. + This is supported for gcc since 4.5.0 and clang. + For the latter, this is experimental, see INSTALL])], +if test "${enableval}" != "no"; then + ac_lto_supported=no + if test $emacs_cv_clang = yes; then + AC_MSG_CHECKING([whether link-time optimization is supported by clang]) + GOLD_PLUGIN=`$CC -print-file-name=LLVMgold.so` + if test -n "$GOLD_PLUGIN" -a -x "$GOLD_PLUGIN"; then + LTO="-flto" + fi + elif test x$GCC = xyes; then + AC_MSG_CHECKING([whether link-time optimization is supported by gcc]) + CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null` + if test x$CPUS != x; then + LTO="-flto=$CPUS" + else + LTO="-flto" + fi + else + AC_MSG_ERROR([Link-time optimization is not supported with your compiler.]) + fi + old_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $LTO" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [ac_lto_supported=yes], [ac_lto_supported=no]) + CFLAGS="$old_CFLAGS" + AC_MSG_RESULT([$ac_lto_supported]) + if test "$ac_lto_supported" = "yes"; then + CFLAGS="$CFLAGS $LTO" + if test x$emacs_cv_clang = xyes; then + AC_MSG_WARN([Please read INSTALL before using link-time optimization with clang]) + # WARNING: 'ar --plugin ...' doesn't work without + # command, so plugin name is appended to ARFLAGS... + ARFLAGS="cru --plugin $GOLD_PLUGIN" + # ...but this is much better for ranlib. + RANLIB="$RANLIB --plugin $GOLD_PLUGIN" + fi + fi +fi) dnl Some other nice autoconf tests. dnl These are commented out, since gl_EARLY and/or Autoconf already does them.