1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

r25711: only use sort if available

metze
(This used to be commit 1f5a98cd91)
This commit is contained in:
Stefan Metzmacher 2007-10-24 08:34:11 +02:00
parent 5cfa773202
commit 1b8da06a00

View File

@ -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;