IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18707


Ignore:
Timestamp:
Jul 24, 2008, 9:38:54 AM (18 years ago)
Author:
Paul Price
Message:

Pick up /usr/local/lib before /usr/lib

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psconfig/pschecklibs

    r17598 r18707  
    55# default system library locations
    66@binpath = ( );
    7 @libpath = ( "/lib", "/usr/lib", "/usr/X11R6/lib", "/usr/local/lib" );
    8 @incpath = ( "/usr/include", "/usr/local/include", "/usr/X11R6/include" );
     7@libpath = ( "/usr/local/lib", "/usr/lib", "/usr/X11R6/lib", "/lib" );
     8@incpath = ( "/usr/local/include", "/usr/include", "/usr/X11R6/include" );
    99
    1010$version = "";
     
    1414for (; @ARGV > 0; ) {
    1515    if ($ARGV[0] eq "-version") {
    16         $version = $ARGV[1];
     16        $version = $ARGV[1];
    1717        shift; shift; next;
    1818    }
    1919    if ($ARGV[0] eq "-build") {
    20         $build = 1;
     20        $build = 1;
    2121        shift; next;
    2222    }
    2323    if ($ARGV[0] eq "-force") {
    24         if (@ARGV < 2) { die "-force must be coupled to a library name\n"; }
    25         $force = $ARGV[1];
     24        if (@ARGV < 2) { die "-force must be coupled to a library name\n"; }
     25        $force = $ARGV[1];
    2626        shift; shift; next;
    2727    }
     
    3737if ( @ARGV > 1) { &usage(); }
    3838
    39 if ( @ARGV == 0) { 
     39if ( @ARGV == 0) {
    4040    @list = <$tagsets/*.libs>;
    4141    $file = $list[-1];
     
    110110# add the system paths specified for each architecture
    111111&checkarch ();
    112 print "setting architecture to: $arch\n"; 
     112print "setting architecture to: $arch\n";
    113113print "searching for libraries in: @libpath\n";
    114114print "searching for programs in: @binpath\n";
     
    131131
    132132    if ($force ne "") {
    133         if ($force eq $name or (lc($force) eq "all" and lc($tarball) ne "none")) {
    134             &buildlib ($name, $tarball, $tardir, $use_equals, $configure_opts, $make_opts, $install_opts);
    135 #           exit 0;
    136         }
    137         next;
     133        if ($force eq $name or (lc($force) eq "all" and lc($tarball) ne "none")) {
     134            &buildlib ($name, $tarball, $tardir, $use_equals, $configure_opts, $make_opts, $install_opts);
     135#           exit 0;
     136        }
     137        next;
    138138    }
    139139
    140140    ## check for the C library
    141     if ($type eq "lib") { 
    142         $found = &checklib ($name, $altnames, $altpaths);
    143     } 
    144     if ($type eq "bin") { 
    145         $found = &checkbin ($name, $altnames, $altpaths);
    146     }   
    147     if ($type eq "inc") { 
    148         $found = &checkinc ($name, $altnames, $altpaths);
    149     }   
     141    if ($type eq "lib") {
     142        $found = &checklib ($name, $altnames, $altpaths);
     143    }
     144    if ($type eq "bin") {
     145        $found = &checkbin ($name, $altnames, $altpaths);
     146    }
     147    if ($type eq "inc") {
     148        $found = &checkinc ($name, $altnames, $altpaths);
     149    }
    150150
    151151    if ($found) {
    152         print "pass $name ($found)\n";
    153         next;
     152        print "pass $name ($found)\n";
     153        next;
    154154    } else {
    155         print "fail $name\n";
    156         push @faillibs, "$name";
    157     }   
     155        print "fail $name\n";
     156        push @faillibs, "$name";
     157    }
    158158
    159159    if (! $build) { next; }
    160160    if ($type eq "inc") {
    161         print "ERROR: missing header file from library which is supposedly installed\n";
    162         # Will attempt to install library.
     161        print "ERROR: missing header file from library which is supposedly installed\n";
     162        # Will attempt to install library.
    163163    }
    164164    &buildlib ($name, $tarball, $tardir, $use_equals, $configure_opts, $make_opts, $install_opts);
     
    170170    print "The following C libraries are missing from your system\n";
    171171    foreach $name (@faillibs) {
    172         print "  $name\n";
     172        print "  $name\n";
    173173    }
    174174    print "\n";
     
    184184
    185185    if ($tarball eq "NONE") {
    186         print "No tarball available for $name.  You'll have to build it yourself.\n";
    187         exit 1;
     186        print "No tarball available for $name.  You'll have to build it yourself.\n";
     187        exit 1;
    188188    }
    189189
    190190    if ($name eq "libz") {
    191         # zlib doesn't like the full list of arguments to configure
    192         $psconfigure = "./configure --prefix=$prefix";
     191        # zlib doesn't like the full list of arguments to configure
     192        $psconfigure = "./configure --prefix=$prefix";
    193193    } else {
    194         $psconfigure = `csh psconfig.csh --psconfigure $version`; chomp $psconfigure;
     194        $psconfigure = `csh psconfig.csh --psconfigure $version`; chomp $psconfigure;
    195195    }
    196196
     
    204204    print "extract $name from $tarball\n";
    205205    vsystem ("tar xvzf $tarball");
    206    
     206
    207207    print "tardir: $tardir\n";
    208208
     
    211211
    212212    # build the library using psconfigure, make, make install
    213     if ($configure_opts eq "NONE") { 
    214         vsystem ("$psconfigure");
     213    if ($configure_opts eq "NONE") {
     214        vsystem ("$psconfigure");
    215215    } else {
    216         $configure_opts = join (' ', split (',', $configure_opts));
    217         vsystem ("$psconfigure $configure_opts");
     216        $configure_opts = join (' ', split (',', $configure_opts));
     217        vsystem ("$psconfigure $configure_opts");
    218218    }
    219219    if ($?) { &failure($name, "failure in configure"); }
    220    
    221     if ($make_opts eq "NONE") { 
    222         vsystem ("make");
     220
     221    if ($make_opts eq "NONE") {
     222        vsystem ("make");
    223223    } else {
    224         $make_opts = join (' ', split (',', $make_opts));
    225         vsystem ("make $make_opts");
     224        $make_opts = join (' ', split (',', $make_opts));
     225        vsystem ("make $make_opts");
    226226    }
    227227    if ($?) { &failure($name, "failure in make"); }
    228228
    229229    if ($install_opts eq "NONE") {
    230         vsystem ("make install");
     230        vsystem ("make install");
    231231    } else {
    232         $install_opts = join (' ', split (',', $install_opts));
    233         vsystem ("make install $install_opts");
     232        $install_opts = join (' ', split (',', $install_opts));
     233        vsystem ("make install $install_opts");
    234234    }
    235235    if ($?) { &failure($name, "failure in make install"); }
     
    243243    my $altnames = $_[1];
    244244    my $altpaths = $_[2];
    245    
     245
    246246    @subdirs = ".";
    247247    if ($altpaths ne "NONE") {
    248         @altpaths = split (',', $altpaths);
    249         push @subdirs, @altpaths;
    250     }
    251    
     248        @altpaths = split (',', $altpaths);
     249        push @subdirs, @altpaths;
     250    }
     251
    252252    @trynames = ($name);
    253253    if ($altnames ne "NONE") {
    254         @altnames = split (',', $altnames);
    255         push @trynames, @altnames;
     254        @altnames = split (',', $altnames);
     255        push @trynames, @altnames;
    256256    }
    257257
    258258    # try each of the possible library names
    259     foreach $tryname (@trynames) { 
    260         # try each of the library paths, with the default as well as each altpath
    261         foreach $topdir ( @libpath ) {
    262             foreach $subdir ( @subdirs ) {
    263                 if ($subdir eq ".") {
    264                     $path = $topdir;
    265                 } else {
    266                     $path = "$topdir/$subdir";
    267                 }
    268                 # print "trying $path\n";
    269                 if (! -e $path) { next; }
    270                 $libname = "$path/$tryname.a";
    271                 if (-e $libname) { return $libname; }
    272                 # print "no $libname\n";
    273                 $libname = "$path/$tryname.$dlltype";
    274                 if (-e $libname) { return $libname; }
    275                 # print "no $libname\n";
    276             }
    277         }
    278 
    279         # if we failed to find the basic named library files, try the
    280         # versions libraries if we find only a .so.N without a matching
    281         # .so, we link this in the installed libdir
    282         foreach $topdir ( @libpath ) {
    283             foreach $subdir ( @subdirs ) {
    284                 if ($subdir eq ".") {
    285                     $path = $topdir;
    286                 } else {
    287                     $path = "$topdir/$subdir";
    288                 }
    289                 if (! -e $path) { next; }
    290                 @libnames = <$path/$tryname.$dlltype*>;
    291                 if (@libnames > 0) {
    292                     $libname = @libnames[-1];
    293                     # print "making link to numbered .$dlltype library $libdir/$f.$dlltype\n";
    294                     symlink $libname, "$libdir/$f.$dlltype";
    295                     if ($?) { exit 1; }
    296                     return $libname;
    297                 }
    298                 # print "no $path/$tryname.$dlltype*\n";
    299             }
    300         }
     259    foreach $tryname (@trynames) {
     260        # try each of the library paths, with the default as well as each altpath
     261        foreach $topdir ( @libpath ) {
     262            foreach $subdir ( @subdirs ) {
     263                if ($subdir eq ".") {
     264                    $path = $topdir;
     265                } else {
     266                    $path = "$topdir/$subdir";
     267                }
     268                # print "trying $path\n";
     269                if (! -e $path) { next; }
     270                $libname = "$path/$tryname.a";
     271                if (-e $libname) { return $libname; }
     272                # print "no $libname\n";
     273                $libname = "$path/$tryname.$dlltype";
     274                if (-e $libname) { return $libname; }
     275                # print "no $libname\n";
     276            }
     277        }
     278
     279        # if we failed to find the basic named library files, try the
     280        # versions libraries if we find only a .so.N without a matching
     281        # .so, we link this in the installed libdir
     282        foreach $topdir ( @libpath ) {
     283            foreach $subdir ( @subdirs ) {
     284                if ($subdir eq ".") {
     285                    $path = $topdir;
     286                } else {
     287                    $path = "$topdir/$subdir";
     288                }
     289                if (! -e $path) { next; }
     290                @libnames = <$path/$tryname.$dlltype*>;
     291                if (@libnames > 0) {
     292                    $libname = @libnames[-1];
     293                    # print "making link to numbered .$dlltype library $libdir/$f.$dlltype\n";
     294                    symlink $libname, "$libdir/$f.$dlltype";
     295                    if ($?) { exit 1; }
     296                    return $libname;
     297                }
     298                # print "no $path/$tryname.$dlltype*\n";
     299            }
     300        }
    301301    }
    302302    return 0;
     
    307307    my $altnames = $_[1];
    308308    my $altpaths = $_[2];
    309    
     309
    310310    # XXX drop this for bin?
    311311    @subdirs = ".";
    312312    if ($altpaths ne "NONE") {
    313         @altpaths = split (',', $altpaths);
    314         push @subdirs, @altpaths;
    315     }
    316    
     313        @altpaths = split (',', $altpaths);
     314        push @subdirs, @altpaths;
     315    }
     316
    317317    # try each of the library paths, with the default as well as each altpath
    318318    foreach $topdir ( @binpath ) {
    319         foreach $subdir ( @subdirs ) {
    320             if ($subdir eq ".") {
    321                 $path = $topdir;
    322             } else {
    323                 $path = "$topdir/$subdir";
    324             }
    325             # print "trying $path\n";
    326             if (! -e $path) { next; }
    327             $binname = "$path/$name";
    328             if (-e $binname) { return $binname; }
    329         }
     319        foreach $subdir ( @subdirs ) {
     320            if ($subdir eq ".") {
     321                $path = $topdir;
     322            } else {
     323                $path = "$topdir/$subdir";
     324            }
     325            # print "trying $path\n";
     326            if (! -e $path) { next; }
     327            $binname = "$path/$name";
     328            if (-e $binname) { return $binname; }
     329        }
    330330    }
    331331    return 0;
     
    336336    my $altnames = $_[1];
    337337    my $altpaths = $_[2];
    338    
     338
    339339    @subdirs = ".";
    340340    if ($altpaths ne "NONE") {
    341         @altpaths = split (',', $altpaths);
    342         push @subdirs, @altpaths;
    343     }
    344    
     341        @altpaths = split (',', $altpaths);
     342        push @subdirs, @altpaths;
     343    }
     344
    345345    # try each of the library paths, with the default as well as each altpath
    346346    foreach $topdir ( @incpath ) {
    347         foreach $subdir ( @subdirs ) {
    348             if ($subdir eq ".") {
    349                 $path = $topdir;
    350             } else {
    351                 $path = "$topdir/$subdir";
    352             }
    353             if (! -e $path) { next; }
    354             $incname = "$path/$name";
    355             if (-e $incname) { return $incname; }
    356         }
     347        foreach $subdir ( @subdirs ) {
     348            if ($subdir eq ".") {
     349                $path = $topdir;
     350            } else {
     351                $path = "$topdir/$subdir";
     352            }
     353            if (! -e $path) { next; }
     354            $incname = "$path/$name";
     355            if (-e $incname) { return $incname; }
     356        }
    357357    }
    358358
     
    362362sub checkarch {
    363363    # we are going to supplement the global libpath supplied
    364    
     364
    365365    # check the hardware architecture:
    366366    $sys=`uname -s`; chomp $sys;
     
    371371
    372372    if ($sys eq "IRIX64") {
    373         $arch = "irix";
    374         return;
     373        $arch = "irix";
     374        return;
    375375    }
    376376
    377377    if ($sys eq "SunOS") {
    378         $ver=`uname -r | awk '{print substr($1,1,1)}'`;
    379         if ($ver == 5) {
    380             $arch = "sol";
    381         } else {
    382             $arch="sun4";
    383         }
    384 
    385         # sun (at least) seems to need the socket library (linux does not)
    386         push @libpath, "/usr/openwin/lib";
    387         push @incpath, "/usr/openwin/include";
    388 
    389         # XXX this is a problem
    390         print STDERR "need to add system dependent libraries (eg, libsocket, libnsl)\n";
    391         exit 1;
    392         $needlibs = "$needlibs libsocket libnsl";
    393         $ranlib = "touch";
    394         return;
     378        $ver=`uname -r | awk '{print substr($1,1,1)}'`;
     379        if ($ver == 5) {
     380            $arch = "sol";
     381        } else {
     382            $arch="sun4";
     383        }
     384
     385        # sun (at least) seems to need the socket library (linux does not)
     386        push @libpath, "/usr/openwin/lib";
     387        push @incpath, "/usr/openwin/include";
     388
     389        # XXX this is a problem
     390        print STDERR "need to add system dependent libraries (eg, libsocket, libnsl)\n";
     391        exit 1;
     392        $needlibs = "$needlibs libsocket libnsl";
     393        $ranlib = "touch";
     394        return;
    395395    }
    396396
    397397    if ($sys eq "Linux") {
    398         $arch = "linux";
    399 
    400         if (-e "/etc/sidious.config") {
    401             $arch = "sid";
    402             return;
    403         }
    404 
    405         $mach = `uname -m`; chomp $mach;
    406 
    407         if ($mach eq "x86_64") {
    408             $arch = "lin64";
    409             unshift @libpath, "/lib64";
    410             unshift @libpath, "/usr/lib64";
    411             unshift @libpath, "/usr/X11R6/lib64";
    412             return;
    413         }
    414         return;
     398        $arch = "linux";
     399
     400        if (-e "/etc/sidious.config") {
     401            $arch = "sid";
     402            return;
     403        }
     404
     405        $mach = `uname -m`; chomp $mach;
     406
     407        if ($mach eq "x86_64") {
     408            $arch = "lin64";
     409            unshift @libpath, "/lib64";
     410            unshift @libpath, "/usr/lib64";
     411            unshift @libpath, "/usr/X11R6/lib64";
     412            return;
     413        }
     414        return;
    415415    }
    416416
     
    430430
    431431    if ($sys eq "HP-UX") {
    432         $arch = "hpux";
    433         return;
    434     }
    435    
     432        $arch = "hpux";
     433        return;
     434    }
     435
    436436    print "unknown architecture";
    437437    exit 1;
     
    452452    @list = <$tagsets/*.perl>;
    453453    foreach $line (@list) {
    454         chomp $line;
    455         ($dist) = $line =~ m|$tagsets/(\S*).perl|;
    456         print STDERR "$dist\n";
     454        chomp $line;
     455        ($dist) = $line =~ m|$tagsets/(\S*).perl|;
     456        print STDERR "$dist\n";
    457457    }
    458458    exit 2;
Note: See TracChangeset for help on using the changeset viewer.