From 1b8da06a0053086376d5145b2febac176413e0c2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 24 Oct 2007 08:34:11 +0200 Subject: r25711: only use sort if available metze (This used to be commit 1f5a98cd91f73f8f16d941fe8bb375fec704f0dd) --- source4/build/smb_build/cflags.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source4/build/smb_build') 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; -- cgit