diff options
Diffstat (limited to 'libjava/classpath/m4')
-rw-r--r-- | libjava/classpath/m4/ac_prog_antlr.m4 | 50 | ||||
-rw-r--r-- | libjava/classpath/m4/ac_prog_java.m4 | 16 | ||||
-rw-r--r-- | libjava/classpath/m4/ac_prog_java_works.m4 | 108 | ||||
-rw-r--r-- | libjava/classpath/m4/ac_prog_javac.m4 | 60 | ||||
-rw-r--r-- | libjava/classpath/m4/ac_prog_javac_works.m4 | 50 | ||||
-rw-r--r-- | libjava/classpath/m4/acattribute.m4 | 25 | ||||
-rw-r--r-- | libjava/classpath/m4/accross.m4 | 98 | ||||
-rw-r--r-- | libjava/classpath/m4/acinclude.m4 | 302 | ||||
-rw-r--r-- | libjava/classpath/m4/ax_create_stdint_h.m4 | 715 | ||||
-rw-r--r-- | libjava/classpath/m4/ax_func_which_gethostbyname_r.m4 | 165 | ||||
-rw-r--r-- | libjava/classpath/m4/gcc_attribute.m4 | 133 | ||||
-rw-r--r-- | libjava/classpath/m4/iconv.m4 | 103 | ||||
-rw-r--r-- | libjava/classpath/m4/pkg.m4 | 57 |
13 files changed, 1882 insertions, 0 deletions
diff --git a/libjava/classpath/m4/ac_prog_antlr.m4 b/libjava/classpath/m4/ac_prog_antlr.m4 new file mode 100644 index 000000000..df377e8b6 --- /dev/null +++ b/libjava/classpath/m4/ac_prog_antlr.m4 @@ -0,0 +1,50 @@ + +AC_DEFUN([AC_LIB_ANTLR],[ + AC_MSG_CHECKING([for the ANTLR parser generator JAR file]) + if test -z "$ANTLR_JAR"; then + for antlr_lib_home in `ls -d /usr/local/share/antlr* 2> /dev/null` \ + /usr/share/antlr/lib /usr/share/java /usr/lib; + do + if test -f "$antlr_lib_home/antlr.jar"; then + ANTLR_JAR="$antlr_lib_home/antlr.jar" + break + fi + done + fi + test -f $ANTLR_JAR || AC_MSG_ERROR([specified ANTLR jar file $ANTLR_JAR not found.]) \ + && AC_MSG_RESULT([$ANTLR_JAR]) + AC_SUBST(ANTLR_JAR) + AC_PROVIDE([$0])dnl +]) + +AC_DEFUN([AC_PROG_ANTLR],[ + AC_REQUIRE([AC_PROG_JAVA])dnl + AC_CHECK_TOOLS([ANTLR], [cantlr runantlr antlr]) + if test "x$ANTLR" = x; then + if test -z "$JAVA"; then + AC_MSG_ERROR(Failed to find either an antlr binary or a suitable Java runtime for ANTLR.) + else + if test -z "$ANTLR_JAR"; then + AC_MSG_ERROR(Failed to find either an antlr binary or a suitable antlr jar file.) + else + ANTLR="$JAVA -classpath $ANTLR_JAR antlr.Tool" + fi + fi + fi + AC_SUBST(ANTLR) + AC_MSG_CHECKING([for antlr $1.$2.$3 or better]) + antlr_version_str=`$ANTLR 2>&1 | head -n 1 | sed '/.*Version */!d; s///;q'` + if test "$antlr_version_str"; then + antlr_version_regex='s/\([[[:digit:]]]\+\)\.\([[[:digit:]]]\+\)\.\([[[:digit:]]]\+\).*$/' + antlr_version_major=`echo $antlr_version_str | sed "$antlr_version_regex\\1/"` + antlr_version_minor=`echo $antlr_version_str | sed "$antlr_version_regex\\2/"` + antlr_version_micro=`echo $antlr_version_str | sed "$antlr_version_regex\\3/"` + (test $antlr_version_major -gt $1 || \ + (test $antlr_version_major -eq $1 && \ + test $antlr_version_minor -gt $2) || \ + (test $antlr_version_major -eq $1 && \ + test $antlr_version_minor -eq $2 && \ + test $antlr_version_micro -ge $3)) + fi + AC_MSG_RESULT($antlr_version_major.$antlr_version_minor.$antlr_version_micro) +]) diff --git a/libjava/classpath/m4/ac_prog_java.m4 b/libjava/classpath/m4/ac_prog_java.m4 new file mode 100644 index 000000000..12aa07c13 --- /dev/null +++ b/libjava/classpath/m4/ac_prog_java.m4 @@ -0,0 +1,16 @@ +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_java.html +dnl +dnl Changes for gjdoc: check for "kaffe, gij, java", not only "kaffe, java" +dnl Changes for GNU Classpath: check for "cacao, jamvm" as well +dnl +AC_DEFUN([AC_PROG_JAVA],[ +AC_REQUIRE([AC_EXEEXT])dnl +if test "x$JAVAPREFIX" = x; then + test "x$JAVA" = x && AC_CHECK_PROGS(JAVA, cacao$EXEEXT jamvm$EXEEXT kaffe$EXEEXT gij$EXEEXT java$EXEEXT) +else + test "x$JAVA" = x && AC_CHECK_PROGS(JAVA, cacao$EXEEXT jamvm$EXEEXT kaffe$EXEEXT gij$EXEEXT java$EXEEXT, $JAVAPREFIX) +fi +test "x$JAVA" = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) +AC_PROVIDE([$0])dnl +]) diff --git a/libjava/classpath/m4/ac_prog_java_works.m4 b/libjava/classpath/m4/ac_prog_java_works.m4 new file mode 100644 index 000000000..d3f274478 --- /dev/null +++ b/libjava/classpath/m4/ac_prog_java_works.m4 @@ -0,0 +1,108 @@ +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_java_works.html +dnl +AC_DEFUN_ONCE([AC_PROG_JAVA_WORKS], [ +AC_REQUIRE([AC_PROG_JAVA]) +AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes) +if test x$uudecode = xyes; then +AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ +dnl /** +dnl * Test.java: used to test if java compiler works. +dnl */ +dnl public class Test +dnl { +dnl +dnl public static void +dnl main( String[] argv ) +dnl { +dnl System.exit (0); +dnl } +dnl +dnl } +cat << \EOF > Test.uue +begin-base64 644 Test.class +yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE +bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 +bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s +YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG +aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB +AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB +AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= +==== +EOF +if uudecode$EXEEXT Test.uue; then + ac_cv_prog_uudecode_base64=yes +else + echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC + echo "configure: failed file was:" >&AC_FD_CC + cat Test.uue >&AC_FD_CC + ac_cv_prog_uudecode_base64=no +fi +rm -f Test.uue]) +fi +if test x$ac_cv_prog_uudecode_base64 != xyes; then + rm -f Test.class + AC_MSG_WARN([I have to compile Test.class from scratch]) + if test x$ac_cv_prog_javac_works = xno; then + AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) + fi +fi +AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +TEST=Test +changequote(, )dnl +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +public static void main (String args[]) { + System.exit (0); +} } +EOF +changequote([, ])dnl +if test x$ac_cv_prog_uudecode_base64 != xyes; then + AC_REQUIRE([AC_PROG_JAVAC_WORKS]) + if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then + : + else + echo "configure: failed program was:" >&AC_FD_CC + cat $JAVA_TEST >&AC_FD_CC + AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) + fi +fi +if AC_TRY_COMMAND(CLASSPATH=.:$CLASSPATH $JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then + ac_cv_prog_java_works=yes +else + echo "configure: failed program was:" >&AC_FD_CC + cat $JAVA_TEST >&AC_FD_CC + AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) +fi +rm -fr $JAVA_TEST $CLASS_TEST Test.uue +]) +AC_PROVIDE([$0])dnl +] +) +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_try_compile_java.html +dnl +AC_DEFUN_ONCE([AC_TRY_COMPILE_JAVA],[ +AC_REQUIRE([AC_PROG_JAVAC_WORKS])dnl +cat << \EOF > Test.java +/* [#]line __oline__ "configure" */ +ifelse([$1], , , [import $1;]) +public class Test { +[$2] +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$3], , :, [$3]) +else + echo "configure: failed program was:" >&AC_FD_CC + cat Test.java >&AC_FD_CC +ifelse([$4], , , [ rm -fr Test* + $4 +])dnl +fi +rm -fr Test*]) diff --git a/libjava/classpath/m4/ac_prog_javac.m4 b/libjava/classpath/m4/ac_prog_javac.m4 new file mode 100644 index 000000000..2162c1d8d --- /dev/null +++ b/libjava/classpath/m4/ac_prog_javac.m4 @@ -0,0 +1,60 @@ +dnl @synopsis AC_PROG_JAVAC +dnl +dnl AC_PROG_JAVAC tests an existing Java compiler. It uses the +dnl environment variable JAVAC then tests in sequence various common +dnl Java compilers. For political reasons, it starts with the free +dnl ones. +dnl +dnl If you want to force a specific compiler: +dnl +dnl - at the configure.in level, set JAVAC=yourcompiler before calling +dnl AC_PROG_JAVAC +dnl +dnl - at the configure level, setenv JAVAC +dnl +dnl You can use the JAVAC variable in your Makefile.in, with @JAVAC@. +dnl +dnl *Warning*: its success or failure can depend on a proper setting of +dnl the CLASSPATH env. variable. +dnl +dnl TODO: allow to exclude compilers (rationale: most Java programs +dnl cannot compile with some compilers like guavac). +dnl +dnl Note: This is part of the set of autoconf M4 macros for Java +dnl programs. It is VERY IMPORTANT that you download the whole set, +dnl some macros depend on other. Unfortunately, the autoconf archive +dnl does not support the concept of set of macros, so I had to break it +dnl for submission. The general documentation, as well as the sample +dnl configure.in, is included in the AC_PROG_JAVA macro. +dnl +dnl @category Java +dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> +dnl @version 2000-07-19 +dnl @license GPLWithACException +dnl +dnl Modified to remove jikes by Andrew John Hughes on 2008-02-11 + +AC_DEFUN_ONCE([AC_PROG_JAVAC],[ +AC_REQUIRE([AC_EXEEXT])dnl +ECJ_OPTS="-warn:-deprecation,serial,unusedImport" +JAVAC_OPTS="-Xlint:unchecked,cast,divzero,empty,finally,overrides" +GCJ_OPTS="-g" +if test "x$JAVAPREFIX" = x; then + test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, ["ecj$EXEEXT $ECJ_OPTS"] ["ecj-3.3$EXEEXT $ECJ_OPTS"] ["ecj-3.2$EXEEXT $ECJ_OPTS"] ["javac$EXEEXT $JAVAC_OPTS"] "gcj$EXEEXT -C") +else + test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, ["ecj$EXEEXT $ECJ_OPTS"] ["ecj-3.3$EXEEXT $ECJ_OPTS"] ["ecj-3.2$EXEEXT $ECJ_OPTS"] ["javac$EXEEXT $JAVAC_OPTS"] "gcj$EXEEXT -C", $JAVAPREFIX) +fi +test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) +AC_CACHE_CHECK([if $JAVAC is a version of gcj], ac_cv_prog_javac_is_gcj, [ +if $JAVAC --version 2>&1 | grep gcj >&AS_MESSAGE_LOG_FD ; then + ac_cv_prog_javac_is_gcj=yes; + JAVAC="$JAVAC $GCJ_OPTS"; +else + ac_cv_prog_javac_is_gcj=no; +fi +]) +AC_SUBST(JAVAC_IS_GCJ, $ac_cv_prog_javac_is_gcj) +AM_CONDITIONAL(GCJ_JAVAC, test x"${JAVAC_IS_GCJ}" = xyes) +dnl END GCJ LOCAL +AC_PROVIDE([$0])dnl +]) diff --git a/libjava/classpath/m4/ac_prog_javac_works.m4 b/libjava/classpath/m4/ac_prog_javac_works.m4 new file mode 100644 index 000000000..7fb298d49 --- /dev/null +++ b/libjava/classpath/m4/ac_prog_javac_works.m4 @@ -0,0 +1,50 @@ +dnl @synopsis AC_PROG_JAVAC_WORKS +dnl +dnl Internal use ONLY. +dnl +dnl Note: This is part of the set of autoconf M4 macros for Java +dnl programs. It is VERY IMPORTANT that you download the whole set, +dnl some macros depend on other. Unfortunately, the autoconf archive +dnl does not support the concept of set of macros, so I had to break it +dnl for submission. The general documentation, as well as the sample +dnl configure.in, is included in the AC_PROG_JAVA macro. +dnl +dnl @category Java +dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> +dnl @version 2000-07-19 +dnl @license GPLWithACException +dnl +dnl Modified to test for 1.5 by Andrew John Hughes on 2008-02-11 + +AC_DEFUN_ONCE([AC_PROG_JAVAC_WORKS],[ +AC_REQUIRE([AC_PROG_JAVAC]) +AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ +JAVA_TEST=Object.java +CLASS_TEST=Object.class +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +package java.lang; + +public class Object +{ + static <T> void doStuff() + { + } +} +EOF +if test x$JAVAC_IS_GCJ = xyes; then + CMD="$JAVAC $JAVACFLAGS -fsource=1.5 -ftarget=1.5 $JAVA_TEST" +else + CMD="$JAVAC $JAVACFLAGS -source 1.5 -target 1.5 $JAVA_TEST" +fi +if AC_TRY_COMMAND($CMD) >/dev/null 2>&1; then + ac_cv_prog_javac_works=yes +else + AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) + echo "configure: failed program was:" >&AC_FD_CC + cat $JAVA_TEST >&AC_FD_CC +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +AC_PROVIDE([$0])dnl +]) diff --git a/libjava/classpath/m4/acattribute.m4 b/libjava/classpath/m4/acattribute.m4 new file mode 100644 index 000000000..7b490d4b7 --- /dev/null +++ b/libjava/classpath/m4/acattribute.m4 @@ -0,0 +1,25 @@ +dnl modified AC_C_INLINE from autoconf/c.m4 + +AN_IDENTIFIER([attribute], [AC_C_ATTRIBUTE]) +AC_DEFUN([AC_C_ATTRIBUTE], +[AC_CACHE_CHECK([for __attribute__], ac_cv_c_attribute, +[ +AC_COMPILE_IFELSE([AC_LANG_SOURCE( +[void foo(void) __attribute__ ((__noreturn__));] +)], +[ac_cv_c_attribute=yes], +[ac_cv_c_attribute=no] +) +]) +AH_VERBATIM([attribute], +[/* Define to `__attribute__' to nothing if it's not supported. */ +#undef __attribute__]) +case $ac_cv_c_attribute in + yes) ;; + no) + cat >>confdefs.h <<_ACEOF +#define __attribute__(x) /* nothing */ +_ACEOF + ;; +esac +])# AC_C_ATTRIBUTE diff --git a/libjava/classpath/m4/accross.m4 b/libjava/classpath/m4/accross.m4 new file mode 100644 index 000000000..535a6f5c0 --- /dev/null +++ b/libjava/classpath/m4/accross.m4 @@ -0,0 +1,98 @@ +AC_DEFUN([AC_COMPILE_CHECK_SIZEOF], +[changequote(<<, >>)dnl +dnl The name to #define. +define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $1) +AC_CACHE_VAL(AC_CV_NAME, +[for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence. + AC_TRY_COMPILE([#include "confdefs.h" +#include <sys/types.h> +$2 +], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size) + if test x$AC_CV_NAME != x ; then break; fi +done +]) +if test x$AC_CV_NAME = x ; then + AC_MSG_ERROR([cannot determine a size for $1]) +fi +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1]) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + +AC_DEFUN([AC_C_BIGENDIAN_CROSS], +[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, +[ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/param.h>], [ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. +AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/param.h>], [ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) +if test $ac_cv_c_bigendian = unknown; then +AC_TRY_RUN([main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, +[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ]) +fi]) +if test $ac_cv_c_bigendian = unknown; then +AC_MSG_CHECKING(to probe for byte ordering) +[ +cat >conftest.c <<EOF +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; } +int main() { _ascii (); _ebcdic (); return 0; } +EOF +] if test -f conftest.c ; then + if ${CC-cc} ${CFLAGS} -c conftest.c -o conftest.o && test -f conftest.o ; then + if test `grep -l BIGenDianSyS conftest.o` ; then + echo $ac_n ' big endian probe OK, ' 1>&AC_FD_MSG + ac_cv_c_bigendian=yes + fi + if test `grep -l LiTTleEnDian conftest.o` ; then + echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG + if test $ac_cv_c_bigendian = yes ; then + ac_cv_c_bigendian=unknown; + else + ac_cv_c_bigendian=no + fi + fi + echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG + fi + fi +AC_MSG_RESULT($ac_cv_c_bigendian) +fi +if test $ac_cv_c_bigendian = yes; then + AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian]) + AC_DEFINE(HOST_WORDS_BIG_ENDIAN, 1, + [Define if the host machine stores words of multi-word integers in + big-endian order.]) + BYTEORDER=4321 +else + BYTEORDER=1234 +fi +AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN]) +if test $ac_cv_c_bigendian = unknown; then + AC_MSG_ERROR([unknown endianess - sorry, please pre-set ac_cv_c_bigendian]) +fi +]) diff --git a/libjava/classpath/m4/acinclude.m4 b/libjava/classpath/m4/acinclude.m4 new file mode 100644 index 000000000..65cb8fc47 --- /dev/null +++ b/libjava/classpath/m4/acinclude.m4 @@ -0,0 +1,302 @@ +dnl Used by aclocal to generate configure + +dnl ----------------------------------------------------------- +AC_DEFUN([CLASSPATH_WITH_JAVAH], +[ + AC_ARG_WITH([javah], + [AS_HELP_STRING(--with-javah,specify path or name of a javah-like program)], + [ + if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then + CLASSPATH_CHECK_JAVAH(${withval}) + else + CLASSPATH_CHECK_JAVAH + fi + ], + [ + CLASSPATH_CHECK_JAVAH + ]) + AC_SUBST(USER_JAVAH) +]) + +dnl ----------------------------------------------------------- +dnl Checking for a javah like program +dnl ----------------------------------------------------------- +AC_DEFUN([CLASSPATH_CHECK_JAVAH], +[ + if test "x$1" != x; then + if test -f "$1"; then + USER_JAVAH="$1" + else + AC_PATH_PROG(USER_JAVAH, "$1") + fi + else + AC_PATH_PROGS([USER_JAVAH],[gjavah gjavah-4.3 gjavah-4.2 gjavah-4.1 gcjh-wrapper-4.1 gcjh-4.1 javah]) + fi + + if test "x${USER_JAVAH}" = x; then + AC_MSG_ERROR([can not find javah]) + fi +]) + +dnl ----------------------------------------------------------- +dnl CLASSPATH_WITH_CLASSLIB - checks for user specified classpath additions +dnl ----------------------------------------------------------- +AC_DEFUN([CLASSPATH_WITH_CLASSLIB], +[ + AC_ARG_WITH([vm-classes], + [AS_HELP_STRING(--with-vm-classes,specify path to VM override source files)], [vm_classes="$with_vm_classes"], + [vm_classes='${top_srcdir}/vm/reference']) + AC_SUBST(vm_classes) +]) + +dnl ----------------------------------------------------------- +dnl CLASSPATH_WITH_GLIBJ - specify what to install +dnl ----------------------------------------------------------- +AC_DEFUN([CLASSPATH_WITH_GLIBJ], +[ + AC_PATH_PROG(ZIP, zip) + + AC_MSG_CHECKING(for a jar-like tool) + AC_ARG_WITH([jar], + [AS_HELP_STRING([--with-jar=PATH], [define to use a jar style tool])], + [ + case "${withval}" in + yes) + JAR=yes + ;; + no) + JAR=no + AC_MSG_RESULT(${JAR}) + ;; + *) + if test -f "${withval}"; then + JAR="${withval}" + AC_MSG_RESULT(${JAR}) + else + AC_MSG_RESULT([not found]) + AC_MSG_ERROR([The jar tool ${withval} was not found.]) + fi + ;; + esac + ], + [ + JAR=yes + ]) + if test x"${JAR}" = "xyes"; then + AC_MSG_RESULT([trying fastjar, gjar and jar]) + AC_PATH_PROGS([JAR], [fastjar gjar jar]) + if test x"${RHINO_JAR}" = "xyes"; then + AC_MSG_RESULT([not found]) + fi + fi + if test x"${JAR}" = "xno" && test x"${ZIP}" = ""; then + AC_MSG_ERROR([No zip or jar tool found.]) + fi + AM_CONDITIONAL(WITH_JAR, test x"${JAR}" != "xno" && test x"${JAR}" != "xyes") + AC_SUBST(JAR) + + AC_ARG_WITH([glibj], + [AS_HELP_STRING([--with-glibj],[define what to install (zip|flat|both|none|build) [default=zip]])], + [ + if test "x${withval}" = xyes || test "x${withval}" = xzip; then + install_class_files=no + build_class_files=yes + use_zip=yes + elif test "x${withval}" = xboth; then + install_class_files=yes + build_class_files=yes + use_zip=yes + elif test "x${withval}" = xflat; then + install_class_files=yes + build_class_files=yes + use_zip=no + elif test "x${withval}" = xno || test "x${withval}" = xnone; then + install_class_files=no + build_class_files=no + use_zip=no + elif test "x${withval}" = xbuild; then + install_class_files=no + build_class_files=yes + use_zip=no + else + AC_MSG_ERROR([unknown value given to --with-glibj]) + fi + ], + [ + install_class_files=no + use_zip=yes + ]) + AM_CONDITIONAL(INSTALL_GLIBJ_ZIP, test "x${use_zip}" = xyes) + AM_CONDITIONAL(INSTALL_CLASS_FILES, test "x${install_class_files}" = xyes) + AM_CONDITIONAL(BUILD_CLASS_FILES, test "x${build_class_files}" = xyes) + + AC_ARG_ENABLE([examples], + [AS_HELP_STRING(--enable-examples,enable build of the examples [default=yes])], + [case "${enableval}" in + yes) EXAMPLESDIR="examples" ;; + no) EXAMPLESDIR="" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-examples) ;; + esac], + [EXAMPLESDIR="examples"]) + if test "x${build_class_files}" = xno; then + EXAMPLESDIR="" + fi + AC_SUBST(EXAMPLESDIR) + + AC_ARG_ENABLE([tools], + [AS_HELP_STRING(--enable-tools,enable build of the tools [default=yes])], + [case "${enableval}" in + yes) TOOLSDIR="tools" ;; + no) TOOLSDIR="" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;; + esac], + [TOOLSDIR="tools"]) + if test "x${build_class_files}" = xno; then + TOOLSDIR="" + fi + AC_SUBST(TOOLSDIR) +]) + +dnl ----------------------------------------------------------- +dnl Enable generation of API documentation, with gjdoc if it +dnl has been compiled to an executable (or a suitable script +dnl is in your PATH) or using the argument as gjdoc executable. +dnl ----------------------------------------------------------- +AC_DEFUN([CLASSPATH_WITH_GJDOC], +[ + AC_ARG_WITH([gjdoc], + AS_HELP_STRING([--with-gjdoc], + [generate documentation using gjdoc (default is NO)]), + [if test "x${withval}" = xno; then + WITH_GJDOC=no; + elif test "x${withval}" = xyes -o "x{withval}" = x; then + WITH_GJDOC=yes; + AC_PATH_PROG(GJDOC, gjdoc, "no") + if test "x${GJDOC}" = xno; then + AC_MSG_ERROR("gjdoc executable not found"); + fi + else + WITH_GJDOC=yes + GJDOC="${withval}" + AC_CHECK_FILE(${GJDOC}, AC_SUBST(GJDOC), + AC_MSG_ERROR("Cannot use ${withval} as gjdoc executable since it doesn't exist")) + fi], + [WITH_GJDOC=no]) + AM_CONDITIONAL(CREATE_API_DOCS, test "x${WITH_GJDOC}" = xyes) + if test "x${WITH_GJDOC}" = xyes; then + AC_MSG_CHECKING([version of GJDoc]) + gjdoc_version=$(${GJDOC} --version|cut -d ' ' -f2) + AC_MSG_RESULT(${gjdoc_version}) + case ${gjdoc_version} in + 0.7.9) ;; + 0.8*) ;; + *) AC_MSG_ERROR([Building documentation requires GJDoc >= 0.7.9, ${gjdoc_version} found.]) ;; + esac + fi +]) + +dnl ----------------------------------------------------------- +dnl Enable regeneration of parsers using jay +dnl http://www.informatik.uni-osnabrueck.de/alumni/bernd/jay/ +dnl ----------------------------------------------------------- +AC_DEFUN([REGEN_WITH_JAY], +[ + AC_ARG_WITH([jay], + [AS_HELP_STRING(--with-jay[=DIR|PATH],Regenerate the parsers with jay)], + [ + AC_MSG_CHECKING([whether to regenerate parsers with jay]) + JAY_FOUND=no + JAY_DIR_PATH= + if test "x${withval}" = xno; then + AC_MSG_RESULT(no) + elif test "x${withval}" = xyes; then + AC_MSG_RESULT(yes) + JAY_DIR_PATH="/usr/share/jay" + elif test -d "${withval}"; then + AC_MSG_RESULT(yes) + JAY_DIR_PATH="${withval}" + elif test -f "${withval}"; then + AC_MSG_RESULT(yes) + JAY_DIR_PATH=`dirname "${withval}"` + JAY="${withval}" + else + AC_MSG_ERROR(jay not found at ${withval}) + fi + + if test "x${JAY_DIR_PATH}" != x; then + AC_PATH_PROG(JAY, jay, "no", ${JAY_DIR_PATH}:${PATH}) + if test "x${JAY}" = xno; then + AC_MSG_ERROR(jay executable not found); + fi + JAY_SKELETON="${JAY_DIR_PATH}/skeleton" + AC_CHECK_FILE(${JAY_SKELETON}, AC_SUBST(JAY_SKELETON), + AC_MSG_ERROR(Expected skeleton file in ${JAY_DIR_PATH})) + JAY_FOUND=yes + fi + ], + [ + AC_MSG_CHECKING([whether to regenerate parsers with jay]) + AC_MSG_RESULT(no) + JAY_FOUND=no + ]) + AM_CONDITIONAL(REGEN_PARSERS, test "x${JAY_FOUND}" = xyes) +]) + +dnl ----------------------------------------------------------- +dnl GCJ LOCAL: Calculate toolexeclibdir +dnl ----------------------------------------------------------- +AC_DEFUN([CLASSPATH_TOOLEXECLIBDIR], +[ + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in + .) toolexeclibdir=${libdir} ;; # Avoid trailing /. + *) toolexeclibdir=${libdir}/${multi_os_directory} ;; + esac + AC_SUBST(toolexeclibdir) +]) + +dnl ----------------------------------------------------------- +AC_DEFUN([CLASSPATH_JAVAC_MEM_CHECK], +[ + JAVA_TEST=Test.java + CLASS_TEST=Test.class + cat << \EOF > $JAVA_TEST + /* [#]line __oline__ "configure" */ + public class Test + { + public static void main(String[] args) + { + System.out.println("Hello World"); + } + } +EOF + if test x$JAVAC_IS_GCJ != xyes; then + AC_MSG_CHECKING([whether javac supports -J]) + $JAVAC $JAVACFLAGS -J-Xmx768M -sourcepath '' $JAVA_TEST + javac_result=$? + if test "x$javac_result" = "x0"; then + AC_MSG_RESULT([yes]) + JAVAC_MEM_OPT="-J-Xmx768M" + else + AC_MSG_RESULT([no]) + fi + fi + rm -f $JAVA_TEST $CLASS_TEST + AC_SUBST(JAVAC_MEM_OPT) +]) + +dnl --------------------------------------------------------------- +dnl CLASSPATH_COND_IF(COND, SHELL-CONDITION, [IF-TRUE], [IF-FALSE]) +dnl --------------------------------------------------------------- +dnl Automake 1.11 can emit conditional rules for AC_CONFIG_FILES, +dnl using AM_COND_IF. This wrapper uses it if it is available, +dnl otherwise falls back to code compatible with Automake 1.9.6. +AC_DEFUN([CLASSPATH_COND_IF], +[m4_ifdef([AM_COND_IF], + [AM_COND_IF([$1], [$3], [$4])], + [if $2; then + m4_default([$3], [:]) + else + m4_default([$4], [:]) + fi +])]) diff --git a/libjava/classpath/m4/ax_create_stdint_h.m4 b/libjava/classpath/m4/ax_create_stdint_h.m4 new file mode 100644 index 000000000..453af0748 --- /dev/null +++ b/libjava/classpath/m4/ax_create_stdint_h.m4 @@ -0,0 +1,715 @@ +dnl Taken from ac-archive ac-archive-5 module's CVS HEAD +dnl ac-archive is available at http://ac-archive.sf.net +dnl URL of WebCVS of this m4 macros is: +dnl http://cvs.sourceforge.net/viewcvs.py/ac-archive/ac-archive-5/guidod/ +dnl +dnl @synopsis AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEDERS-TO-CHECK])] +dnl +dnl the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the +dnl existence of an include file <stdint.h> that defines a set of +dnl typedefs, especially uint8_t,int32_t,uintptr_t. Many older +dnl installations will not provide this file, but some will have the +dnl very same definitions in <inttypes.h>. In other enviroments we can +dnl use the inet-types in <sys/types.h> which would define the typedefs +dnl int8_t and u_int8_t respectivly. +dnl +dnl This macros will create a local "_stdint.h" or the headerfile given +dnl as an argument. In many cases that file will just "#include +dnl <stdint.h>" or "#include <inttypes.h>", while in other environments +dnl it will provide the set of basic 'stdint's definitions/typedefs: +dnl +dnl int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t +dnl int_least32_t.. int_fast32_t.. intmax_t +dnl +dnl which may or may not rely on the definitions of other files, or +dnl using the AC_CHECK_SIZEOF macro to determine the actual sizeof each +dnl type. +dnl +dnl if your header files require the stdint-types you will want to +dnl create an installable file mylib-int.h that all your other +dnl installable header may include. So if you have a library package +dnl named "mylib", just use +dnl +dnl AX_CREATE_STDINT_H(mylib-int.h) +dnl +dnl in configure.ac and go to install that very header file in +dnl Makefile.am along with the other headers (mylib.h) - and the +dnl mylib-specific headers can simply use "#include <mylib-int.h>" to +dnl obtain the stdint-types. +dnl +dnl Remember, if the system already had a valid <stdint.h>, the +dnl generated file will include it directly. No need for fuzzy +dnl HAVE_STDINT_H things... +dnl +dnl @category C +dnl @author Guido Draheim <guidod@gmx.de> +dnl @version 2003-12-07 +dnl @license GPLWithACException + +AC_DEFUN([AX_CHECK_DATA_MODEL],[ + AC_CHECK_SIZEOF(char) + AC_CHECK_SIZEOF(short) + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(void*) + ac_cv_char_data_model="" + ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char" + ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short" + ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int" + ac_cv_long_data_model="" + ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int" + ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long" + ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp" + AC_MSG_CHECKING([data model]) + case "$ac_cv_char_data_model/$ac_cv_long_data_model" in + 122/242) ac_cv_data_model="IP16" ; n="standard 16bit machine" ;; + 122/244) ac_cv_data_model="LP32" ; n="standard 32bit machine" ;; + 122/*) ac_cv_data_model="i16" ; n="unusual int16 model" ;; + 124/444) ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;; + 124/488) ac_cv_data_model="LP64" ; n="standard 64bit unixish" ;; + 124/448) ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;; + 124/*) ac_cv_data_model="i32" ; n="unusual int32 model" ;; + 128/888) ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;; + 128/*) ac_cv_data_model="i64" ; n="unusual int64 model" ;; + 222/*2) ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;; + 333/*3) ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;; + 444/*4) ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;; + 666/*6) ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;; + 888/*8) ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;; + 222/*|333/*|444/*|666/*|888/*) : + ac_cv_data_model="iDSP" ; n="unusual dsptype" ;; + *) ac_cv_data_model="none" ; n="very unusual model" ;; + esac + AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)]) +]) + +dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF]) +AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[ +AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[ + ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h) + AC_MSG_RESULT([(..)]) + for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h]) ; do + unset ac_cv_type_uintptr_t + unset ac_cv_type_uint64_t + AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>]) + AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) + m4_ifvaln([$1],[$1]) break + done + AC_MSG_CHECKING([for stdint uintptr_t]) + ]) +]) + +AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[ +AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[ + ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h) + AC_MSG_RESULT([(..)]) + for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h stdint.h]) ; do + unset ac_cv_type_uint32_t + unset ac_cv_type_uint64_t + AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>]) + AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) + m4_ifvaln([$1],[$1]) break + break; + done + AC_MSG_CHECKING([for stdint uint32_t]) + ]) +]) + +AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[ +AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[ + ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h) + AC_MSG_RESULT([(..)]) + for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do + unset ac_cv_type_u_int32_t + unset ac_cv_type_u_int64_t + AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>]) + AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>]) + m4_ifvaln([$1],[$1]) break + break; + done + AC_MSG_CHECKING([for stdint u_int32_t]) + ]) +]) + +AC_DEFUN([AX_CREATE_STDINT_H], +[# ------ AX CREATE STDINT H ------------------------------------- +AC_MSG_CHECKING([for stdint types]) +ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)` +# try to shortcircuit - if the default include path of the compiler +# can find a "stdint.h" header then we assume that all compilers can. +AC_CACHE_VAL([ac_cv_header_stdint_t],[ +old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS="" +old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="" +old_CFLAGS="$CFLAGS" ; CFLAGS="" +AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;], +[ac_cv_stdint_result="(assuming C99 compatible system)" + ac_cv_header_stdint_t="stdint.h"; ], +[ac_cv_header_stdint_t=""]) +CXXFLAGS="$old_CXXFLAGS" +CPPFLAGS="$old_CPPFLAGS" +CFLAGS="$old_CFLAGS" ]) + +v="... $ac_cv_header_stdint_h" +if test "$ac_stdint_h" = "stdint.h" ; then + AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)]) +elif test "$ac_stdint_h" = "inttypes.h" ; then + AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)]) +elif test "_$ac_cv_header_stdint_t" = "_" ; then + AC_MSG_RESULT([(putting them into $ac_stdint_h)$v]) +else + ac_cv_header_stdint="$ac_cv_header_stdint_t" + AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)]) +fi + +if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit.. + +dnl .....intro message done, now do a few system checks..... +dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type, +dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW +dnl instead that is triggered with 3 or more arguments (see types.m4) + +inttype_headers=`echo $2 | sed -e 's/,/ /g'` + +ac_cv_stdint_result="(no helpful system typedefs seen)" +AX_CHECK_HEADER_STDINT_X(dnl + stdint.h inttypes.h sys/inttypes.h $inttype_headers, + ac_cv_stdint_result="(seen uintptr_t$and64 in $i)") + +if test "_$ac_cv_header_stdint_x" = "_" ; then +AX_CHECK_HEADER_STDINT_O(dnl, + inttypes.h sys/inttypes.h stdint.h $inttype_headers, + ac_cv_stdint_result="(seen uint32_t$and64 in $i)") +fi + +if test "_$ac_cv_header_stdint_x" = "_" ; then +if test "_$ac_cv_header_stdint_o" = "_" ; then +AX_CHECK_HEADER_STDINT_U(dnl, + sys/types.h inttypes.h sys/inttypes.h $inttype_headers, + ac_cv_stdint_result="(seen u_int32_t$and64 in $i)") +fi fi + +dnl if there was no good C99 header file, do some typedef checks... +if test "_$ac_cv_header_stdint_x" = "_" ; then + AC_MSG_CHECKING([for stdint datatype model]) + AC_MSG_RESULT([(..)]) + AX_CHECK_DATA_MODEL +fi + +if test "_$ac_cv_header_stdint_x" != "_" ; then + ac_cv_header_stdint="$ac_cv_header_stdint_x" +elif test "_$ac_cv_header_stdint_o" != "_" ; then + ac_cv_header_stdint="$ac_cv_header_stdint_o" +elif test "_$ac_cv_header_stdint_u" != "_" ; then + ac_cv_header_stdint="$ac_cv_header_stdint_u" +else + ac_cv_header_stdint="stddef.h" +fi + +AC_MSG_CHECKING([for extra inttypes in chosen header]) +AC_MSG_RESULT([($ac_cv_header_stdint)]) +dnl see if int_least and int_fast types are present in _this_ header. +unset ac_cv_type_int_least32_t +unset ac_cv_type_int_fast32_t +AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>]) +AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>]) +AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>]) + +fi # shortcircut to system "stdint.h" +# ------------------ PREPARE VARIABLES ------------------------------ +if test "$GCC" = "yes" ; then +ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1` +else +ac_cv_stdint_message="using $CC" +fi + +AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl +$ac_cv_stdint_result]) + +dnl ----------------------------------------------------------------- +# ----------------- DONE inttypes.h checks START header ------------- +AC_CONFIG_COMMANDS([$ac_stdint_h],[ +AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h) +ac_stdint=$tmp/_stdint.h + +echo "#ifndef" $_ac_stdint_h >$ac_stdint +echo "#define" $_ac_stdint_h "1" >>$ac_stdint +echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint +echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint +echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint +if test "_$ac_cv_header_stdint_t" != "_" ; then +echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint +echo "#include <stdint.h>" >>$ac_stdint +echo "#endif" >>$ac_stdint +echo "#endif" >>$ac_stdint +else + +cat >>$ac_stdint <<STDINT_EOF + +/* ................... shortcircuit part ........................... */ + +#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H +#include <stdint.h> +#else +#include <stddef.h> + +/* .................... configured part ............................ */ + +STDINT_EOF + +echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint +if test "_$ac_cv_header_stdint_x" != "_" ; then + ac_header="$ac_cv_header_stdint_x" + echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint +else + echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint +fi + +echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint +if test "_$ac_cv_header_stdint_o" != "_" ; then + ac_header="$ac_cv_header_stdint_o" + echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint +else + echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint +fi + +echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint +if test "_$ac_cv_header_stdint_u" != "_" ; then + ac_header="$ac_cv_header_stdint_u" + echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint +else + echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint +fi + +echo "" >>$ac_stdint + +if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then + echo "#include <$ac_header>" >>$ac_stdint + echo "" >>$ac_stdint +fi fi + +echo "/* which 64bit typedef has been found */" >>$ac_stdint +if test "$ac_cv_type_uint64_t" = "yes" ; then +echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint +fi +if test "$ac_cv_type_u_int64_t" = "yes" ; then +echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint +fi +echo "" >>$ac_stdint + +echo "/* which type model has been detected */" >>$ac_stdint +if test "_$ac_cv_char_data_model" != "_" ; then +echo "#define _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint +echo "#define _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint +else +echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint +echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint +fi +echo "" >>$ac_stdint + +echo "/* whether int_least types were detected */" >>$ac_stdint +if test "$ac_cv_type_int_least32_t" = "yes"; then +echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint +fi +echo "/* whether int_fast types were detected */" >>$ac_stdint +if test "$ac_cv_type_int_fast32_t" = "yes"; then +echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint +fi +echo "/* whether intmax_t type was detected */" >>$ac_stdint +if test "$ac_cv_type_intmax_t" = "yes"; then +echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint +fi +echo "" >>$ac_stdint + + cat >>$ac_stdint <<STDINT_EOF +/* .................... detections part ............................ */ + +/* whether we need to define bitspecific types from compiler base types */ +#ifndef _STDINT_HEADER_INTPTR +#ifndef _STDINT_HEADER_UINT32 +#ifndef _STDINT_HEADER_U_INT32 +#define _STDINT_NEED_INT_MODEL_T +#else +#define _STDINT_HAVE_U_INT_TYPES +#endif +#endif +#endif + +#ifdef _STDINT_HAVE_U_INT_TYPES +#undef _STDINT_NEED_INT_MODEL_T +#endif + +#ifdef _STDINT_CHAR_MODEL +#if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124 +#ifndef _STDINT_BYTE_MODEL +#define _STDINT_BYTE_MODEL 12 +#endif +#endif +#endif + +#ifndef _STDINT_HAVE_INT_LEAST32_T +#define _STDINT_NEED_INT_LEAST_T +#endif + +#ifndef _STDINT_HAVE_INT_FAST32_T +#define _STDINT_NEED_INT_FAST_T +#endif + +#ifndef _STDINT_HEADER_INTPTR +#define _STDINT_NEED_INTPTR_T +#ifndef _STDINT_HAVE_INTMAX_T +#define _STDINT_NEED_INTMAX_T +#endif +#endif + + +/* .................... definition part ............................ */ + +/* some system headers have good uint64_t */ +#ifndef _HAVE_UINT64_T +#if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T +#define _HAVE_UINT64_T +#elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T +#define _HAVE_UINT64_T +typedef u_int64_t uint64_t; +#endif +#endif + +#ifndef _HAVE_UINT64_T +/* .. here are some common heuristics using compiler runtime specifics */ +#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L +#define _HAVE_UINT64_T +#define _HAVE_LONGLONG_UINT64_T +typedef long long int64_t; +typedef unsigned long long uint64_t; + +#elif !defined __STRICT_ANSI__ +#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ +#define _HAVE_UINT64_T +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; + +#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__ +/* note: all ELF-systems seem to have loff-support which needs 64-bit */ +#if !defined _NO_LONGLONG +#define _HAVE_UINT64_T +#define _HAVE_LONGLONG_UINT64_T +typedef long long int64_t; +typedef unsigned long long uint64_t; +#endif + +#elif defined __alpha || (defined __mips && defined _ABIN32) +#if !defined _NO_LONGLONG +typedef long int64_t; +typedef unsigned long uint64_t; +#endif + /* compiler/cpu type to define int64_t */ +#endif +#endif +#endif + +#if defined _STDINT_HAVE_U_INT_TYPES +/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */ +typedef u_int8_t uint8_t; +typedef u_int16_t uint16_t; +typedef u_int32_t uint32_t; + +/* glibc compatibility */ +#ifndef __int8_t_defined +#define __int8_t_defined +#endif +#endif + +#ifdef _STDINT_NEED_INT_MODEL_T +/* we must guess all the basic types. Apart from byte-adressable system, */ +/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */ +/* (btw, those nibble-addressable systems are way off, or so we assume) */ + +dnl /* have a look at "64bit and data size neutrality" at */ +dnl /* http://unix.org/version2/whatsnew/login_64bit.html */ +dnl /* (the shorthand "ILP" types always have a "P" part) */ + +#if defined _STDINT_BYTE_MODEL +#if _STDINT_LONG_MODEL+0 == 242 +/* 2:4:2 = IP16 = a normal 16-bit system */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long uint32_t; +#ifndef __int8_t_defined +#define __int8_t_defined +typedef char int8_t; +typedef short int16_t; +typedef long int32_t; +#endif +#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444 +/* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */ +/* 4:4:4 = ILP32 = a normal 32-bit system */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#ifndef __int8_t_defined +#define __int8_t_defined +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +#endif +#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488 +/* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */ +/* 4:8:8 = LP64 = a normal 64-bit system */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#ifndef __int8_t_defined +#define __int8_t_defined +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +#endif +/* this system has a "long" of 64bit */ +#ifndef _HAVE_UINT64_T +#define _HAVE_UINT64_T +typedef unsigned long uint64_t; +typedef long int64_t; +#endif +#elif _STDINT_LONG_MODEL+0 == 448 +/* LLP64 a 64-bit system derived from a 32-bit system */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#ifndef __int8_t_defined +#define __int8_t_defined +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +#endif +/* assuming the system has a "long long" */ +#ifndef _HAVE_UINT64_T +#define _HAVE_UINT64_T +#define _HAVE_LONGLONG_UINT64_T +typedef unsigned long long uint64_t; +typedef long long int64_t; +#endif +#else +#define _STDINT_NO_INT32_T +#endif +#else +#define _STDINT_NO_INT8_T +#define _STDINT_NO_INT32_T +#endif +#endif + +/* + * quote from SunOS-5.8 sys/inttypes.h: + * Use at your own risk. As of February 1996, the committee is squarely + * behind the fixed sized types; the "least" and "fast" types are still being + * discussed. The probability that the "fast" types may be removed before + * the standard is finalized is high enough that they are not currently + * implemented. + */ + +#if defined _STDINT_NEED_INT_LEAST_T +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +#ifdef _HAVE_UINT64_T +typedef int64_t int_least64_t; +#endif + +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +#ifdef _HAVE_UINT64_T +typedef uint64_t uint_least64_t; +#endif + /* least types */ +#endif + +#if defined _STDINT_NEED_INT_FAST_T +typedef int8_t int_fast8_t; +typedef int int_fast16_t; +typedef int32_t int_fast32_t; +#ifdef _HAVE_UINT64_T +typedef int64_t int_fast64_t; +#endif + +typedef uint8_t uint_fast8_t; +typedef unsigned uint_fast16_t; +typedef uint32_t uint_fast32_t; +#ifdef _HAVE_UINT64_T +typedef uint64_t uint_fast64_t; +#endif + /* fast types */ +#endif + +#ifdef _STDINT_NEED_INTMAX_T +#ifdef _HAVE_UINT64_T +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; +#else +typedef long intmax_t; +typedef unsigned long uintmax_t; +#endif +#endif + +#ifdef _STDINT_NEED_INTPTR_T +#ifndef __intptr_t_defined +#define __intptr_t_defined +/* we encourage using "long" to store pointer values, never use "int" ! */ +#if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484 +typedef unsigned int uintptr_t; +typedef int intptr_t; +#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444 +typedef unsigned long uintptr_t; +typedef long intptr_t; +#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T +typedef uint64_t uintptr_t; +typedef int64_t intptr_t; +#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */ +typedef unsigned long uintptr_t; +typedef long intptr_t; +#endif +#endif +#endif + +/* The ISO C99 standard specifies that in C++ implementations these + should only be defined if explicitly requested. */ +#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS +#ifndef UINT32_C + +/* Signed. */ +# define INT8_C(c) c +# define INT16_C(c) c +# define INT32_C(c) c +# ifdef _HAVE_LONGLONG_UINT64_T +# define INT64_C(c) c ## L +# else +# define INT64_C(c) c ## LL +# endif + +/* Unsigned. */ +# define UINT8_C(c) c ## U +# define UINT16_C(c) c ## U +# define UINT32_C(c) c ## U +# ifdef _HAVE_LONGLONG_UINT64_T +# define UINT64_C(c) c ## UL +# else +# define UINT64_C(c) c ## ULL +# endif + +/* Maximal type. */ +# ifdef _HAVE_LONGLONG_UINT64_T +# define INTMAX_C(c) c ## L +# define UINTMAX_C(c) c ## UL +# else +# define INTMAX_C(c) c ## LL +# define UINTMAX_C(c) c ## ULL +# endif + + /* literalnumbers */ +#endif +#endif + +/* These limits are merily those of a two complement byte-oriented system */ + +/* Minimum of signed integral types. */ +#ifndef INT8_MIN +# define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +# define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +# define INT32_MIN (-2147483647-1) +#endif +#ifndef INT64_MIN +# define INT64_MIN (-__INT64_C(9223372036854775807)-1) +#endif + +/* Maximum of signed integral types. */ +#ifndef INT8_MAX +# define INT8_MAX (127) +#endif +#ifndef INT16_MAX +# define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +# define INT32_MAX (2147483647) +#endif +#ifndef INT64_MAX +# define INT64_MAX (__INT64_C(9223372036854775807)) +#endif + +/* Maximum of unsigned integral types. */ +#ifndef UINT8_MAX +# define UINT8_MAX (255) +#endif +#ifndef UINT16_MAX +# define UINT16_MAX (65535) +#endif +#ifndef UINT32_MAX +# define UINT32_MAX (4294967295U) +#endif +#ifndef UINT64_MAX +# define UINT64_MAX (__UINT64_C(18446744073709551615)) +#endif + +/* Minimum of signed integral types having a minimum size. */ +# define INT_LEAST8_MIN INT8_MIN +# define INT_LEAST16_MIN INT16_MIN +# define INT_LEAST32_MIN INT32_MIN +# define INT_LEAST64_MIN INT64_MIN +/* Maximum of signed integral types having a minimum size. */ +# define INT_LEAST8_MAX INT8_MAX +# define INT_LEAST16_MAX INT16_MAX +# define INT_LEAST32_MAX INT32_MAX +# define INT_LEAST64_MAX INT64_MAX + +/* Maximum of unsigned integral types having a minimum size. */ +# define UINT_LEAST8_MAX UINT8_MAX +# define UINT_LEAST16_MAX UINT16_MAX +# define UINT_LEAST32_MAX UINT32_MAX +# define UINT_LEAST64_MAX UINT64_MAX + + /* shortcircuit*/ +#endif + /* once */ +#endif +#endif +STDINT_EOF +fi + if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then + AC_MSG_NOTICE([$ac_stdint_h is unchanged]) + else + ac_dir=`AS_DIRNAME(["$ac_stdint_h"])` + AS_MKDIR_P(["$ac_dir"]) + rm -f $ac_stdint_h + mv $ac_stdint $ac_stdint_h + fi +],[# variables for create stdint.h replacement +PACKAGE="$PACKAGE" +VERSION="$VERSION" +ac_stdint_h="$ac_stdint_h" +_ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h) +ac_cv_stdint_message="$ac_cv_stdint_message" +ac_cv_header_stdint_t="$ac_cv_header_stdint_t" +ac_cv_header_stdint_x="$ac_cv_header_stdint_x" +ac_cv_header_stdint_o="$ac_cv_header_stdint_o" +ac_cv_header_stdint_u="$ac_cv_header_stdint_u" +ac_cv_type_uint64_t="$ac_cv_type_uint64_t" +ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" +ac_cv_char_data_model="$ac_cv_char_data_model" +ac_cv_long_data_model="$ac_cv_long_data_model" +ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" +ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" +ac_cv_type_intmax_t="$ac_cv_type_intmax_t" +]) +]) diff --git a/libjava/classpath/m4/ax_func_which_gethostbyname_r.m4 b/libjava/classpath/m4/ax_func_which_gethostbyname_r.m4 new file mode 100644 index 000000000..d1811efe3 --- /dev/null +++ b/libjava/classpath/m4/ax_func_which_gethostbyname_r.m4 @@ -0,0 +1,165 @@ +# m4/ax_func_which_gethostbyname_r.m4 + +# Copyright © 2005 Caolan McNamara <caolan@skynet.ie> +# Copyright © 2005 Daniel Richard G. <skunk@iskunk.org> + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. + +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you make +# and distribute a modified version of the Autoconf Macro, you may +# extend this special exception to the GPL to apply to your modified +# version as well. + + +AC_DEFUN([AX_FUNC_WHICH_GETHOSTBYNAME_R], [ + + AC_LANG_PUSH(C) + AC_MSG_CHECKING([how many arguments gethostbyname_r() takes]) + + AC_CACHE_VAL(ac_cv_func_which_gethostbyname_r, [ + +################################################################ + +ac_cv_func_which_gethostbyname_r=unknown + +# +# ONE ARGUMENT (sanity check) +# + +# This should fail, as there is no variant of gethostbyname_r() that takes +# a single argument. If it actually compiles, then we can assume that +# netdb.h is not declaring the function, and the compiler is thereby +# assuming an implicit prototype. In which case, we're out of luck. +# +AC_COMPILE_IFELSE( + AC_LANG_PROGRAM( + [[#include <netdb.h>]], + [[ + char *name = "www.gnu.org"; + (void)gethostbyname_r(name) /* ; */ + ]]), + ac_cv_func_which_gethostbyname_r=no) + +# +# SIX ARGUMENTS +# (e.g. Linux) +# + +if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then + +AC_COMPILE_IFELSE( + AC_LANG_PROGRAM( + [[#include <netdb.h>]], + [[ + char *name = "www.gnu.org"; + struct hostent ret, *retp; + char buf@<:@1024@:>@; + int buflen = 1024; + int my_h_errno; + (void)gethostbyname_r(name, &ret, buf, buflen, &retp, &my_h_errno) /* ; */ + ]]), + ac_cv_func_which_gethostbyname_r=six) + +fi + +# +# FIVE ARGUMENTS +# (e.g. Solaris) +# + +if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then + +AC_COMPILE_IFELSE( + AC_LANG_PROGRAM( + [[#include <netdb.h>]], + [[ + char *name = "www.gnu.org"; + struct hostent ret; + char buf@<:@1024@:>@; + int buflen = 1024; + int my_h_errno; + (void)gethostbyname_r(name, &ret, buf, buflen, &my_h_errno) /* ; */ + ]]), + ac_cv_func_which_gethostbyname_r=five) + +fi + +# +# THREE ARGUMENTS +# (e.g. AIX, HP-UX, Tru64) +# + +if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then + +AC_COMPILE_IFELSE( + AC_LANG_PROGRAM( + [[#include <netdb.h>]], + [[ + char *name = "www.gnu.org"; + struct hostent ret; + struct hostent_data data; + (void)gethostbyname_r(name, &ret, &data) /* ; */ + ]]), + ac_cv_func_which_gethostbyname_r=three) + +fi + +################################################################ + +]) dnl end AC_CACHE_VAL + +case "$ac_cv_func_which_gethostbyname_r" in + three) + AC_MSG_RESULT([three]) + AC_DEFINE([HAVE_FUNC_GETHOSTBYNAME_R_3], 1, [three-argument gethostbyname_r]) + ;; + + five) + AC_MSG_RESULT([five]) + AC_DEFINE([HAVE_FUNC_GETHOSTBYNAME_R_5], 1, [five-argument gethostbyname_r]) + ;; + + six) + AC_MSG_RESULT([six]) + AC_DEFINE([HAVE_FUNC_GETHOSTBYNAME_R_6], 1, [six-argument gethostbyname_r]) + ;; + + no) + AC_MSG_RESULT([cannot find function declaration in netdb.h]) + ;; + + unknown) + AC_MSG_RESULT([can't tell]) + ;; + + *) + AC_MSG_ERROR([internal error]) + ;; +esac + +AC_LANG_POP(C) + +]) dnl end AC_DEFUN diff --git a/libjava/classpath/m4/gcc_attribute.m4 b/libjava/classpath/m4/gcc_attribute.m4 new file mode 100644 index 000000000..f332d21a6 --- /dev/null +++ b/libjava/classpath/m4/gcc_attribute.m4 @@ -0,0 +1,133 @@ +dnl CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>) +AC_DEFUN([CACHED_TRY_COMPILE],[ + AC_MSG_CHECKING($1) + AC_CACHE_VAL($2,[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]], [[$4]])],[$2=yes],[$2=no]) + ]) + if test "x$$2" = xyes; then + true + $5 + else + true + $6 + fi +]) + +dnl GCC_ATTRIBUTE(<short-label>,<cachevar>,<func-params>,<attribute>,<HAVE>,<desc>,[<true-cmds>],[<false-cmds>]) +AC_DEFUN([GCC_ATTRIBUTE],[ + CACHED_TRY_COMPILE(__attribute__(($1)),gcc_cv_c_gcc_attribute_$2,, + [extern int testfunction($3) __attribute__(($4))], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GNUC25_$5,,$6) + $7, + AC_MSG_RESULT(no) + $8) +]) + + +AC_DEFUN([GCC_ATTRIBUTE_SUPPORTED],[ + GCC_ATTRIBUTE([,,],supported,[int x],[,,],ATTRIB,[Define if function attributes a la GCC 2.5 and higher are available.]) + AH_BOTTOM([/* GNU C attributes. */ +#ifndef FUNCATTR +#ifdef HAVE_GNUC25_ATTRIB +#define FUNCATTR(x) __attribute__(x) +#else +#define FUNCATTR(x) +#endif +#endif]) + +]) +AC_DEFUN([GCC_ATTRIBUTE_CONST],[ + AC_REQUIRE([GCC_ATTRIBUTE_SUPPORTED]) + GCC_ATTRIBUTE(const,const,[int x],const,CONST,[Define if constant functions a la GCC 2.5 and higher are available.]) + AH_BOTTOM([/* GNU C constant functions, or null. */ +#ifndef ATTRCONST +#ifdef HAVE_GNUC25_CONST +#define ATTRCONST const +#else +#define ATTRCONST +#endif +#endif +#ifndef CONSTANT +#define CONSTANT FUNCATTR((ATTRCONST)) +#endif]) +]) +AC_DEFUN([GCC_ATTRIBUTE_NORETURN],[ + AC_REQUIRE([GCC_ATTRIBUTE_SUPPORTED]) + GCC_ATTRIBUTE(noreturn,noreturn,[int x],noreturn,NORETURN,[Define if nonreturning functions a la GCC 2.5 and higher are available.]) + AH_BOTTOM([/* GNU C nonreturning functions, or null. */ +#ifndef ATTRNORETURN +#ifdef HAVE_GNUC25_NORETURN +#define ATTRNORETURN noreturn +#else /* ! HAVE_GNUC25_NORETURN */ +#define ATTRNORETURN +#endif /* HAVE_GNUC25_NORETURN */ +#endif /* ATTRNORETURN */ +#ifndef NONRETURNING +#define NONRETURNING FUNCATTR((ATTRNORETURN)) +#endif /* NONRETURNING */]) +]) +AC_DEFUN([GCC_ATTRIBUTE_UNUSED],[ + AC_REQUIRE([GCC_ATTRIBUTE_SUPPORTED]) + GCC_ATTRIBUTE(unused,unused,[int x],unused,UNUSED,[Define if unused variables la GCC 2.5 and higher are available.]) + AH_BOTTOM([/* GNU C unused functions, or null. */ +#ifndef ATTRUNUSED +#ifdef HAVE_GNUC25_UNUSED +#define ATTRUNUSED unused +#else +#define ATTRUNUSED +#endif +#endif +#ifndef UNUSED +#define UNUSED FUNCATTR((ATTRUNUSED)) +#endif]) +]) +AC_DEFUN([GCC_ATTRIBUTE_FORMAT],[ + AC_REQUIRE([GCC_ATTRIBUTE_SUPPORTED]) + GCC_ATTRIBUTE(format...,format,[char *y, ...],[format(printf,1,2)],PRINTFFORMAT,[Define if printf-format argument lists a la GCC are available.]) + AH_BOTTOM([/* GNU C printf formats, or null. */ +#ifndef ATTRPRINTF +#ifdef HAVE_GNUC25_PRINTFFORMAT +#define ATTRPRINTF(si,tc) format(printf,si,tc) +#else +#define ATTRPRINTF(si,tc) +#endif +#endif +#ifndef PRINTFFORMAT +#define PRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc))) +#endif + +#ifndef NONRETURNPRINTFFORMAT +#define NONRETURNPRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc),ATTRNORETURN)) +#endif]) +]) +AC_DEFUN([GCC_ATTRIBUTE_ALWAYS_INLINE],[ + AC_REQUIRE([GCC_ATTRIBUTE_SUPPORTED]) + GCC_ATTRIBUTE(always_inline,always_inline,[int x],always_inline,ALWAYS_INLINE,[Define if unconditional inlining of functions a la GCC 3.1 and higher are available.]) + AH_BOTTOM([/* GNU C constant functions, or null. */ +#ifndef ATTRALWAYS_INLINE +#ifdef HAVE_GNUC25_ALWAYS_INLINE +#define ATTRALWAYS_INLINE always_inline +#else +#define ATTRALWAYS_INLINE +#endif +#endif +#ifndef ALWAYS_INLINE +#define ALWAYS_INLINE FUNCATTR((ATTRALWAYS_INLINE)) +#endif]) +]) +AC_DEFUN([GCC_ATTRIBUTE_PACKED],[ + AC_REQUIRE([GCC_ATTRIBUTE_SUPPORTED]) + GCC_ATTRIBUTE(packed,packed,[int x],packed,PACKED,[Define if packing of struct members a la GCC 2.5 and higher is available.]) + AH_BOTTOM([/* GNU C constant functions, or null. */ +#ifndef ATTRPACKED +#ifdef HAVE_GNUC25_PACKED +#define ATTRPACKED packed +#else +#define ATTRPACKED +#endif +#endif +#ifndef PACKED +#define PACKED FUNCATTR((ATTRPACKED)) +#endif]) +]) diff --git a/libjava/classpath/m4/iconv.m4 b/libjava/classpath/m4/iconv.m4 new file mode 100644 index 000000000..c5f357982 --- /dev/null +++ b/libjava/classpath/m4/iconv.m4 @@ -0,0 +1,103 @@ +# iconv.m4 serial AM4 (gettext-0.11.3) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include <stdlib.h> +#include <iconv.h> +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi +]) diff --git a/libjava/classpath/m4/pkg.m4 b/libjava/classpath/m4/pkg.m4 new file mode 100644 index 000000000..f2bfc2d49 --- /dev/null +++ b/libjava/classpath/m4/pkg.m4 @@ -0,0 +1,57 @@ + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + |