diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-20 22:33:55 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-20 22:33:55 +0000 |
commit | 1403bd4c85009000c3bf64acf8b7dec5cc154c70 (patch) | |
tree | b01518d9d876ce765f65dabf3a3a1871c63f49c2 /make | |
parent | aca1b631d74df615fb20fa0caa99d432ea9b0fd1 (diff) |
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
Diffstat (limited to 'make')
-rw-r--r-- | make/utilities.pm | 32 |
1 files changed, 25 insertions, 7 deletions
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 = <STDIN>); + 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 = <STDIN>); + } 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}; |