!IF "$(ALL_STATIC)" == "define"
# some exclusions, unfortunately, until fixed:
# - MakeMaker isn't capable enough for SDBM_File (small bug)
-# - Encode (encoding search algorithm relies on shared library?)
-STATIC_EXT = * !SDBM_File !Encode
+STATIC_EXT = * !SDBM_File
!ELSE
# specify static extensions here, for example:
# (be sure to include Win32CORE to load Win32 on demand)
$opt{extensions} = join(' ',FindExt::extensions()) || ' ';
$opt{known_extensions} = join(' ',FindExt::known_extensions()) || ' ';
+# Encode is a special case. If we are building Encode as a static
+# extension, we need to explicitly list its subextensions as well.
+# For other nested extensions, this is handled automatically by
+# the appropriate Makefile.PL.
+if ($opt{static_ext} =~ /\bEncode\b/) {
+ foreach my $file (`dir /s /b ..\\cpan\\Encode\\Makefile.PL`) {
+ if ($file =~ /\b(Encode\\.+)\\Makefile\.PL/) {
+ (my $xxx = $1) =~ s|\\|/|g;
+ $opt{static_ext} .= " $xxx";
+ }
+ }
+}
+
my $pl_h = '../patchlevel.h';
if (-e $pl_h) {
.IF "$(ALL_STATIC)" == "define"
# some exclusions, unfortunately, until fixed:
# - MakeMaker isn't capable enough for SDBM_File (small bug)
-# - Encode (encoding search algorithm relies on shared library?)
-# - GCC's linker gets undefined reference to _BZ2_compressBlock
-STATIC_EXT = * !SDBM_File !Encode
+# - GCC's linker gets undefined references to _BZ2_compressBlock and
+# _cp936_encoding, _cp932_encoding and others in Encode/CN.o and Encode/JP.o
+STATIC_EXT = * !SDBM_File
.IF "$(CCTYPE)" == "GCC"
-STATIC_EXT += !Compress/Raw/Bzip2
+STATIC_EXT += !Compress/Raw/Bzip2 !Encode
.ENDIF
.ELSE
# specify static extensions here, for example: