diff options
author | Peter Powell <petpow@saberuk.com> | 2013-04-05 16:39:40 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2013-04-05 16:39:40 +0100 |
commit | 362f3009ac9a8fc7e1cedea66aa72abcdf52d934 (patch) | |
tree | 266065ea765be60f52a55208790c52872353a425 /configure | |
parent | bb3aa2fb37071f48a5312df8688c0a6990644fbb (diff) |
Merge inspircd_{config,version}.h into a single header file.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 61 |
1 files changed, 26 insertions, 35 deletions
@@ -861,7 +861,7 @@ my ($mliflags, $mfrules, $mobjs, $mfcount) = ("", "", "", 0); sub writefiles { my($writeheader) = @_; - # First File.. inspircd_config.h + # First File.. config.h chomp(my $incos = `uname -n -s -r`); chomp(my $version = `sh src/version.sh`); chomp(my $revision2 = getrevision()); @@ -872,16 +872,17 @@ sub writefiles { } if ($writeheader == 1) { - print "Writing \e[1;32minspircd_config.h\e[0m\n"; - open(FILEHANDLE, ">include/inspircd_config.h.tmp"); + print "Writing \e[1;32mconfig.h\e[0m\n"; + open(FILEHANDLE, ">include/config.h.tmp"); print FILEHANDLE <<EOF; /* Auto generated by configure, do not modify! */ #ifndef __CONFIGURATION_AUTO__ #define __CONFIGURATION_AUTO__ -/* this is for windows support. */ -#define CoreExport /**/ -#define DllExport /**/ +#define BRANCH "$branch" +#define VERSION "$version" +#define REVISION "$revision2" +#define SYSTEM "$incos" #define CONFIG_PATH "$config{CONFIG_DIR}" #define DATA_PATH "$config{DATA_DIR}" @@ -947,38 +948,28 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n"; } print FILEHANDLE "\n#include \"threadengines/threadengine_pthread.h\"\n\n#endif\n"; close(FILEHANDLE); - - open(FILEHANDLE, ">include/inspircd_version.h.tmp"); - print FILEHANDLE <<EOF; -#define BRANCH "$branch" -#define VERSION "$version" -#define REVISION "$revision2" -#define SYSTEM "$incos" -EOF - close FILEHANDLE; - - for my $file (qw(include/inspircd_config.h include/inspircd_version.h)) { - my $diff = 0; - open my $fh1, $file or $diff = 1; - open my $fh2, $file.'.tmp' or die "Can't read $file.tmp that we just wrote: $!"; - while (!$diff) { - my $line1 = <$fh1>; - my $line2 = <$fh2>; - if (defined($line1) != defined($line2)) { - $diff = 1; - } elsif (!defined $line1) { - last; - } else { - $diff = ($line1 ne $line2); - } - } - if ($diff) { - unlink $file; - rename "$file.tmp", $file; + + my $file = 'include/config.h'; + my $diff = 0; + open my $fh1, $file or $diff = 1; + open my $fh2, $file.'.tmp' or die "Can't read $file.tmp that we just wrote: $!"; + while (!$diff) { + my $line1 = <$fh1>; + my $line2 = <$fh2>; + if (defined($line1) != defined($line2)) { + $diff = 1; + } elsif (!defined $line1) { + last; } else { - unlink "$file.tmp"; + $diff = ($line1 ne $line2); } } + if ($diff) { + unlink $file; + rename "$file.tmp", $file; + } else { + unlink "$file.tmp"; + } } # Write all .in files. |