aboutsummaryrefslogtreecommitdiffstats
path: root/misc/config/code/sysinfo.pl
diff options
context:
space:
mode:
Diffstat (limited to 'misc/config/code/sysinfo.pl')
-rw-r--r--misc/config/code/sysinfo.pl53
1 files changed, 53 insertions, 0 deletions
diff --git a/misc/config/code/sysinfo.pl b/misc/config/code/sysinfo.pl
new file mode 100644
index 000000000..6a78234bd
--- /dev/null
+++ b/misc/config/code/sysinfo.pl
@@ -0,0 +1,53 @@
+
+sub os_info_for {
+ my ($os,$hashref) = @_;
+
+ my %hash = %{ $hashref };
+
+ die "Internal error: os_info_for called with undef hash\n"
+ unless %hash;
+
+ die "Internal error: os_info_for called with an os of defaults\n"
+ if($os eq 'defaults');
+
+ return $hash{$os} if(defined($hash{$os}) && $hash{$os} ne '');
+ return $hash{'defaults'};
+}
+
+sub os_static_suffix {
+ my $os = $_[0];
+ return os_info_for($os, \%OS_STATIC_SUFFIX);
+}
+
+sub os_shared_suffix {
+ my $os = $_[0];
+ return os_info_for($os, \%OS_SHARED_SUFFIX);
+}
+
+sub os_obj_suffix {
+ my $os = $_[0];
+ return os_info_for($os, \%OS_OBJ_SUFFIX);
+}
+
+sub os_ar_command {
+ my $os = $_[0];
+ return os_info_for($os, \%OS_AR_COMMAND);
+}
+
+sub os_ar_needs_ranlib {
+ my $os = $_[0];
+ return os_info_for($os, \%OS_AR_NEEDS_RANLIB);
+}
+
+sub os_install_info {
+ my ($os,$what) = @_;
+
+ return $doc_dir if($what eq 'docs' && $doc_dir);
+ return $lib_dir if($what eq 'libs' && $lib_dir);
+
+ return $INSTALL_INFO{$os}{$what}
+ if(defined($INSTALL_INFO{$os}) &&
+ defined($INSTALL_INFO{$os}{$what}));
+
+ return $INSTALL_INFO{'defaults'}{$what};
+}