Parcourir la source

feature merge bs-coreoptimize->trunk: LTO support

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16196 54d463be-8e91-2dee-dedb-b68131a5f0ec
blacksirius il y a 13 ans
Parent
commit
82f5c8991a
2 fichiers modifiés avec 678 ajouts et 210 suppressions
  1. 621 210
      configure
  2. 57 0
      configure.in

Fichier diff supprimé car celui-ci est trop grand
+ 621 - 210
configure


+ 57 - 0
configure.in

@@ -165,6 +165,29 @@ AC_ARG_ENABLE(
 )
 
 
+#
+# LTO
+#
+AC_ARG_ENABLE(
+    [lto],
+    AC_HELP_STRING(
+        [--enable-lto],
+        [
+			Enables or Disables Linktime Code Optimization (LTO is enabled by default)
+        ]
+    ),
+    [
+        enable_lto="$enableval"
+        case $enableval in
+            "no");;
+            "yes");;
+            *) AC_MSG_ERROR([[invalid argument --enable-lto=$disableval... stopping]]);;
+        esac
+    ],
+    [enable_lto="yes"]
+)
+
+
 #
 # Optionally specify the path to mysql_config
 #
@@ -327,6 +350,40 @@ AC_COMPILE_IFELSE(
 )
 
 
+#
+# LTO Support test
+#
+if test "$enable_lto" != "no" ; then
+
+	OLD_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS -flto"
+
+	OLD_LDFLAGS="$LDFLAGS"
+	LDFLAGS="$LDFLAGS -flto"
+
+	AC_MSG_CHECKING([whether $CC supports -flto])
+	AC_RUN_IFELSE(
+		[
+			int main(int argc, char **argv){
+               return 0;
+           }
+		],
+		[
+			AC_MSG_RESULT([yes])
+		],
+		[
+			AC_MSG_RESULT([no])
+			CFLAGS="$OLD_CFLAGS"
+			LDFLAGS="$OLD_LDFLAGS"
+		],
+		[
+			AC_MSG_RESULT([guessing no])
+		]
+	)
+fi
+
+
+
 AC_MSG_CHECKING([whether $CC supports -Wno-pointer-sign])
 OLD_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wno-pointer-sign"

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff