]> mj.ucw.cz Git - libucw.git/commitdiff
More progress on the new configurator. All configurations have been converted.
authorMartin Mares <mj@ucw.cz>
Tue, 12 Apr 2005 18:39:10 +0000 (18:39 +0000)
committerMartin Mares <mj@ucw.cz>
Tue, 12 Apr 2005 18:39:10 +0000 (18:39 +0000)
The centrum/cz config decides on configuration according to host name.
Autoconf is able to auto-detect gcc.

build/sherlock.cfg
lib/autoconf.cfg
lib/perl/Configure.pm

index abdeb4aea8b96cee63a3a4630577de05d4190d54..b8d5902629f52029d322907144458305dc5d5d93 100644 (file)
@@ -13,7 +13,7 @@ Set("INSTALL_DIR" => "~/run-3.5");
 Set("CONFIG_GATHERER");
 
 # The gatherer daemon (requires CONFIG_GATHERER)
-UnSet("CONFIG_GATHERD");
+Set("CONFIG_GATHERD");
 
 # Indexer
 Set("CONFIG_INDEXER");
index 2fea596c734412421ad4fd68c0f88d3a79e2e873..fed6f6c933906d31f7c3a6e24ed2245442a97d40 100644 (file)
@@ -1,7 +1,19 @@
 # Automatic configuration of the UCW Library
 # (c) 2005 Martin Mares <mj@ucw.cz>
 
-Set("CC" => "gcc-3.0");
+### Compiler and its Options ###
+
+# Default compiler
+Test("CC", "Checking for C compiler", sub { return "gcc"; });
+
+# GCC version
+Test("GCCVER", "Checking for GCC version", sub {
+       my $gcc = Get("CC");
+       my $ver = `$gcc --version | sed '2,\$d; s/^\\(.* \\)\\?\\([0-9]*\\.[0-9]*\\).*/\\2/'`;
+       chomp $ver;
+       Fail "Unable to determine GCC version" if $? || $ver eq "";
+       return $ver;
+});
 
 # C flags: tell the compiler we're speaking C99
 Set("CLANG" => "-std=gnu99");
@@ -26,34 +38,36 @@ Set("CSHARED" => '-fPIC');
 Set("LSHARED" => '-shared -Wl,-soname,lib/$(@F)');
 
 # Extra switches depending on GCC version:
-# [FIXME]
-#GCCVER:=$(shell $(CC) --version | sed '2,$$d; s/^\(.* \)\?\([0-9]*\.[0-9]*\).*/\2/')
-#ifeq ($(GCCVER),3.3)
-#CWARNS+=-Wundef -Wredundant-decls
-#COPT+=-finline-limit=20000 --param max-inline-insns-auto=1000
-#endif
-#ifeq ($(GCCVER),3.4)
-#CWARNS+=-Wundef -Wredundant-decls
-#COPT+=-finline-limit=5000 --param large-function-insns=5000 --param inline-unit-growth=200 --param large-function-growth=400
-#endif
-
-# If debugging:
-Set("CDEBUG" => '-DDEBUG_ASSERTS -ggdb');
-#CDEBUG+=-DDEBUG_DIE_BY_ABORT
+if (Get("GCCVER") eq "3.0") {
+} elsif (Get("GCCVER") eq "3.3") {
+       Append("CWARNS" => "-Wundef -Wredundant-decls");
+       Append("COPT" => "-finline-limit=20000 --param max-inline-insns-auto=1000");
+} elsif (Get("GCCVER") eq "3.4") {
+       Append("CWARNS" => "-Wundef -Wredundant-decls");
+       Append("COPT" => "-finline-limit=5000 --param large-function-insns=5000 --param inline-unit-growth=200 --param large-function-growth=400");
+} else {
+       Log "WARNING: Don't know anything about this GCC version, using default switches.\n";
+}
+
+if (IsSet("CONFIG_DEBUG")) {
+       # If debugging:
+       Set("DEBUG_ASSERTS");
+       Set("DEBUG_DIE_BY_ABORT") if Get("CONFIG_DEBUG") > 1;
+       Set("CDEBUG" => "-ggdb");
+} else {
+       # If building a release version:
+       Append("COPT" => "-fomit-frame-pointer");
+       Append("LOPT" => "-s");
+}
 
 # If debugging memory allocations:
 #LIBS+=-lefence
 #CDEBUG+=-DDEBUG_DMALLOC
 #LIBS+=-ldmalloc
 
-# If building release versions:
-#CDEBUG=
-#COPT+=-fomit-frame-pointer
-#LOPT+=-s
-
 ### CPU Type and Features ###
 
-Set("CPU_ARCH" => 'i686');
+Set("CPU_ARCH" => 'i686') if !IsSet("CPU_ARCH");
 Set("CPU_I386");
 Set("CPU_LITTLE_ENDIAN");
 #CPU_BIG_ENDIAN=1
index 6900dbe3837e52b3bd973281f2dd1704e5b0c5f9..ee1c83df114397bd71a3a54ac464296d6e4640dd 100644 (file)
@@ -16,7 +16,7 @@ BEGIN {
        our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
        $VERSION = 1.0;
        @ISA = qw(Exporter);
-       @EXPORT = qw(&Init &Log &Fail &IsSet &Set &UnSet &Override &Get &Test &Include &Finish &FindFile &TryFindFile);
+       @EXPORT = qw(&Init &Log &Notice &Fail &IsSet &Set &UnSet &Append &Override &Get &Test &Include &Finish &FindFile &TryFindFile);
        @EXPORT_OK = qw();
        %EXPORT_TAGS = ();
 }
@@ -28,6 +28,10 @@ sub Log($) {
        print @_;
 }
 
+sub Notice($) {
+       print @_ if $vars{"VERBOSE"};
+}
+
 sub Fail($) {
        Log((shift @_) . "\n");
        exit 1;
@@ -54,6 +58,11 @@ sub UnSet($) {
        delete $vars{$x} unless $overriden{$x};
 }
 
+sub Append($$) {
+       my ($x,$y) = @_;
+       Set($x, (IsSet($x) ? (Get($x) . " $y") : $y));
+}
+
 sub Override($;$) {
        my ($x,$y) = @_;
        $y=1 unless defined $y;
@@ -63,7 +72,7 @@ sub Override($;$) {
 
 sub Test($$$) {
        my ($var,$msg,$sub) = @_;
-       Log "$msg... ";
+       Log "$msg ... ";
        if (!IsSet($var)) {
                Set $var, &$sub();
        }
@@ -125,7 +134,7 @@ sub Init($$) {
 sub Include($) {
        my ($f) = @_;
        $f = FindFile($f);
-       Log "Loading configuration $f\n";
+       Notice "Loading configuration $f\n";
        require $f;
 }
 
@@ -148,7 +157,7 @@ sub Finish() {
        -d "obj/lib" or mkdir("obj/lib", 0777) or Fail "Cannot create obj/lib directory: $!";
        Log "done\n";
 
-       Log "Generating autoconf.h... ";
+       Log "Generating autoconf.h ... ";
        open X, ">obj/lib/autoconf.h" or Fail $!;
        print X "/* Generated automatically by $0, please don't touch manually. */\n";
        foreach my $x (sort keys %vars) {
@@ -162,7 +171,7 @@ sub Finish() {
        close X;
        Log "done\n";
 
-       Log "Generating config.mk... ";
+       Log "Generating config.mk ... ";
        open X, ">obj/config.mk" or Fail $!;
        print X "# Generated automatically by $0, please don't touch manually.\n";
        foreach my $x (sort keys %vars) {