dougm 01/01/21 12:51:35 Modified: lib/Apache Build.pm Log: only include gtop extras if they exist Revision Changes Path 1.28 +25 -8 modperl-2.0/lib/Apache/Build.pm Index: Build.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- Build.pm 2001/01/21 18:19:56 1.27 +++ Build.pm 2001/01/21 20:51:35 1.28 @@ -65,9 +65,22 @@ #--- Perl Config stuff --- +my @Xlib = qw(/usr/X11/lib /usr/X11R6/lib); + sub gtop_ldopts { - my $xlibs = "-L/usr/X11/lib -L/usr/X11R6/lib -lXau"; - return " -lgtop -lgtop_sysdeps -lgtop_common $xlibs -lintl"; + my $self = shift; + my $xlibs = ""; + + my($path) = $self->find_dlfile('Xau', @Xlib); + if ($path) { + $xlibs = "-L$path -lXau"; + } + + if ($self->find_dlfile('intl')) { + $xlibs .= ' -lintl'; + } + + return " -lgtop -lgtop_sysdeps -lgtop_common $xlibs"; } sub ldopts { @@ -143,23 +156,27 @@ sub libpth { my $self = shift; $self->{libpth} ||= [split /\s+/, $Config{libpth}]; - $self->{libpth}; + return wantarray ? @{ $self->{libpth} } : $self->{libpth}; } sub find_dlfile { - my($self, $name) = @_; + my($self, $name) = (shift, shift); require DynaLoader; require AutoLoader; #eek my $found = 0; - my $path = $self->libpth; + my $loc = ""; + my(@path) = ($self->libpth, @_); - for (@$path) { - last if $found = DynaLoader::dl_findfile($_, "-l$name"); + for (@path) { + if ($found = DynaLoader::dl_findfile($_, "-l$name")) { + $loc = $_; + last; + } } - return $found; + return wantarray ? ($loc, $found) : $found; } sub find_dlfile_maybe {