From 500a0524d94d596b327ed9aaa17fd0a8ce9ebf96 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 1 Oct 2014 19:52:25 +0100 Subject: Miscellaneous improvements to configure. - Clean up various minor sections of the code. - Remove OpenSSL and GnuTLS detection plumbing. - This will soon be the job of modulemanager. - This did not work in non-interactive mode unlike --enable-extras. - Rework runas user handling. - Add the --gid configure option. - Accept either an id or a name in --gid and --uid. - Rework the question flow in interactive mode. - User is no longer asked detailed questions unless they want them. - Socket engine questions have been removed. - Automatically enable non-interactive mode if STDIN or STDOUT are not a tty. --- make/template/main.mk | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'make/template/main.mk') diff --git a/make/template/main.mk b/make/template/main.mk index 5806d568a..c78d9047d 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -43,6 +43,7 @@ CORELDFLAGS = -rdynamic -L. $(LDFLAGS) PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS) BASE = "$(DESTDIR)@BASE_DIR@" CONPATH = "$(DESTDIR)@CONFIG_DIR@" +MANPATH = "$(DESTDIR)@MANUAL_DIR@" MODPATH = "$(DESTDIR)@MODULE_DIR@" DATPATH = "$(DESTDIR)@DATA_DIR@" BINPATH = "$(DESTDIR)@BINARY_DIR@" @@ -225,6 +226,7 @@ install: target @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH) @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MANPATH) @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH) [ $(BUILDPATH)/bin/ -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) $(BUILDPATH)/bin/inspircd $(BINPATH) @IFNDEF PURE_STATIC @@ -238,10 +240,11 @@ install: target @IFEQ $(SYSTEM) linux -$(INSTALL) -m $(INSTMODE_LIB) inspircd.service $(BASE) 2>/dev/null @ENDIF - -$(INSTALL) -m $(INSTMODE_LIB) inspircd.1 $(BASE) 2>/dev/null - -$(INSTALL) -m $(INSTMODE_LIB) inspircd-genssl.1 $(BASE) 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) inspircd.1 $(MANPATH) 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) inspircd-genssl.1 $(MANPATH) 2>/dev/null -$(INSTALL) -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples + -$(INSTALL) -m $(INSTMODE_LIB) *.pem $(CONPATH) -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example $(CONPATH)/examples/aliases -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules @echo "" @@ -273,8 +276,11 @@ clean: deinstall: -rm -f $(BINPATH)/inspircd -rm -rf $(CONPATH)/examples + -rm -f $(MANPATH)/inspircd.1 + -rm -f $(MANPATH)/inspircd-genssl.1 -rm -f $(MODPATH)/*.so -rm -f $(BASE)/.gdbargs + -rm -f $(BASE)/inspircd.service -rm -f $(BASE)/org.inspircd.plist configureclean: @@ -283,6 +289,9 @@ configureclean: rm -f GNUmakefile rm -f include/config.h rm -f inspircd + rm -f inspircd.1 + rm -f inspircd-genssl.1 + -rm -f inspircd.service -rm -f org.inspircd.plist distclean: clean configureclean -- cgit v1.2.3 From 133b110534ec3386d8735020e8679236002b6ed1 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 1 Oct 2014 19:52:26 +0100 Subject: Improve configure cache file handling. - Add a version number to the configure cache file. - Disable configure cache file in non-interactive mode. - Rename configure cache file to .configure.cache to avoid 2.0 files. - Use run_test to produce the "reading .configure.cache" message. --- .gitignore | 6 +++--- configure | 17 ++++++++++++----- make/configure.pm | 30 ++++++++++++++++++------------ make/template/main.mk | 7 +++++-- 4 files changed, 38 insertions(+), 22 deletions(-) (limited to 'make/template/main.mk') diff --git a/.gitignore b/.gitignore index 8b09fdb5e..ca364ecfc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,9 @@ *.pem *.swp -/.config.cache -/.gdbargs -/.modulemanager +.* +!.git* + /BSDmakefile /GNUmakefile /build diff --git a/configure b/configure index 55880fab6..de45bdc79 100755 --- a/configure +++ b/configure @@ -119,10 +119,17 @@ our $interactive = !( my %version = get_version(); print_format "<|BOLD Configuring InspIRCd $version{MAJOR}.$version{MINOR}.$version{PATCH}+$version{LABEL} on $^O.|>\n"; -our %config = read_configure_cache(); - -print "Checking for cache from previous configure... "; -print %config ? "found\n" : "not found\n"; +our %config; +if ($interactive) { + %config = read_configure_cache(); + run_test CONFIGURE_CACHE_FILE, %config; + if (!defined $config{VERSION}) { + $config{VERSION} = CONFIGURE_CACHE_VERSION; + } elsif ($config{VERSION} != CONFIGURE_CACHE_VERSION) { + print_warning "ignoring contents of ${\CONFIGURE_CACHE_FILE} as it was generated by an incompatible version of $0!"; + %config = ('VERSION', CONFIGURE_CACHE_VERSION); + } +} $config{CXX} = defined $ENV{CXX} && !system("$ENV{CXX} -v > /dev/null 2>&1") ? $ENV{CXX} : find_compiler(); if ($config{CXX} eq "") { @@ -290,7 +297,7 @@ if ( && prompt_bool $interactive, 'Would you like to ge system './tools/genssl', 'auto'; } -write_configure_cache %config; +write_configure_cache %config if $interactive; parse_templates \%config, \%compiler; print_format <<"EOM"; diff --git a/make/configure.pm b/make/configure.pm index 7cf08e254..9f4797353 100644 --- a/make/configure.pm +++ b/make/configure.pm @@ -37,7 +37,12 @@ use File::Basename qw(basename); use make::console; use make::utilities; -our @EXPORT = qw(cmd_clean +use constant CONFIGURE_CACHE_FILE => '.configure.cache'; +use constant CONFIGURE_CACHE_VERSION => '1'; + +our @EXPORT = qw(CONFIGURE_CACHE_FILE + CONFIGURE_CACHE_VERSION + cmd_clean cmd_help cmd_update read_configure_cache @@ -81,6 +86,7 @@ sub __get_template_settings($$) { } # Miscellaneous information + $settings{CONFIGURE_CACHE_FILE} = CONFIGURE_CACHE_FILE; $settings{SYSTEM_NAME} = lc $^O; chomp($settings{SYSTEM_NAME_VERSION} = `uname -sr 2>/dev/null`); @@ -88,7 +94,7 @@ sub __get_template_settings($$) { } sub cmd_clean { - unlink '.config.cache'; + unlink CONFIGURE_CACHE_FILE; } sub cmd_help { @@ -159,7 +165,7 @@ EOH } sub cmd_update { - print_error "You have not run $0 before. Please do this before trying to update the generated files." unless -f '.config.cache'; + print_error "You have not run $0 before. Please do this before trying to update the generated files." unless -f CONFIGURE_CACHE_FILE; print "Updating...\n"; my %config = read_configure_cache(); my %compiler = get_compiler_info($config{CXX}); @@ -169,23 +175,23 @@ sub cmd_update { } sub read_configure_cache { - my %cfg = (); - open(CACHE, '.config.cache') or return %cfg; + my %config; + open(CACHE, CONFIGURE_CACHE_FILE) or return %config; while (my $line = ) { next if $line =~ /^\s*($|\#)/; my ($key, $value) = ($line =~ /^(\S+)="(.*)"$/); - $cfg{$key} = $value; + $config{$key} = $value; } close(CACHE); - return %cfg; + return %config; } sub write_configure_cache(%) { - print_format "Writing <|GREEN .config.cache|> ...\n"; - my %cfg = @_; - open(CACHE, '>.config.cache') or print_error "unable to write .config.cache: $!"; - while (my ($key, $value) = each %cfg) { - $value = "" unless defined $value; + print_format "Writing <|GREEN ${\CONFIGURE_CACHE_FILE}|> ...\n"; + my %config = @_; + open(CACHE, '>', CONFIGURE_CACHE_FILE) or print_error "unable to write ${\CONFIGURE_CACHE_FILE}: $!"; + while (my ($key, $value) = each %config) { + $value = '' unless defined $value; print CACHE "$key=\"$value\"\n"; } close(CACHE); diff --git a/make/template/main.mk b/make/template/main.mk index c78d9047d..b4a0d6f1c 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -261,7 +261,10 @@ install: target @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf @echo 'Examples are available at:' $(CONPATH)/examples/ -GNUmakefile BSDmakefile: make/template/main.mk src/version.sh configure .config.cache +@TARGET BSD_MAKE CONFIGURE_CACHE_FILE = @CONFIGURE_CACHE_FILE@ +@TARGET GNU_MAKE CONFIGURE_CACHE_FILE = $(wildcard @CONFIGURE_CACHE_FILE@) + +GNUmakefile BSDmakefile: make/template/main.mk src/version.sh configure $(CONFIGURE_CACHE_FILE) ./configure -update @TARGET BSD_MAKE .MAKEFILEDEPS: BSDmakefile @@ -284,7 +287,6 @@ deinstall: -rm -f $(BASE)/org.inspircd.plist configureclean: - rm -f .config.cache rm -f BSDmakefile rm -f GNUmakefile rm -f include/config.h @@ -293,6 +295,7 @@ configureclean: rm -f inspircd-genssl.1 -rm -f inspircd.service -rm -f org.inspircd.plist + -rm -f @CONFIGURE_CACHE_FILE@ distclean: clean configureclean -rm -rf $(SOURCEPATH)/run -- cgit v1.2.3 From 440f34023a094697fca5fc07dfbb9e2a3228520a Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 1 Oct 2014 19:52:34 +0100 Subject: Fix builds on OpenBSD spamming the console with warnings. --- make/template/main.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'make/template/main.mk') diff --git a/make/template/main.mk b/make/template/main.mk index b4a0d6f1c..b4d77e4e6 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -54,7 +54,10 @@ INSTMODE_BIN = 0750 INSTMODE_LIB = 0640 @IFNEQ $(COMPILER) ICC - CORECXXFLAGS += -pedantic -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute + CORECXXFLAGS += -Woverloaded-virtual -Wshadow +@IFNEQ $(SYSTEM) openbsd + CORECXXFLAGS += -pedantic -Wformat=2 -Wmissing-format-attribute +@ENDIF @ENDIF @IFNEQ $(SYSTEM)-$(COMPILER) darwin-GCC -- cgit v1.2.3