Fixed functionality for firm jni.
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 6 Nov 2002 16:52:21 +0000 (16:52 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 6 Nov 2002 16:52:21 +0000 (16:52 +0000)
[r516]

config.h.in
configure
configure.in
firmjni/Makefile.in
firmjni/README
firmjni/build_firm_jni.in
firmjni/testprograms/Empty.java
firmjni/testprograms/Makefile.in

index 33854b8..e928b83 100644 (file)
@@ -15,6 +15,9 @@
 /* Define if you have the <gmp.h> header file.  */
 #undef HAVE_GMP_H
 
+/* Define if you have the <jni.h> header file.  */
+#undef HAVE_JNI_H
+
 /* Define if you have the <math.h> header file.  */
 #undef HAVE_MATH_H
 
index 6742d1e..d3b5f37 100755 (executable)
--- a/configure
+++ b/configure
@@ -31,6 +31,8 @@ ac_help="$ac_help
   --enable-profile        enable profiling"
 ac_help="$ac_help
   --enable-autodoc        enable auto documentation"
+ac_help="$ac_help
+  --enable-firmjni        check for tools necesarry to construct a java native interface for Firm"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -591,7 +593,6 @@ fi
 
 
 
-
 # Check whether --enable-gcc_inline or --disable-gcc_inline was given.
 if test "${enable_gcc_inline+set}" = set; then
   enableval="$enable_gcc_inline"
@@ -631,11 +632,24 @@ fi
 
 
 
+# Check whether --enable-firmjni or --disable-firmjni was given.
+if test "${enable_firmjni+set}" = set; then
+  enableval="$enable_firmjni"
+  if test "$enableval"=yes; then
+  enable_firm_jni=yes
+fi
+else
+  enable_firm_jni=no
+fi
+
+
+
+
 
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:639: checking for $ac_word" >&5
+echo "configure:653: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -665,7 +679,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:669: checking for $ac_word" >&5
+echo "configure:683: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -716,7 +730,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:720: checking for $ac_word" >&5
+echo "configure:734: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -748,7 +762,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:752: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:766: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -759,12 +773,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 763 "configure"
+#line 777 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -790,12 +804,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:794: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:808: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:799: checking whether we are using GNU C" >&5
+echo "configure:813: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -804,7 +818,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -823,7 +837,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:827: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:841: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -862,7 +876,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:866: checking host system type" >&5
+echo "configure:880: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -883,7 +897,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:887: checking build system type" >&5
+echo "configure:901: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -910,7 +924,7 @@ if test -z "$LD" && test "$GCC" = yes; then
   # Extract the first word of "${ac_tool_prefix}gld", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:914: checking for $ac_word" >&5
+echo "configure:928: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -942,7 +956,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "gld", so it can be a program name with args.
 set dummy gld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:946: checking for $ac_word" >&5
+echo "configure:960: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -979,7 +993,7 @@ if test -z "$LD"; then
   # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:983: checking for $ac_word" >&5
+echo "configure:997: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1011,7 +1025,7 @@ fi
 fi
 
 echo $ac_n "checking whether $LD accepts -r""... $ac_c" 1>&6
-echo "configure:1015: checking whether $LD accepts -r" >&5
+echo "configure:1029: checking whether $LD accepts -r" >&5
 if eval "test \"`echo '$''{'libfirm_cv_prog_ld_r'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1045,7 +1059,7 @@ fi
 # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1049: checking for $ac_word" >&5
+echo "configure:1063: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1079,7 +1093,7 @@ fi
 # Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1083: checking for $ac_word" >&5
+echo "configure:1097: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_TAR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1114,7 +1128,7 @@ fi
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1118: checking for $ac_word" >&5
+echo "configure:1132: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1154,7 +1168,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1158: checking for a BSD compatible install" >&5
+echo "configure:1172: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1208,7 +1222,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1212: checking whether ln -s works" >&5
+echo "configure:1226: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1233,7 +1247,7 @@ if test "$enable_auto_documentation" = yes; then
   # Extract the first word of "robodoc", so it can be a program name with args.
 set dummy robodoc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1237: checking for $ac_word" >&5
+echo "configure:1251: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ROBODOC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1266,8 +1280,79 @@ fi
 fi
 
 
+if test "$enable_firm_jni" = yes; then
+  # Extract the first word of "javac", so it can be a program name with args.
+set dummy javac; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1288: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_JAVAC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$JAVAC"; then
+  ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_JAVAC=""javac""
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_JAVAC" && ac_cv_prog_JAVAC=""""
+fi
+fi
+JAVAC="$ac_cv_prog_JAVAC"
+if test -n "$JAVAC"; then
+  echo "$ac_t""$JAVAC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test "$JAVAC" != "javac"; then
+    { echo "configure: error: need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun)" 1>&2; exit 1; }
+  fi
+  # Extract the first word of "javah", so it can be a program name with args.
+set dummy javah; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1321: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_JAVAH'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$JAVAH"; then
+  ac_cv_prog_JAVAH="$JAVAH" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_JAVAH=""javah""
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_JAVAH" && ac_cv_prog_JAVAH=""""
+fi
+fi
+JAVAH="$ac_cv_prog_JAVAH"
+if test -n "$JAVAH"; then
+  echo "$ac_t""$JAVAH" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test "$JAVAH" != "javah"; then
+    { echo "configure: error: need javah to generate jni headers (IPD: module add jdk-1.3.1-sun)" 1>&2; exit 1; }
+  fi
+fi
+
+
+
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1271: checking how to run the C preprocessor" >&5
+echo "configure:1356: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1282,13 +1367,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1286 "configure"
+#line 1371 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1299,13 +1384,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1303 "configure"
+#line 1388 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1309: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1394: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1316,13 +1401,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1320 "configure"
+#line 1405 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1326: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1411: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1347,12 +1432,12 @@ fi
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1351: checking for ANSI C header files" >&5
+echo "configure:1436: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1356 "configure"
+#line 1441 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1360,7 +1445,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1364: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1377,7 +1462,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1381 "configure"
+#line 1466 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1395,7 +1480,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1399 "configure"
+#line 1484 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1416,7 +1501,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1420 "configure"
+#line 1505 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1427,7 +1512,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:1431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1456,17 +1541,17 @@ for ac_hdr in math.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1460: checking for $ac_hdr" >&5
+echo "configure:1545: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1465 "configure"
+#line 1550 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1470: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1555: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1503,17 +1588,17 @@ for ac_hdr in gmp.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1507: checking for $ac_hdr" >&5
+echo "configure:1592: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1512 "configure"
+#line 1597 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1550,17 +1635,17 @@ for ac_hdr in obstack.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1554: checking for $ac_hdr" >&5
+echo "configure:1639: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1559 "configure"
+#line 1644 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1564: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1649: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1593,9 +1678,58 @@ fi
 
 
 
+if test "$enable_firm_jni" = yes; then
+  for ac_hdr in jni.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1687: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1692 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ ac_jni_headers="yes"
+else
+  echo "$ac_t""no" 1>&6
+ac_jni_headers="no"
+fi
+done
+
+  if test "$ac_jni_headers" != yes; then
+    { echo "configure: error: jni header file not found. (IPD: add -I/usr/public2/java/jdk1.3.1-sun/include/ -I/usr/public2/java/jdk1.3.1-sun/include/linux/ to CPPFLAGS)" 1>&2; exit 1; }
+  fi
+fi
+
+
+
 
 echo $ac_n "checking for main in -lgmp""... $ac_c" 1>&6
-echo "configure:1599: checking for main in -lgmp" >&5
+echo "configure:1733: checking for main in -lgmp" >&5
 ac_lib_var=`echo gmp'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1603,14 +1737,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgmp  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1607 "configure"
+#line 1741 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1637,7 +1771,7 @@ fi
 
 
 echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
-echo "configure:1641: checking for main in -lm" >&5
+echo "configure:1775: checking for main in -lm" >&5
 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1645,14 +1779,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1649 "configure"
+#line 1783 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1683,12 +1817,12 @@ fi
 
 
 echo $ac_n "checking for strerror""... $ac_c" 1>&6
-echo "configure:1687: checking for strerror" >&5
+echo "configure:1821: checking for strerror" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1692 "configure"
+#line 1826 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strerror(); below.  */
@@ -1711,7 +1845,7 @@ strerror();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_strerror=yes"
 else
@@ -1874,6 +2008,7 @@ s%@enable_debug_libfirm@%$enable_debug_libfirm%g
 s%@enable_gcc_inline@%$enable_gcc_inline%g
 s%@enable_profile_libfirm@%$enable_profile_libfirm%g
 s%@enable_auto_documentation@%$enable_auto_documentation%g
+s%@enable_firm_jni@%$enable_firm_jni%g
 s%@CC@%$CC%g
 s%@host@%$host%g
 s%@host_alias@%$host_alias%g
@@ -1895,6 +2030,8 @@ s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@LN_S@%$LN_S%g
 s%@ROBODOC@%$ROBODOC%g
+s%@JAVAC@%$JAVAC%g
+s%@JAVAH@%$JAVAH%g
 s%@CPP@%$CPP%g
 
 CEOF
index 183c522..0ad1097 100644 (file)
@@ -37,7 +37,6 @@ else
 fi])
 AC_SUBST(enable_debug_libfirm)
 
-
 AC_ARG_ENABLE(gcc_inline,
 [  --enable-gcc_inline     enable gcc inline C-extension],
 [if test "$enableval" = yes; then
@@ -67,6 +66,17 @@ fi],
 AC_SUBST(enable_auto_documentation)
 
 
+dnl set firm jni
+dnl ------------
+AC_ARG_ENABLE(firmjni,
+[  --enable-firmjni        check for tools necesarry to construct a java native interface for Firm],
+[if test "$enableval"=yes; then
+  enable_firm_jni=yes
+fi],
+[enable_firm_jni=no])
+AC_SUBST(enable_firm_jni)
+
+
 dnl Checks for programs.
 dnl ====================
 
@@ -95,7 +105,7 @@ if test "$TAR" != "tar"; then
   AC_MSG_ERROR(need tar for creating archives in distribution)
 fi
 
-dnl check wether ar can handle option -s
+dnl check whether ar can handle option -s
 dnl if not then ranlib is needed
 dnl for simpliticity we use ranlib every time
 
@@ -114,6 +124,21 @@ if test "$enable_auto_documentation" = yes; then
   fi
 fi
 
+
+dnl check for availability of a jdk
+dnl -------------------------------
+if test "$enable_firm_jni" = yes; then
+  AC_CHECK_PROG(JAVAC, javac, "javac", "")
+  if test "$JAVAC" != "javac"; then
+    AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
+  fi
+  AC_CHECK_PROG(JAVAH, javah, "javah", "")
+  if test "$JAVAH" != "javah"; then
+    AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
+  fi
+fi
+
+
 dnl Checks for header files.
 dnl ========================
 
@@ -146,6 +171,16 @@ if test "$ac_obstack_headers" != yes; then
 fi
 
 
+dnl check for jni header files
+
+if test "$enable_firm_jni" = yes; then
+  AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
+  if test "$ac_jni_headers" != yes; then
+    AC_MSG_ERROR(jni header file not found. (IPD: add -I/usr/public2/java/jdk1.3.1-sun/include/ -I/usr/public2/java/jdk1.3.1-sun/include/linux/ to CPPFLAGS))
+  fi
+fi
+
+
 dnl Checks for libraries.
 dnl =====================
 
index 3e249b7..c4d7a9f 100644 (file)
@@ -6,10 +6,17 @@ srcdir = @srcdir@
 topdir = ..
 subdir = firmjni
 
-libdir = @libdir@      # where to find libfirm.a and where to put libfirmjni.so
-
+# The library implementing the JNI methods.  This name is also
+# known to the generator for the JNI interface and used in the
+# static initializer.
 LIBNAME = libfirmjni.so
 
+# where to put libfirmjni.so
+libdir = @libdir@
+# where to put the directory firmjni containing the generated
+# .java and .class files
+#javadir = @javadir@         @@@ how to specify a dir in configure.in?
+
 .PHONY: default all clean realclean depend
 
 MEMBERS = Firm.m Firm.m Firm_common.m Dbginfo.m Ident.m Tv.m           \
@@ -17,12 +24,28 @@ MEMBERS = Firm.m Firm.m Firm_common.m Dbginfo.m Ident.m Tv.m        \
        Irprog.m Irgraph.m Irnode.m Irmode.m Irop.m Ircons.m Ircgcons.m \
        Irflag.m Irvrfy.m Irdump.m Iropt.m Irgopt.m Ircgopt.m           \
        Irouts.m Irdom.m Irloop.m Cgana.m                               \
-       Irgwalk.m Irgmod.m Typewalk.m Typegmod.m
+       Irgmod.m Typegmod.m
+# How to pass function pointers? Or how to obtain them?
+#      Irgwalk.m Typewalk.m
 
 OFILES  = $(MEMBERS:.m=.o)
 HFILES  = $(MEMBERS:.m=.h)
+CLASSFILES = $(MEMBERS:.m=.class)
+
+CPPFLAGS =     -I$(top_srcdir)/ir/ir  -I$(top_srcdir)/ir/common        \
+               -I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr          \
+               -I$(top_srcdir)/ir/tv -I$(top_srcdir)/ir/debug          \
+               -I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st @CPPFLAGS@
+
+LDFLAGS += $(topdir)
+
+all:   classfiles jni
+
+# call the generator to make the implementation files
+#impl:
+#      -sh build_firm_jni
 
-all:   jni
+classfiles: $(CLASSFILES)
 
 %.class: %.java
        javac $<
@@ -33,12 +56,14 @@ all:        jni
 %.o:   %.c %.h
        gcc $(CPPFLAGS) -c $< -o $@
 
-jni:    $(HFILES) $(OFILES) $(libdir)libfirm.a
-       gcc  -shared -fPIC -o $(LIBNAME) *.o -L$(libdir) -lfirm
+jni:    $(HFILES) $(OFILES)  # ../libfirm.a
+       gcc -shared -fPIC -o $(LIBNAME) *.o -lfirm -L..
 
 install:
        cp libfirmjni.so $(libdir)
+#      mkdir $(javadir)
 #      cp *.java @javadir@
+#      cp *.class @javadir@
 
 clean:
        rm -rf sources *.c *.h *.o
index f9be723..4695431 100644 (file)
@@ -4,10 +4,6 @@ Call
   sh build_firm_jni
 to generate a Java native interface for firm.
 
-This script still contains various IPD specific settings,
-e.g. oaths to the header files needed for JNI.  This will be changed
-at some point.
-
 Generating the JNI requires various syntactic properties of the
 header files that restrict legal C.
 
@@ -16,7 +12,8 @@ from Idents (as idToStr).  This will probably cause a segmentation
 fault.
 
 Some methods generated might not work yet.  Please report this to
-goetz@ipd.info.uni-karlsruhe.de
+goetz@ipd.info.uni-karlsruhe.de. Do not use methods with function
+pointers as arguments.
 
 For now _all_ enumerators are generated into _all_ classes.
 This results from deficiencies in the crecoder and will be removed
index dfce6bc..3ded39f 100755 (executable)
@@ -15,22 +15,26 @@ srcdir=@srcdir@
 topdir=..
 subdir=firmjni
 
-###############################################################################
-# The directory which shall contain the JNI implementation after installation.
-FIRM_JNI_DIR=./
-
 # This is the list of firm headers a JNI interface is generated for
-# If you change this list, also change the list in Makefile.in
+# If you change this list, also change FRIM_PATH_HEADERS and the list
+# in Makefile.in
 FIRM_HEADERS="firm.h firm_common.h dbginfo.h ident.h tv.h
        type.h entity.h type_or_entity.h tpop.h mangle.h
        irprog.h irgraph.h irnode.h irmode.h irop.h ircons.h ircgcons.h
        irflag.h irvrfy.h irdump.h iropt.h irgopt.h ircgopt.h
        irouts.h irdom.h irloop.h cgana.h
-       irgwalk.h irgmod.h typewalk.h typegmod.h"
-
-# These directories point to a libfirm installation:
-FIRM_INCLUDE_DIR=@includedir@
-FIRM_LIB_DIR=@libdir@
+       irgmod.h typegmod.h"
+# How to pass function pointers? Therefore removed.
+# irgwalk.h typewalk.h
+
+FIRM_PATH_HEADERS="common/firm.h common/firm_common.h
+        debug/dbginfo.h ident/ident.h tv/tv.h
+       tr/type.h tr/entity.h tr/type_or_entity.h tr/tpop.h tr/mangle.h
+       ir/irprog.h ir/irgraph.h ir/irnode.h ir/irmode.h ir/irop.h
+       ir/ircons.h ir/ircgcons.h ir/irflag.h ir/irvrfy.h ir/irdump.h
+        ir/iropt.h ir/irgopt.h ir/ircgopt.h
+       ana/irouts.h ana/irdom.h ana/irloop.h ana/cgana.h
+       ir/irgmod.h tr/typegmod.h"
 
 # The directory containing crecoder.jar and, for now,
 # remove_cpp_comands.perl
@@ -40,51 +44,11 @@ WORK_DIR=.
 
 ###############################################################################
 
-CURRENT_DIR=$PWD
 SOURCE_DIR=sources
 
-MACHINE=`uname -m`
-SYS_OS=`uname -s`
-ARCH_DIR=$MACHINE-$SYS_OS
-
-LOG_FILE=compile-log.txt
-
 REMOVE_CPP_COMMANDS=$FIRM_JNI_TOOLS_DIR/remove_cpp_comands.perl
 CRECODER=$FIRM_JNI_TOOLS_DIR/crecoder.jar
 
-#
-# shell initialization
-#
-source /afs/info.uni-karlsruhe.de/public/tools/Modules/init/sh
-
-#
-# flags
-#
-verbose=""
-
-#
-# set up directories
-#
-#rm -rf $WORK_DIR
-#mkdir -p $WORK_DIR
-cd $WORK_DIR
-
-###############################################################################
-
-analargs () {
-  while [ $# -gt 0 ]; do
-    case $1 in
-      --verbose) verbose="y";;
-      *)        echo "Unknown option "$1;;
-    esac
-    shift
-  done
-}
-
-analargs $*
-
-###############################################################################
-
 
 ###############################################################################
 # Get all the necessary Firm headers.
@@ -93,8 +57,8 @@ cd $WORK_DIR
 rm -rf $SOURCE_DIR
 mkdir $SOURCE_DIR
 
-for file in $FIRM_HEADERS; do
-    cp $FIRM_INCLUDE_DIR/$file $SOURCE_DIR
+for file in $FIRM_PATH_HEADERS; do
+    cp $top_srcdir/ir/$file $SOURCE_DIR
 done;
 
 ###############################################################################
@@ -119,9 +83,7 @@ done;
 # the java native interface in C calling the real libfirm functions.
 # For a file "file.h" files "File.java" and "File.c" are generated.
 
-module add jdk-1.3.1-sun
 export CLASSPATH=$FIRM_JNI_TOOLS_DIR/crecoder.jar:$CLASSPATH
-#echo $CLASSPATH
 for file in $FIRM_HEADERS; do
    java crecoder/tools/jniBuilder/BuildJNI $file
 done;
@@ -129,14 +91,10 @@ done;
 # Remove the C headers which are no more needed.  They contain
 # nonsense no C compiler ever should see ;-)
 rm -f $FIRM_HEADERS
-# Make the JNI Implementation
-
-export CPPFLAGS="-I. -I/usr/public2/java/jdk1.3.1-sun/include/ -I/usr/public2/java/jdk1.3.1-sun/include/linux/ -I$FIRM_INCLUDE_DIR"
-export LDFLAGS="-L$FIRM_LIB_DIR"
 
 # javah renames these files.  the jnibuilder doesn't anticipate this
 # and generates #includes with the original names.
 ln -s Firm_0005fcommon.h Firm_common.h
 ln -s Type_0005for_0005fentity.h Type_or_entity.h
 
-make -f Makefile
+make
index d3e481c..927601e 100644 (file)
@@ -5,6 +5,8 @@ import firmjni.*;
 **
 ** Author: Goetz Lindenmaier
 **
+** $id$
+**
 ** This is an example of how to use the JNI interface of Firm.
 **
 */
@@ -22,7 +24,6 @@ import firmjni.*;
 **/
 class Empty {
     public static void main (String[] args) {
-       Firm firm = new Firm();
 
        System.out.println("\nCreating an IR graph: EMPTY...");
 
@@ -31,18 +32,17 @@ class Empty {
 
        /** Build type information for the procedure. **/
 
-       /* FIRM was designed for oo languages where all methods beint to a class.
+       /* FIRM was designed for oo languages where all methods belong to a class.
         * For imperative languages like C we view a file as a large class containing
         * all functions in this file as methods.
-        * This clas is generated automatically.
-        */
+        * This class is generated automatically.        */
        int owner = Irprog.getGlobType();
 
        /* The type of the method */
        int name = Ident.idFromStr("main", 4);
        int proc_main = Type.newTypeMethod(name, 0, 0);
-       /* An entity representing the method.  Owner of the entity is the global class
-          type mentioned above. */
+       /* An entity representing the method.  Owner of the entity is the global
+          class type mentioned above. */
        int ent = Entity.newEntity (owner, name, proc_main);
 
        /** Build code for the procedure. **/
index 893cc77..be05ec7 100644 (file)
@@ -5,27 +5,35 @@
 # $Id$
 #
 
-top_srcdir := @top_srcdir@
+top_srcdir = @top_srcdir@
 srcdir = @srcdir@
 topdir = ..
-subdir := testprograms
+subdir = testprograms
 
 
 SOURCES := Makefile.in \
        Empty.java
 
-CLASSPATH += $srcdir
+MYCLASSPATH = $(CLASSPATH):../..
+
 LD_LIBRARY_PATH += $srcdir/firmjni
 
 
-%.class: %.java
-       javac -d $CLASSPATH $<
+%.class: $(top_srcdir)/firmjni/testprograms/%.java
+       javac -d . $<
 
+all:   empty
 
+# bad hack ;-(
+empty:
+       javac -classpath $(MYCLASSPATH) -d . @top_srcdir@/firmjni/testprograms/Empty.java
 
 
+run:   empty
+       java -cp $(MYCLASSPATH) Empty
 
-all:   %.class
+clean:
+       -rm *.class
 
-run:   %.class
-       java $(<:.class=)
+realclean:     clean
+       -rm *.vcg