From 1403bd4c85009000c3bf64acf8b7dec5cc154c70 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 20 Jan 2007 22:33:55 +0000 Subject: If we're not in interactive mode, then we dont prompt interactively for the value. We look for the configuration item in the commandline, --$package-includes="" or --$package-libs="" and use that. If its not defined, we die() with a message to specify the path using that commandline item. This also applies to ./configure -modupdate. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6414 e03df62e-2008-0410-955e-edbf42e46eb7 --- make/utilities.pm | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'make') diff --git a/make/utilities.pm b/make/utilities.pm index 3d3ceb6ef..222720058 100644 --- a/make/utilities.pm +++ b/make/utilities.pm @@ -1,6 +1,7 @@ package make::utilities; use Exporter 'import'; use POSIX; +use Getopt::Long; @EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs translate_functions promptstring); # Parse the output of a *_config program, @@ -11,12 +12,29 @@ use POSIX; my %already_added = (); -sub promptstring($$$) +sub promptstring($$$$$) { - my ($prompt, $configitem, $default) = @_; - print "\nPlease enter the $prompt?\n"; - print "[\033[1;32m$default\033[0m] -> "; - chomp($var = ); + my ($prompt, $configitem, $default, $package, $commandlineswitch) = @_; + my $var; + if (!$main::interactive) + { + undef $opt_commandlineswitch; + GetOptions ("$commandlineswitch" => \$opt_commandlineswitch); + if (defined $opt_commandlineswitch) + { + $var = $opt_commandlineswitch; + } + else + { + die "Could not detect $package! Please specify the $prompt via the command line option $commandlineswitch=\"/path/to/file\""; + } + } + else + { + print "\nPlease enter the $prompt?\n"; + print "[\033[1;32m$default\033[0m] -> "; + chomp($var = ); + } if ($var eq "") { $var = $default; @@ -104,7 +122,7 @@ sub pkgconfig_get_include_dirs($$$;$) else { $headername =~ s/^\///; - promptstring("path to the directory containing $headername", $key, "/usr/include"); + promptstring("path to the directory containing $headername", $key, "/usr/include",$packagename,"$packagename-includes"); $packagename =~ tr/a-z/A-Z/; $main::config{$key} = "-I$main::config{$key}" . " $defaults -DVERSION_$packagename=\"$v\""; $main::config{$key} =~ s/^\s+//g; @@ -176,7 +194,7 @@ sub pkgconfig_get_lib_dirs($$$;$) else { $libname =~ s/^\///; - promptstring("path to the directory containing $libname", $key, "/usr/lib"); + promptstring("path to the directory containing $libname", $key, "/usr/lib",$packagename,"$packagename-libs"); $main::config{$key} = "-L$main::config{$key}" . " $defaults"; $main::config{$key} =~ s/^\s+//g; $ret = $main::config{$key}; -- cgit v1.2.3