aboutsummaryrefslogtreecommitdiffstats
path: root/drop-ld-no-undefined-for-shared-lib-modules-in-libtool
blob: e2d8e67c539e396b24f802265abc1d82f6271d01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl

# applies patch:
# --- ltmain.sh.pix       2008-05-23 13:51:52.000000000 +0200
# +++ ltmain.sh   2008-05-23 13:52:16.000000000 +0200
# @@ -1948,6 +1948,11 @@
#        fi
#      done # argument parsing loop
#  
# +    if test "$module" = yes ; then
# +       # [Manbo-labs] dropping ld option "--no-undefined" which is wrong for plugins
# +       linker_flags=`echo "X $linker_flags" | $Xsed -e 's/ --no-undefined//'`
# +       compiler_flags=`echo "X $compiler_flags" | $Xsed -e 's/ -Wl,--no-undefined//'`
# +    fi
# +
#      if test -n "$prev"; then
#        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
#        $echo "$help" 1>&2

# a similar patch has been applied in ltmain.sh in libtool package
# but this works even if autoreconf is not called

foreach my $ltmain ('ltmain.sh', glob("*/ltmain.sh")) {
    open(my $F, '<', $ltmain) or next;

    print "Modifying $ltmain underlinking for plugins (cf http://wiki.mandriva.com/en/Underlinking)\n";

    open(my $G, '>', "$ltmain.new") or exit;
    while (<$F>) {
	print $G $_;

	if ($_ eq "    done # argument parsing loop\n") {
	    $modified = 1;
	    print $G <<'EOF';

    if test "$module" = yes ; then
    	linker_flags=`echo "X $linker_flags" | $Xsed -e 's/ --no-undefined//'`
    	compiler_flags=`echo "X $compiler_flags" | $Xsed -e 's/ -Wl,--no-undefined//'`
    fi
EOF
	}
    }

    rename $ltmain, "$ltmain.drop" 
      and rename "$ltmain.new", $ltmain or print STDERR "modifying $ltmain failed: $!\n";
}