IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33984


Ignore:
Timestamp:
Jun 1, 2012, 5:46:01 PM (14 years ago)
Author:
eugene
Message:

add code to determine hidden search paths from ld and cpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120601/psconfig/pschecklibs

    r26273 r33984  
    142142unshift @incpath, $incdir;
    143143
     144# get a list of implicit paths from cpp directly
     145&checkpreprocessor ();
     146
     147# get a list of implicit paths from the linker directly
     148&checklinker ();
     149
    144150# add the system paths specified for each architecture
    145151&checkarch ();
    146152print "setting architecture to: $arch\n";
    147153print "searching for libraries in: @libpath\n";
     154print "searching for headers in: @incpath\n";
    148155print "searching for programs in: @binpath\n";
    149156print "\n";
     
    404411                $path = "$topdir/$subdir";
    405412            }
    406             # print "trying $path\n";
    407413            if (! -e $path) { next; }
    408414            $binname = "$path/$name";
     
    441447}
    442448
     449sub checklinker {
     450    # we are going to supplement the libpath with entries reported by
     451    # the linker (this depends on ld --verbose
     452
     453    my $line, @lines;
     454    my $item, @items;
     455
     456    @lines = `ld --verbose | grep SEARCH_DIR`;
     457    foreach $line (@lines) {
     458        # we expect items of the form SEARCH_DIR("path");
     459        # or SEARCH_DIR("=path") -- in that case we should prepend sysroo
     460        next unless ($line =~ m|SEARCH_DIR|);
     461        @items = split (";", $line);
     462        foreach $item (@items) {
     463            next unless ($item);
     464            ($p1) = $item =~ m|SEARCH_DIR\050"=(\S*)"|;
     465            ($p2) = $item =~ m|SEARCH_DIR\050"(\S*)"|;
     466            next if (!$p1 && !$p2);
     467            if (!$p1 && $p2) {
     468                push @libpath, $p2;
     469            }
     470            if ($p1 && $p2) {
     471                push @libpath, $p1;
     472            }
     473            if ($p1 && !$p2) {
     474                print "programming error!\n";
     475                exit 4;
     476            }
     477        }
     478    }
     479    return 0;
     480}
     481
     482sub checkpreprocessor {
     483    # we are going to supplement the libpath with entries reported by
     484    # the linker (this depends on ld --verbose
     485
     486### #include <...> search starts here:
     487###  /home/eugene/src/psconfig/ipp-dev.linux/include
     488###  .
     489###  /usr/lib/gcc/i686-linux-gnu/4.6/include
     490###  /usr/local/include
     491###  /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed
     492###  /usr/include/i386-linux-gnu
     493###  /usr/include
     494### End of search list.
     495
     496    my $line, @lines;
     497    my $found_start;
     498
     499    @lines = `cpp --verbose < /dev/null 2>&1`;
     500    $found_start = 0;
     501    foreach $line (@lines) {
     502        if (!$found_start) {
     503            if ($line =~ m|include \<...\> search starts here|) {
     504                $found_start = 1;
     505                next;
     506            } else {
     507                next;
     508            }
     509        }
     510        chomp $line;
     511        if ($line =~ m|End of search list|) {
     512            return 1;
     513        }
     514        ($cleanline) = $line =~ m|\s*(\S*)|;
     515        push @incpath, $cleanline;
     516    }
     517    return 0;
     518}
     519
    443520sub checkarch {
    444521    # we are going to supplement the global libpath supplied
Note: See TracChangeset for help on using the changeset viewer.