open-src/common/delibtoolize.pl
changeset 241 30e6f29a3171
parent 235 06772554f851
child 341 0a1eb61fd56e
equal deleted inserted replaced
240:ef3f3ac87367 241:30e6f29a3171
    25 # Except as contained in this notice, the name of a copyright holder
    25 # Except as contained in this notice, the name of a copyright holder
    26 # shall not be used in advertising or otherwise to promote the sale, use
    26 # shall not be used in advertising or otherwise to promote the sale, use
    27 # or other dealings in this Software without prior written authorization
    27 # or other dealings in this Software without prior written authorization
    28 # of the copyright holder.
    28 # of the copyright holder.
    29 #
    29 #
    30 # ident	"@(#)delibtoolize.pl	1.7	07/10/10 SMI"
    30 # ident	"@(#)delibtoolize.pl	1.8	07/11/02 SMI"
    31 #
    31 #
    32 
    32 
    33 #
    33 #
    34 # Undo libtool damage to makefiles to allow us to control the linker
    34 # Undo libtool damage to makefiles to allow us to control the linker
    35 # settings that libtool tries to force on us.
    35 # settings that libtool tries to force on us.
    36 #
    36 #
       
    37 # Usage: delibtoolize.pl [-P] <path>
       
    38 # -P - Use large pic flags (-KPIC/-fPIC) instead of default/small (-Kpic/-fpic)
    37 
    39 
    38 use strict;
    40 use strict;
    39 use warnings;
    41 use warnings;
    40 use integer;
    42 use integer;
       
    43 use Getopt::Std;
    41 
    44 
    42 use File::Find;
    45 use File::Find;
       
    46 
       
    47 my %opts;
       
    48 getopts('P', \%opts);
       
    49 
       
    50 my $pic_size = "pic";
       
    51 if (exists($opts{'P'})) {
       
    52   $pic_size = "PIC";
       
    53 }
    43 
    54 
    44 sub process_file {
    55 sub process_file {
    45   if ($_ eq 'Makefile' && -f $_) {
    56   if ($_ eq 'Makefile' && -f $_) {
    46     print "delibtoolizing $File::Find::name...\n";
    57     print "delibtoolizing $File::Find::name...\n";
    47     my $old_file = $_ . '~';
    58     my $old_file = $_ . '~';
    75 
    86 
    76       push @inlines, $l;
    87       push @inlines, $l;
    77     }
    88     }
    78     close($OLD) or die;
    89     close($OLD) or die;
    79 
    90 
    80     my $picflags = '-Kpic -DPIC';
    91     my $picflags = "-K$pic_size -DPIC";
    81     my $sharedobjflags = '-G';
    92     my $sharedobjflags = '-G';
    82 
    93 
    83     if (defined($compiler) && ($compiler =~ m/gcc/)) {
    94     if (defined($compiler) && ($compiler =~ m/gcc/)) {
    84       $picflags = '-fpic -DPIC';
    95       $picflags = "-f$pic_size -DPIC";
    85       $sharedobjflags = '-shared';
    96       $sharedobjflags = '-shared';
    86     }
    97     }
    87 
    98 
    88     my $curtarget = "";
    99     my $curtarget = "";
    89 
   100