]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/perl/UCW/Configure/C.pm
Configure: Settings for powerpc
[libucw.git] / ucw / perl / UCW / Configure / C.pm
index 95644b4504e0f00f36037aeecdb7e1d7cffc2874..b14759258ff9c83eb9a45311be989eb6482c25a9 100644 (file)
@@ -65,6 +65,8 @@ Test("ARCH", "Checking for machine architecture", sub {
                return "i386";
        } elsif ($mach =~ /^(x86[_-]|amd)64$/) {
                return "amd64";
+       } elsif ($mach eq 'powerpc') {
+               return $mach;
        } else {
                return "unknown ($mach)";
        }
@@ -85,6 +87,13 @@ if ($arch eq 'i386') {
        UnSet("CPU_BIG_ENDIAN");
        Set("CPU_ALLOW_UNALIGNED");
        Set("CPU_STRUCT_ALIGN" => 8);
+} elsif ($arch eq "powerpc") {
+       Set("CPU_AMD64");
+       UnSet("CPU_64BIT_POINTERS");
+       UnSet("CPU_LITTLE_ENDIAN");
+       Set("CPU_BIG_ENDIAN");
+       UnSet("CPU_ALLOW_UNALIGNED");
+       Set("CPU_STRUCT_ALIGN" => 4);
 } elsif (!Get("CPU_LITTLE_ENDIAN") && !Get("CPU_BIG_ENDIAN")) {
        Fail "Architecture not recognized, please set CPU_xxx variables manually.";
 }
@@ -170,6 +179,16 @@ if (IsSet("CONFIG_DEBUG")) {
        Append("LOPT" => "-s");
 }
 
+# Link-time optimization (experimental)
+# This is currently very inefficient, because we do not attempt to disable
+# optimizations when compiling individual modules. Therefore, we optimize
+# each shared library module twice: when compiling and when linking.
+# Doing it properly would require hacking makefiles.
+if (IsSet("CONFIG_LTO")) {
+       Append("LOPT", "-flto");
+       Append("COPT", "-flto");
+}
+
 if (IsSet("CONFIG_DARWIN")) {
        # gcc-4.0 on Darwin doesn't set this in the gnu99 mode
        Append("CLANG" => "-fnested-functions");