# this code has been developped by Somanos Sar from CENA # $Id$ use 5.00404; use Cwd; use Config; use File::Basename; BEGIN { my $IsWin32 = ($^O eq 'MSWin32' || $Config{'ccflags'} =~ /-D_?WIN32_?/); } my %opt = parse_opt(); # Libraries my $tkConfig = $opt{'--tkConfig'}; my $tclConfig = $opt{'--tclConfig'}; $tkConfig = gess_libs('tkConfig.sh') if (!($tkConfig and -d $tkConfig)); $tclConfig = gess_libs('tclConfig.sh') if (!($tclConfig and -d $tclConfig)); my $gl_lib = gess_libs('libGL.so'); if ($gl_lib) { $gl_lib = 'yes'; } else { $gl_lib = 'yes'; } # Directories my $prefix = $Config{'prefix'}; $prefix = $opt{'--prefix'} if ($opt{'--prefix'}); ############################################# # SUBROUTINES ############################################# # Try to guess which library are to be use for tk and tcl sub gess_libs { my $lib_name = shift; print "No $lib_name specified!!! Trying to find it by myself (may be long)...\n"; my @libs = split(/[ \t]+/, $Config{'libpth'}); foreach my $lib (@libs) { my @configs = `find /usr/lib -name $lib_name`; if (@configs) { print "Using $configs[0]\n"; $configs[0] = dirname($configs[0]); return $configs[0]; } } return undef; } # Parse option from command line sub parse_opt { my $args = join(/_IFS_/, @ARGV); my @tokens = split(/_IFS_/, $args); my %options; foreach my $token (@tokens) { my ($key, $value) = split(/[ =]+/, $token); $options{$key} = $value; } return %options; } #print "$tkConfig $tclConfig $prefix $gl_lib // $opt{'--tkConfig'} $opt{'--tclConfig'}\n"; my @args = ("./configure", "--enable-ptk=yes", "--enable-gl=yes", "--enable-gl=$gl_lib", "--enable-shared=yes", "--with-tk=$tkConfig", "--with-tcl=$tclConfig", "--prefix=$prefix", "INSTALL_PERL=\"yes\"" ); print "\nConfiguring with... ", join (' ', @args), "\n"; system (@args);