summaryrefslogtreecommitdiff
path: root/source4/build/smb_build/cflags.pm
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-10-24 08:34:11 +0200
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:43:24 +0100
commit1b8da06a0053086376d5145b2febac176413e0c2 (patch)
tree2ea5284b378bd01dcb350f5ba5271d94338752a4 /source4/build/smb_build/cflags.pm
parent5cfa7732023e38b262b681efdb07c6d9f7d14cd7 (diff)
downloadsamba-1b8da06a0053086376d5145b2febac176413e0c2.tar.gz
samba-1b8da06a0053086376d5145b2febac176413e0c2.tar.bz2
samba-1b8da06a0053086376d5145b2febac176413e0c2.zip
r25711: only use sort if available
metze (This used to be commit 1f5a98cd91f73f8f16d941fe8bb375fec704f0dd)
Diffstat (limited to 'source4/build/smb_build/cflags.pm')
-rwxr-xr-xsource4/build/smb_build/cflags.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/build/smb_build/cflags.pm b/source4/build/smb_build/cflags.pm
index 95f9cac7db..2f2a4a3868 100755
--- a/source4/build/smb_build/cflags.pm
+++ b/source4/build/smb_build/cflags.pm
@@ -6,7 +6,8 @@
package cflags;
use strict;
-use sort 'stable';
+my $sort_available = eval "use sort 'stable'; return 1;";
+$sort_available = 0 unless defined($sort_available);
sub by_path {
return 1 if($a =~ m#^\-I/#);
@@ -29,10 +30,15 @@ sub create_cflags($$$$) {
next unless defined ($key->{FINAL_CFLAGS});
next unless (@{$key->{FINAL_CFLAGS}} > 0);
+ my @sorted_cflags = @{$key->{FINAL_CFLAGS}};
+ if ($sort_available) {
+ @sorted_cflags = sort(by_path, @{$key->{FINAL_CFLAGS}});
+ }
+
# Rewrite CFLAGS so that both the source and the build
# directories are in the path.
my @cflags = ();
- foreach my $flag (sort by_path @{$key->{FINAL_CFLAGS}}) {
+ foreach my $flag (@sorted_cflags) {
if($src_ne_build) {
if($flag =~ m#^-I([^/].*$)#) {
my $dir = $1;