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 | |
parent | bb3aa2fb37071f48a5312df8688c0a6990644fbb (diff) |
Merge inspircd_{config,version}.h into a single header file.
-rw-r--r-- | .gitignore | 3 | ||||
-rwxr-xr-x | configure | 61 | ||||
-rw-r--r-- | include/inspircd.h | 3 | ||||
-rw-r--r-- | include/inspstring.h | 4 | ||||
-rw-r--r-- | include/socketengine.h | 2 | ||||
-rw-r--r-- | include/threadengine.h | 2 | ||||
-rw-r--r-- | include/threadengines/threadengine_win32.h | 2 | ||||
-rwxr-xr-x | make/calcdep.pl | 2 | ||||
-rw-r--r-- | make/template/main.mk | 3 | ||||
-rw-r--r-- | src/inspircd.cpp | 1 | ||||
-rw-r--r-- | src/server.cpp | 1 | ||||
-rw-r--r-- | src/socketengines/socketengine_poll.cpp | 5 | ||||
-rw-r--r-- | src/socketengines/socketengine_ports.cpp | 1 | ||||
-rw-r--r-- | src/socketengines/socketengine_select.cpp | 2 | ||||
-rw-r--r-- | win/CMakeLists.txt | 3 | ||||
-rw-r--r-- | win/config.h.cmake (renamed from win/inspircd_config.h.cmake) | 5 | ||||
-rw-r--r-- | win/inspircd_version.h.cmake | 4 | ||||
-rw-r--r-- | win/win32service.cpp | 2 |
18 files changed, 43 insertions, 63 deletions
diff --git a/.gitignore b/.gitignore index 3a5fef871..4e53a077a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,7 @@ /run /bin -/include/inspircd_config.h -/include/inspircd_version.h +/include/config.h /src/modules/m_geoip.cpp /src/modules/m_ldapauth.cpp @@ -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. diff --git a/include/inspircd.h b/include/inspircd.h index 2e1cfbd21..1ca3d077b 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -81,8 +81,7 @@ #include <bitset> #include <set> #include <time.h> -#include "inspircd_config.h" -#include "inspircd_version.h" +#include "config.h" #include "typedefs.h" #include "consolecolors.h" diff --git a/include/inspstring.h b/include/inspstring.h index a6ef5e552..494ce92b1 100644 --- a/include/inspstring.h +++ b/include/inspstring.h @@ -21,8 +21,8 @@ #ifndef INSPSTRING_H #define INSPSTRING_H -// This (inspircd_config) is needed as inspstring doesn't pull in the central header -#include "inspircd_config.h" +// This (config) is needed as inspstring doesn't pull in the central header +#include "config.h" #include <cstring> //#include <cstddef> diff --git a/include/socketengine.h b/include/socketengine.h index 643bceee5..58af73589 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -26,7 +26,7 @@ #include <vector> #include <string> #include <map> -#include "inspircd_config.h" +#include "config.h" #include "socket.h" #include "base.h" diff --git a/include/threadengine.h b/include/threadengine.h index 4bf5a48f3..e0ed9ec40 100644 --- a/include/threadengine.h +++ b/include/threadengine.h @@ -24,7 +24,7 @@ #include <vector> #include <string> #include <map> -#include "inspircd_config.h" +#include "config.h" #include "base.h" class ThreadData; diff --git a/include/threadengines/threadengine_win32.h b/include/threadengines/threadengine_win32.h index f068ac707..2fdcac565 100644 --- a/include/threadengines/threadengine_win32.h +++ b/include/threadengines/threadengine_win32.h @@ -21,7 +21,7 @@ #ifndef THREADENGINE_WIN32_H #define THREADENGINE_WIN32_H -#include "inspircd_config.h" +#include "config.h" #include "base.h" class Thread; diff --git a/make/calcdep.pl b/make/calcdep.pl index 4a759a24a..e578f585c 100755 --- a/make/calcdep.pl +++ b/make/calcdep.pl @@ -199,7 +199,7 @@ sub gendep($) { while (<$in>) { if (/^\s*#\s*include\s*"([^"]+)"/) { my $inc = $1; - next if $inc eq 'inspircd_version.h' && $f eq '../include/inspircd.h'; + next if $inc eq 'config.h' && $f eq '../include/inspircd.h'; my $found = 0; for my $loc ("$basedir/$inc", "../include/$inc") { next unless -e $loc; diff --git a/make/template/main.mk b/make/template/main.mk index 32b7e4803..4930fa7e3 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -276,8 +276,7 @@ configureclean: rm -f .config.cache rm -f BSDmakefile rm -f GNUmakefile - rm -f include/inspircd_config.h - rm -f include/inspircd_version.h + rm -f include/config.h rm -f inspircd -rm -f org.inspircd.plist diff --git a/src/inspircd.cpp b/src/inspircd.cpp index c34908378..cccf3fe89 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -28,7 +28,6 @@ /* $Core */ #include "inspircd.h" -#include "inspircd_version.h" #include <signal.h> #ifndef _WIN32 diff --git a/src/server.cpp b/src/server.cpp index 691ab3842..6a4603440 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -23,7 +23,6 @@ #include <signal.h> #include "exitcodes.h" #include "inspircd.h" -#include "inspircd_version.h" void InspIRCd::SignalHandler(int signal) { diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index 5c361a0cb..7d2f4d565 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -20,9 +20,6 @@ */ -#include "inspircd.h" -#include "exitcodes.h" - #ifndef SOCKETENGINE_POLL #define SOCKETENGINE_POLL @@ -30,7 +27,7 @@ #include <vector> #include <string> #include <map> -#include "inspircd_config.h" +#include "config.h" #include "inspircd.h" #include "socketengine.h" diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp index 52d799ddf..58d069886 100644 --- a/src/socketengines/socketengine_ports.cpp +++ b/src/socketengines/socketengine_ports.cpp @@ -32,7 +32,6 @@ #include <vector> #include <string> #include <map> -#include "inspircd_config.h" #include "inspircd.h" #include "socketengine.h" #include <port.h> diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp index eba54a7cb..02ab077ca 100644 --- a/src/socketengines/socketengine_select.cpp +++ b/src/socketengines/socketengine_select.cpp @@ -18,8 +18,6 @@ */ -#include "inspircd_config.h" - #include "inspircd.h" #include "socketengine.h" diff --git a/win/CMakeLists.txt b/win/CMakeLists.txt index f26b9a6c7..827ef1c90 100644 --- a/win/CMakeLists.txt +++ b/win/CMakeLists.txt @@ -56,8 +56,7 @@ if(MSVC) endif(MSVC) configure_file("${INSPIRCD_BASE}/win/inspircd.rc.cmake" "${INSPIRCD_BASE}/win/inspircd.rc") -configure_file("${INSPIRCD_BASE}/win/inspircd_version.h.cmake" "${INSPIRCD_BASE}/win/inspircd_version.h") -configure_file("${INSPIRCD_BASE}/win/inspircd_config.h.cmake" "${INSPIRCD_BASE}/win/inspircd_config.h") +configure_file("${INSPIRCD_BASE}/win/config.h.cmake" "${INSPIRCD_BASE}/win/config.h") add_executable(inspircd ${INSPIRCD_SOURCES} "${INSPIRCD_BASE}/win/inspircd.rc") target_link_libraries(inspircd win32_memory) diff --git a/win/inspircd_config.h.cmake b/win/config.h.cmake index f98cd391e..47cdb9f65 100644 --- a/win/inspircd_config.h.cmake +++ b/win/config.h.cmake @@ -1,6 +1,11 @@ #ifndef INSPIRCD_CONFIG_H
#define INSPIRCD_CONFIG_H
+#define BRANCH "@MAJOR_VERSION@.@MINOR_VERSION@"
+#define VERSION "@FULL_VERSION@"
+#define REVISION "0"
+#define SYSTEM "@CMAKE_SYSTEM@"
+
#define CONFIG_PATH "@CONF_PATH@"
#define MOD_PATH "@MODULE_PATH@"
#define DATA_PATH "@DATA_PATH@"
diff --git a/win/inspircd_version.h.cmake b/win/inspircd_version.h.cmake deleted file mode 100644 index 1aec12b24..000000000 --- a/win/inspircd_version.h.cmake +++ /dev/null @@ -1,4 +0,0 @@ -#define BRANCH "@MAJOR_VERSION@.@MINOR_VERSION@"
-#define VERSION "@FULL_VERSION@"
-#define REVISION "0"
-#define SYSTEM "@CMAKE_SYSTEM@"
\ No newline at end of file diff --git a/win/win32service.cpp b/win/win32service.cpp index c34e9957d..d06ad1838 100644 --- a/win/win32service.cpp +++ b/win/win32service.cpp @@ -17,7 +17,7 @@ */ -#include "inspircd_config.h" +#include "config.h" #include "inspircd.h" #include "exitcodes.h" #include <windows.h> |