-#!/usr/bin/perl
-use ExtUtils::MakeMaker;
-use Getopt::Std;
-use Config;
-$ARCHNAME = $Config{archname};
-use File::Basename;
-
-getopts('e'); # embedding?
-
-$CCFLAGS .= $ENV{CCFLAGS} if defined $ENV{CCFLAGS};
-
-# $USE_KAFFE is a boolean that tells us whether or not we should use Kaffe.
-# Set by find_includes (it seemed as good a place as any).
-
-# Note that we don't check to see the version of Kaffe is one we support.
-# Currently, the only one we support is the one from CVS.
-
-my $USE_KAFFE = 0;
-
-#require "JNIConfig";
-
-if ($^O eq 'solaris') {
- $LIBPATH = " -R$Config{archlib}/CORE -L$Config{archlib}/CORE";
-} elsif ($^O eq 'MSWin32') {
- $LIBPATH = " -L$Config{archlib}\\CORE";
- # MSR - added MS VC++ default library path
- # bjepson - fixed to support path names w/spaces in them.
- push(@WINLIBS, (split"\;",$ENV{LIB}));
- grep s/\\$//, @WINLIBS; # eliminate trailing \
- grep s/\/$//, @WINLIBS; # eliminate trailing /
- $LIBPATH .= join(" ", "", map { qq["-L$_" ] } @WINLIBS);
-} else {
- $LIBPATH = " -L$Config{archlib}/CORE";
-}
-#$LIBS = " -lperl";
-
-# Figure out where Java might live
-#
-# MSR - added JDK 1.3
-#
-
-my @JAVA_HOME_GUESSES = qw(/usr/local/java /usr/java /usr/local/jdk117_v3
- C:\\JDK1.1.8 C:\\JDK1.2.1 C:\\JDK1.2.2 C:\\JDK1.3 );
-
-my @KAFFE_PREFIX_GUESSES = qw(/usr/local /usr);
-
-if (! defined $ENV{JAVA_HOME}) {
- print "You didn't define JAVA_HOME, so I'm trying a few guesses.\n";
- print "If this fails, you might want to try setting JAVA_HOME and\n";
- print "running me again.\n";
-} else {
- @JAVA_HOME_GUESSES = ( $ENV{JAVA_HOME} );
-}
-
-if (! defined $ENV{KAFFE_PREFIX}) {
- print "\nYou didn't define KAFFE_PREFIX, so I'm trying a few guesses.",
- "\nIf this fails, and you are using Kaffe, you might want to try\n",
- "setting KAFFE_PREFIX and running me again.\n",
- "If you want to ignore any possible Kaffe installation, set the\n",
- "KAFFE_PREFIX to and empty string.\n\n";
-} else {
- @KAFFE_PREFIX_GUESSES = ($ENV{KAFFE_PREFIX} eq "") ? () :
- ( $ENV{KAFFE_PREFIX} );
-}
-
-my(@KAFFE_INCLUDE_GUESSES, @KAFFE_LIB_GUESSES);
-foreach my $kaffePrefix (@KAFFE_PREFIX_GUESSES) {
- push(@KAFFE_INCLUDE_GUESSES, "$kaffePrefix/include/kaffe");
- push(@KAFFE_LIB_GUESSES, "$kaffePrefix/lib");
- push(@KAFFE_LIB_GUESSES, "$kaffePrefix/lib/kaffe");
-}
- $guess .= "/include/kaffe";
-
-# Let's find out where jni.h lives
-#
-my @INCLUDE = find_includes();
-
-if ($^O eq 'MSWin32') {
- # MSR - added MS VC++ default include path
- push(@INCLUDE,(split"\;",$ENV{INCLUDE}));
- grep s/\\$//, @INCLUDE; # remove trailing \
- grep s/\/$//, @INCLUDE; # remove trailing \
- $INC = join("", map { qq["-I$_" ] } @INCLUDE);
-
-} else {
- $INC = join(" -I", ("", @INCLUDE));
-}
-
-# Let's find out the name of the Java shared library
-#
-my @JAVALIBS = find_libs();
-
-# Find out some defines based on the library we are linking to
-#
-foreach (@JAVALIBS) {
- if ( $^O eq 'MSWin32') { # We're on Win32
- $INC =~ s#/#\\#g;
- $INC =~ s#\\$##;
- print $INC, "\n";
- $CCFLAGS .= " -DWIN32 -Z7 -D_DEBUG";
- $MYEXTLIB = "$libjava";
- }
-}
-
-$CCFLAGS .= " -DKAFFE" if ($USE_KAFFE);
-
-# Let's find out the path of the library we need to link against.
-#
-foreach (@JAVALIBS) {
- if ($^O eq 'MSWin32') { # We're on Win32
- $_ =~ s#/#\\\\#g;
- }
- my ($libname, $libpath, $libsuffix) = fileparse($_, ("\.so", "\.lib"));
- $libname =~ s/^lib//;
- if ($^O eq 'solaris') {
- $LIBPATH .= " -R$libpath -L$libpath"
- } else {
- $LIBPATH .= " -L$libpath"
- }
- $LIBS .= " -l$libname";
-}
-
-# Do we need -D_REENTRANT?
-if ($LIBPATH =~ /native/) {
- print "Looks like native threads...\n";
- $CCFLAGS .= " -D_REENTRANT";
-}
-
-if ($opt_e) {
- print "We're embedding Perl in Java via libPerlInterpreter.so.\n";
- eval `../setvars -perl`;
- $CCFLAGS .= " -DEMBEDDEDPERL";
- $LIBPATH .= " -R$ENV{JPL_HOME}/lib/$ARCHNAME -L$ENV{JPL_HOME}/lib/$ARCHNAME";
- $LIBS .= " -lPerlInterpreter";
-}
-
-# Needed for JNI.
-if ($^O eq 'solaris') {
- $LIBS = " -lthread -lc $LIBS"; #-lthread must be first!!!
- $CCFLAGS .= " -D_REENTRANT";
-}
-
-# MSR - clean up LIBS
-$LIBS =~ s/-l$//;
-
-#
-# Next, build JNI/Config.pm. This is a superfluous thing for the SUN and
-# Microsoft JDKs, but absolutely necessary for Kaffe. I think at some
-# point, the Microsoft and SUN implementations should use JNI::Config, too.
-#
-
-if (! -d "JNI") {
- mkdir("JNI", 0755) || die "Unable to make JNI directory: $!";
-}
-open(JNICONFIG, ">JNI/Config.pm") || die "Unable to open JNI/Config.pm: $!";
-
-print JNICONFIG "# DO NOT EDIT! Autogenerated by JNI/Makefile.PL\n\n",
- "package JNI::Config;\nuse strict;\nuse Carp;\n",
- "\nuse vars qw(\$KAFFE \$LIB_JAVA \$CLASS_HOME ",
- "\$LIB_HOME);\n\n",
- "\$KAFFE = $USE_KAFFE;\n\$LIB_JAVA = \"$JAVALIBS[0]\";\n";
-if ($USE_KAFFE) {
- my $path = $JAVALIBS[0];
- $path =~ s%/(kaffe/)?libkaffevm.so$%%;
-
- print JNICONFIG "\$LIB_HOME = \"$path/kaffe\";\n";
- $path =~ s%/lib%%;
- print JNICONFIG "\$CLASS_HOME = \"$path/share/kaffe\";\n";
-}
-print JNICONFIG "\n\n1;\n";
-close JNICONFIG;
-
-
-my %Makefile = (
- NAME => 'JNI',
- VERSION_FROM => 'JNI.pm',
- DEFINE => '',
- LINKTYPE => 'dynamic',
- INC => $INC,
- CCFLAGS => "$Config{ccflags} $CCFLAGS",
- ($Config{archname} =~ /mswin32.*-object/i ? ('CAPI' => 'TRUE') : ()),
-
- clean => {FILES => "JNI/* JNI"}
-);
-
-$Makefile{LIBS} = ["$LIBPATH $LIBS"];
-if ($MYEXTLIB) {
- $Makefile{MYEXTLIB} = $MYEXTLIB;
-}
-
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
-#
-WriteMakefile(%Makefile);
-
-if ($USE_KAFFE) {
- my $path = $JAVALIBS[0];
- $path =~ s%/libkaffevm.so$%%;
- print "\n\n***NOTE: be sure to have:\n",
- " LD_LIBRARY_PATH=$path\n",
- " in your enviornment (or installed as a system dynamic\n",
- " library location) when you compile and run this.\n";
-}
-
-# subroutine to find a library
-#
-sub find_stuff {
-
- my ($candidates, $locations) = @_;
- my $lib;
- $wanted = sub {
- foreach my $name (@$candidates) {
- if (/$name$/ and ! /green_threads/ and !/include-old/) {
- $lib = $File::Find::name;
- }
- }
- };
-
- use File::Find;
- foreach my $guess (@$locations) {
- next unless -d $guess;
- find (\&$wanted, $guess);
- }
- if (! $lib) {
- print "Could not find @$candidates\n";
- } else {
- print "Found @$candidates as $lib\n\n";
- }
- return $lib;
-}
-
-# Extra lib for Java 1.2
-#
-# if we want KAFFE, check for it, otherwise search for Java
-
-sub find_libs {
- my($libjava, $libawt, $libjvm);
-
- if ($USE_KAFFE) {
- $libjava = find_stuff(['libkaffevm.so'], \@KAFFE_LIB_GUESSES);
- $libawt = find_stuff(['libawt.so'], \@KAFFE_LIB_GUESSES);
- } else {
- $libjava = find_stuff(['libjava.so', 'javai.lib', 'jvm.lib'],
- \@JAVA_HOME_GUESSES);
- $libjvm = find_stuff(['libjvm.so'], \@JAVA_HOME_GUESSES);
- $libawt = find_stuff(['libawt.so'], \@JAVA_HOME_GUESSES);
- if (defined $libjvm) { # JDK 1.2
- my $libhpi = find_stuff(['libhpi.so'], \@JAVA_HOME_GUESSES);
- return($libjava, $libjvm, $libhpi, $libawt);
- }
- }
- return($libjava, $libawt);
-}
-
-# We need to find jni.h and jni_md.h
-#
-
-# Always do find_includes as the first operation, as it has the side effect
-# of deciding whether or not we are looking for Kaffe. --bkuhn
-
-sub find_includes {
-
- my @CANDIDATES = qw(jni.h jni_md.h);
- my @includes;
-
- sub find_inc {
- foreach my $name (@CANDIDATES) {
- if (/$name$/) {
- my ($hname, $hpath, $hsuffix) =
- fileparse($File::Find::name, ("\.h", "\.H"));
- unless ($hpath =~ /include-old/) {
- print "Found $hname$hsuffix in $hpath\n";
- push @includes, $hpath;
- }
- }
- }
- }
-
- use File::Find;
- foreach my $guess (@KAFFE_INCLUDE_GUESSES) {
- next unless -d $guess;
- find (\&find_inc, $guess);
- }
- # If we have found includes, then we are using Kaffe.
- if (@includes > 0) {
- $USE_KAFFE = 1;
- } else {
- foreach my $guess (@JAVA_HOME_GUESSES) {
- next unless -d $guess;
- find (\&find_inc, $guess);
- }
- }
- die "Could not find Java includes!" unless (@includes);
-
- return @includes;
-}
-
+#!/usr/bin/perl\r
+use ExtUtils::MakeMaker;\r
+use Getopt::Std;\r
+use Config;\r
+$ARCHNAME = $Config{archname};\r
+use File::Basename;\r
+\r
+getopts('e'); # embedding?\r
+\r
+$CCFLAGS .= $ENV{CCFLAGS} if defined $ENV{CCFLAGS};\r
+\r
+# $USE_KAFFE is a boolean that tells us whether or not we should use Kaffe.\r
+# Set by find_includes (it seemed as good a place as any).\r
+\r
+# Note that we don't check to see the version of Kaffe is one we support.\r
+# Currently, the only one we support is the one from CVS.\r
+\r
+my $USE_KAFFE = 0;\r
+\r
+#require "JNIConfig";\r
+\r
+if ($^O eq 'solaris') {\r
+ $LIBPATH = " -R$Config{archlib}/CORE -L$Config{archlib}/CORE";\r
+} elsif ($^O eq 'MSWin32') {\r
+ $LIBPATH = " -L$Config{archlib}\\CORE";\r
+ # MSR - added MS VC++ default library path\r
+ # bjepson - fixed to support path names w/spaces in them.\r
+ push(@WINLIBS, (split"\;",$ENV{LIB}));\r
+ grep s/\\$//, @WINLIBS; # eliminate trailing \\r
+ grep s/\/$//, @WINLIBS; # eliminate trailing /\r
+ $LIBPATH .= join(" ", "", map { qq["-L$_" ] } @WINLIBS);\r
+} else {\r
+ $LIBPATH = " -L$Config{archlib}/CORE";\r
+}\r
+#$LIBS = " -lperl";\r
+\r
+# Figure out where Java might live\r
+#\r
+# MSR - added JDK 1.3\r
+#\r
+\r
+my @JAVA_HOME_GUESSES = qw(/usr/local/java /usr/java /usr/local/jdk117_v3\r
+ C:\\JDK1.1.8 C:\\JDK1.2.1 C:\\JDK1.2.2 C:\\JDK1.3 );\r
+\r
+my @KAFFE_PREFIX_GUESSES = qw(/usr/local /usr);\r
+\r
+if (! defined $ENV{JAVA_HOME}) {\r
+ print "You didn't define JAVA_HOME, so I'm trying a few guesses.\n";\r
+ print "If this fails, you might want to try setting JAVA_HOME and\n";\r
+ print "running me again.\n";\r
+} else {\r
+ @JAVA_HOME_GUESSES = ( $ENV{JAVA_HOME} );\r
+}\r
+\r
+if (! defined $ENV{KAFFE_PREFIX}) {\r
+ print "\nYou didn't define KAFFE_PREFIX, so I'm trying a few guesses.",\r
+ "\nIf this fails, and you are using Kaffe, you might want to try\n",\r
+ "setting KAFFE_PREFIX and running me again.\n",\r
+ "If you want to ignore any possible Kaffe installation, set the\n",\r
+ "KAFFE_PREFIX to and empty string.\n\n";\r
+} else {\r
+ @KAFFE_PREFIX_GUESSES = ($ENV{KAFFE_PREFIX} eq "") ? () :\r
+ ( $ENV{KAFFE_PREFIX} );\r
+}\r
+\r
+my(@KAFFE_INCLUDE_GUESSES, @KAFFE_LIB_GUESSES);\r
+foreach my $kaffePrefix (@KAFFE_PREFIX_GUESSES) {\r
+ push(@KAFFE_INCLUDE_GUESSES, "$kaffePrefix/include/kaffe");\r
+ push(@KAFFE_LIB_GUESSES, "$kaffePrefix/lib");\r
+ push(@KAFFE_LIB_GUESSES, "$kaffePrefix/lib/kaffe");\r
+}\r
+ $guess .= "/include/kaffe";\r
+\r
+# Let's find out where jni.h lives\r
+#\r
+my @INCLUDE = find_includes();\r
+\r
+if ($^O eq 'MSWin32') {\r
+ # MSR - added MS VC++ default include path\r
+ push(@INCLUDE,(split"\;",$ENV{INCLUDE}));\r
+ grep s/\\$//, @INCLUDE; # remove trailing \\r
+ grep s/\/$//, @INCLUDE; # remove trailing \\r
+ $INC = join("", map { qq["-I$_" ] } @INCLUDE);\r
+\r
+} else {\r
+ $INC = join(" -I", ("", @INCLUDE));\r
+}\r
+\r
+# Let's find out the name of the Java shared library\r
+#\r
+my @JAVALIBS = find_libs();\r
+\r
+# Find out some defines based on the library we are linking to\r
+#\r
+foreach (@JAVALIBS) {\r
+ if ( $^O eq 'MSWin32') { # We're on Win32\r
+ $INC =~ s#/#\\#g;\r
+ $INC =~ s#\\$##;\r
+ print $INC, "\n";\r
+ $CCFLAGS .= " -DWIN32 -Z7 -D_DEBUG";\r
+ $MYEXTLIB = "$libjava";\r
+ }\r
+}\r
+\r
+$CCFLAGS .= " -DKAFFE" if ($USE_KAFFE);\r
+\r
+# Let's find out the path of the library we need to link against.\r
+#\r
+foreach (@JAVALIBS) {\r
+ if ($^O eq 'MSWin32') { # We're on Win32\r
+ $_ =~ s#/#\\\\#g;\r
+ }\r
+ my ($libname, $libpath, $libsuffix) = fileparse($_, ("\.so", "\.lib"));\r
+ $libname =~ s/^lib//;\r
+ if ($^O eq 'solaris') {\r
+ $LIBPATH .= " -R$libpath -L$libpath"\r
+ } else {\r
+ $LIBPATH .= " -L$libpath"\r
+ }\r
+ $LIBS .= " -l$libname";\r
+}\r
+\r
+# Do we need -D_REENTRANT?\r
+if ($LIBPATH =~ /native/) {\r
+ print "Looks like native threads...\n";\r
+ $CCFLAGS .= " -D_REENTRANT";\r
+}\r
+\r
+if ($opt_e) {\r
+ print "We're embedding Perl in Java via libPerlInterpreter.so.\n";\r
+ eval `../setvars -perl`;\r
+ $CCFLAGS .= " -DEMBEDDEDPERL";\r
+ $LIBPATH .= " -R$ENV{JPL_HOME}/lib/$ARCHNAME -L$ENV{JPL_HOME}/lib/$ARCHNAME";\r
+ $LIBS .= " -lPerlInterpreter";\r
+}\r
+\r
+# Needed for JNI.\r
+if ($^O eq 'solaris') {\r
+ $LIBS = " -lthread -lc $LIBS"; #-lthread must be first!!!\r
+ $CCFLAGS .= " -D_REENTRANT";\r
+}\r
+\r
+# MSR - clean up LIBS\r
+$LIBS =~ s/-l$//;\r
+\r
+#\r
+# Next, build JNI/Config.pm. This is a superfluous thing for the SUN and\r
+# Microsoft JDKs, but absolutely necessary for Kaffe. I think at some\r
+# point, the Microsoft and SUN implementations should use JNI::Config, too.\r
+#\r
+\r
+if (! -d "JNI") {\r
+ mkdir("JNI", 0755) || die "Unable to make JNI directory: $!";\r
+}\r
+open(JNICONFIG, ">JNI/Config.pm") || die "Unable to open JNI/Config.pm: $!";\r
+\r
+print JNICONFIG "# DO NOT EDIT! Autogenerated by JNI/Makefile.PL\n\n",\r
+ "package JNI::Config;\nuse strict;\nuse Carp;\n",\r
+ "\nuse vars qw(\$KAFFE \$LIB_JAVA \$CLASS_HOME ",\r
+ "\$LIB_HOME);\n\n",\r
+ "\$KAFFE = $USE_KAFFE;\n\$LIB_JAVA = \"$JAVALIBS[0]\";\n";\r
+if ($USE_KAFFE) {\r
+ my $path = $JAVALIBS[0];\r
+ $path =~ s%/(kaffe/)?libkaffevm.so$%%;\r
+\r
+ print JNICONFIG "\$LIB_HOME = \"$path/kaffe\";\n";\r
+ $path =~ s%/lib%%;\r
+ print JNICONFIG "\$CLASS_HOME = \"$path/share/kaffe\";\n";\r
+}\r
+print JNICONFIG "\n\n1;\n";\r
+close JNICONFIG;\r
+\r
+\r
+my %Makefile = (\r
+ NAME => 'JNI',\r
+ VERSION_FROM => 'JNI.pm',\r
+ DEFINE => '',\r
+ LINKTYPE => 'dynamic',\r
+ INC => $INC,\r
+ CCFLAGS => "$Config{ccflags} $CCFLAGS", \r
+ ($Config{archname} =~ /mswin32.*-object/i ? ('CAPI' => 'TRUE') : ()),\r
+\r
+ clean => {FILES => "JNI/* JNI"}\r
+);\r
+\r
+$Makefile{LIBS} = ["$LIBPATH $LIBS"];\r
+if ($MYEXTLIB) {\r
+ $Makefile{MYEXTLIB} = $MYEXTLIB;\r
+}\r
+\r
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence\r
+# the contents of the Makefile that is written.\r
+#\r
+WriteMakefile(%Makefile);\r
+\r
+if ($USE_KAFFE) {\r
+ my $path = $JAVALIBS[0];\r
+ $path =~ s%/libkaffevm.so$%%;\r
+ print "\n\n***NOTE: be sure to have:\n",\r
+ " LD_LIBRARY_PATH=$path\n",\r
+ " in your enviornment (or installed as a system dynamic\n",\r
+ " library location) when you compile and run this.\n";\r
+}\r
+\r
+# subroutine to find a library\r
+#\r
+sub find_stuff {\r
+\r
+ my ($candidates, $locations) = @_;\r
+ my $lib;\r
+ $wanted = sub {\r
+ foreach my $name (@$candidates) {\r
+ if (/$name$/ and ! /green_threads/ and !/include-old/) {\r
+ $lib = $File::Find::name;\r
+ }\r
+ }\r
+ };\r
+ \r
+ use File::Find;\r
+ foreach my $guess (@$locations) {\r
+ next unless -d $guess;\r
+ find (\&$wanted, $guess);\r
+ }\r
+ if (! $lib) {\r
+ print "Could not find @$candidates\n";\r
+ } else {\r
+ print "Found @$candidates as $lib\n\n";\r
+ }\r
+ return $lib;\r
+}\r
+\r
+# Extra lib for Java 1.2\r
+#\r
+# if we want KAFFE, check for it, otherwise search for Java\r
+\r
+sub find_libs {\r
+ my($libjava, $libawt, $libjvm);\r
+\r
+ if ($USE_KAFFE) {\r
+ $libjava = find_stuff(['libkaffevm.so'], \@KAFFE_LIB_GUESSES);\r
+ $libawt = find_stuff(['libawt.so'], \@KAFFE_LIB_GUESSES);\r
+ } else {\r
+ $libjava = find_stuff(['libjava.so', 'javai.lib', 'jvm.lib'],\r
+ \@JAVA_HOME_GUESSES);\r
+ $libjvm = find_stuff(['libjvm.so'], \@JAVA_HOME_GUESSES);\r
+ $libawt = find_stuff(['libawt.so'], \@JAVA_HOME_GUESSES);\r
+ if (defined $libjvm) { # JDK 1.2\r
+ my $libhpi = find_stuff(['libhpi.so'], \@JAVA_HOME_GUESSES);\r
+ return($libjava, $libjvm, $libhpi, $libawt);\r
+ }\r
+ }\r
+ return($libjava, $libawt);\r
+}\r
+\r
+# We need to find jni.h and jni_md.h\r
+#\r
+\r
+# Always do find_includes as the first operation, as it has the side effect\r
+# of deciding whether or not we are looking for Kaffe. --bkuhn\r
+\r
+sub find_includes {\r
+\r
+ my @CANDIDATES = qw(jni.h jni_md.h);\r
+ my @includes;\r
+\r
+ sub find_inc {\r
+ foreach my $name (@CANDIDATES) {\r
+ if (/$name$/) {\r
+ my ($hname, $hpath, $hsuffix) = \r
+ fileparse($File::Find::name, ("\.h", "\.H"));\r
+ unless ($hpath =~ /include-old/) {\r
+ print "Found $hname$hsuffix in $hpath\n";\r
+ push @includes, $hpath;\r
+ } \r
+ }\r
+ }\r
+ }\r
+ \r
+ use File::Find;\r
+ foreach my $guess (@KAFFE_INCLUDE_GUESSES) {\r
+ next unless -d $guess;\r
+ find (\&find_inc, $guess);\r
+ }\r
+ # If we have found includes, then we are using Kaffe.\r
+ if (@includes > 0) {\r
+ $USE_KAFFE = 1;\r
+ } else {\r
+ foreach my $guess (@JAVA_HOME_GUESSES) {\r
+ next unless -d $guess;\r
+ find (\&find_inc, $guess);\r
+ }\r
+ }\r
+ die "Could not find Java includes!" unless (@includes);\r
+\r
+ return @includes;\r
+}\r
+\r