# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Thu Jan 24 16:12:51 EET 2002 [metaconfig 3.0 PL70]
+# Generated on Mon Jan 28 01:36:10 EET 2002 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.org)
cat >c1$$ <<EOF
linux*) # ld won't link with a bare -lperl otherwise.
dflt=libperl.$so
;;
- cygwin*) # include version
- dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
+ cygwin*) # ld links against an importlib
+ dflt=libperl$lib_ext
;;
*) # Try to guess based on whether libc has major.minor.
case "$libc" in
# make sure that all library names are not malformed
libperl=`echo $libperl|sed -e s,\\\..*,,`
-# it would be nice to allow dll to have any name,
-# but for now i insist on 'lib<whatever>.dll'
-if ( ! ( echo $libperl | grep '^lib' >/dev/null ) )
-then
- libperl=lib$libperl
-fi
linklibperl=-l`echo $libperl|sed -e s,^lib,,`
$spitshell >>Makefile <<!GROK!THIS!
# library used to make statically linked executables
# miniperl is linked against it to avoid libperl.dll locking
-$(LIBPERL)s$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj)
+$(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj)
$(AR) rcu $@ perl$(OBJ_EXT) $(cwobj)
# dll and import library
-$(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) ld2
+$(LIBPERL).dll$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) ld2
$(LDLIBPTH) ld2 $(SHRPLDFLAGS) -o $(LIBPERL)$(DLSUFFIX) \
perl$(OBJ_EXT) $(cwobj) $(libs)
# The Module used here must not depend on Config or any extensions.
miniperl.exe \
-miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)s$(LIB_EXT) opmini$(OBJ_EXT)
- $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL)s $(libs)
+miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT)
+ $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
$(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+perl.exe \
+perl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
+ $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+
+pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
+ $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+
+purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
+ $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+
+quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
+ $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+
!NO!SUBS!
;;
*)
$(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
$(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+perl.exe \
+perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
+ $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) -Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic `cat ext.libs` $(libs)
+
+pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
+ $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+
+purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
+ $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+
+quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
+ $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+
!NO!SUBS!
;;
esac
#
$spitshell >>Makefile <<'!NO!SUBS!'
-perl.exe \
-perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
- $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) -Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic `cat ext.libs` $(libs)
-
-pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
- $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
-
-purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
- $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
-
-quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
- $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
!NO!SUBS!
# to be built, special processing is done, else the standard ld is called.
#
-# theese are pretty mandatory
+# these are pretty mandatory
my $CC = '@CC@';
-my $DLLWRAP = '@DLLWRAP@';
-
-# following are optional.
-my $WRAPDRIVER = '@WRAPDRIVER@';
-my $AS = '@AS@';
-my $DLLTOOL = '@DLLTOOL@';
my $EXPORT_ALL = @EXPORT_ALL@;
+
# if some of extensions are undefined,
# no corresponding output will be done.
# most probably, you'd like to have an export library
-my $DEF_EXT = '@DEF_EXT@';
+# my $DEF_EXT = '@DEF_EXT@';
# my $EXP_EXT = '@EXP_EXT@';
my $LIB_EXT = '@LIB_EXT@';
$path =~ s,[/\\](\.[/\\])*,/,g;
}
if ($dllname =~ /\./) { $libname =$`; } else { $libname =$dllname; };
+ my $v_e_r_s = '5_7_2';
+ if ( $dllname =~ /.*perl.*/) {
+ $dllname ="cygperl$v_e_r_s.dll";
+ } else {
$dllname ="$libname.dll";
+ }
$libname ="lib$libname" unless ($libname =~ /^lib/);
print DEBUGFILE "dll name: $dllname\nimport library: $libname\npath: $path\n" if $DEBUG;
- $command ="$DLLWRAP --dllname $dllname";
- $command .=" --driver-name $WRAPDRIVER" if $WRAPDRIVER;
- $command .=" --dlltool $DLLTOOL" if $DLLTOOL;
- $command .=" --export-all-symbols" if $EXPORT_ALL;
- $command .=" --as $AS" if $AS;
- $command .=" --verbose" if $verbose;
+ $command ="$CC -shared -o $dllname";
+# $command .=" --verbose" if $verbose;
- $command .=" --output-def $libname$DEF_EXT" if $DEF_EXT;
- $command .=" --output-exp $libname$EXP_EXT" if $EXP_EXT;
- $command .=" --output-lib $libname$LIB_EXT" if $LIB_EXT;
+ $command .=" -Wl,--output-def=$libname$DEF_EXT" if $DEF_EXT;
+ $command .=" -Wl,--output-exp=$libname$EXP_EXT" if $EXP_EXT;
+ $command .=" -Wl,--out-implib=$libname.dll$LIB_EXT" if $LIB_EXT;
+ $command .=" -Wl,--export-all-symbols" if $EXPORT_ALL;
+ $command .=" -Wl,--enable-auto-import -Wl,--stack,67108864"; # always
# other args are passed through
shellexec("$command \\\n$args\n");
if ($path) {
$command ="mv $dllname";
- $command .=" $libname$LIB_EXT" if $LIB_EXT;
+ $command .=" $libname.dll$LIB_EXT" if $LIB_EXT;
shellexec("$command $path\n");
};
};
if ($Is_Cygwin) {
$perldll = $libperl;
- $perldll =~ s/(\..*)?$/.$dlext/;
+ my $v_e_r_s = $ver; $v_e_r_s =~ tr/./_/;
+ $perldll =~ s/(\..*)?$/$v_e_r_s.$dlext/;
+ $perldll =~ s/^lib/cyg/;
if ($Config{useshrplib} eq 'true') {
# install ld2 and perlld as well
foreach ('ld2', 'perlld') {
copy("$_", "$installbin/$_");
chmod(0755, "$installbin/$_");
};
+ {
+ open (LD2, "$installbin/ld2");
+ print LD2 "#!/bin/sh\n#\n# ld wrapper, passes all args to perlld;\n#\n"
+ . "for trythis in $installbin/perl\ndo\n if [ -x \$trythis ]\n"
+ . " then\n \$trythis $installbin/perlld \"\$\@\"\n"
+ . " exit \$?\n fi\ndone\n# hard luck!\necho i see no perl"
+ . " executable around there\necho perl is required to build "
+ . "dynamic libraries\necho look if the path to perl in /bin/ld2"
+ . " is correct\nexit 1\n";
+ close LD2;
+ };
+ chmod(0755, "$installbin/ld2");
};
} else {
$perldll = 'perl57.' . $dlext;
sub perl_archive
{
+ if ($Config{useshrplib} eq 'true')
+ {
+ my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}";
+ $libperl =~ s/a$/dll.a/;
+ return $libperl;
+ } else {
return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a");
+ }
}
1;
s!-bE:(\S+)!-bE:$perl_exp!;
}
}
- elsif ($^O eq 'cygwin') { # Cygwin needs the libperl copied
+ elsif ($^O eq 'cygwin') { # Cygwin needs the shared libperl copied
my $v_e_r_s = $Config{version};
$v_e_r_s =~ tr/./_/;
- system("cp ../libperl$v_e_r_s.dll ./"); # for test 1
- system("cp ../$Config{'libperl'} ../libperl.a"); # for test 1
+ system("cp ../cygperl$v_e_r_s.dll ./"); # for test 1
}
elsif ($Config{'libperl'} !~ /\Alibperl\./) {
# Everyone needs libperl copied if it's not found by '-lperl'.
unlink($exe,"embed_test.c",$obj);
unlink("$exe$Config{exe_ext}") if $skip_exe;
unlink("embed_test.map","embed_test.lis") if $^O eq 'VMS';
-unlink(glob("./libperl*.dll")) if $^O eq 'cygwin';
-unlink("../libperl.a") if $^O eq 'cygwin';
+unlink(glob("./*.dll")) if $^O eq 'cygwin';
unlink($testlib) if $libperl_copied;
# gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccopts -e ldopts`
# test perl_archive
my $libperl = $Config{libperl} || 'libperl.a';
+$libperl =~ s/.a/.dll.a/;
is( $args->perl_archive(), "\$(PERL_INC)/$libperl",
'perl_archive() should respect libperl setting' );