jamie@89: ##### http://autoconf-archive.cryp.to/ac_jni_include_dir.html jamie@89: # jamie@89: # SYNOPSIS jamie@89: # jamie@89: # AC_JNI_INCLUDE_DIR jamie@89: # jamie@89: # DESCRIPTION jamie@89: # jamie@89: # AC_JNI_INCLUDE_DIR finds include directories needed for compiling jamie@89: # programs using the JNI interface. jamie@89: # jamie@89: # JNI include directories are usually in the java distribution This jamie@89: # is deduced from the value of JAVAC. When this macro completes, a jamie@89: # list of directories is left in the variable JNI_INCLUDE_DIRS. jamie@89: # jamie@89: # Example usage follows: jamie@89: # jamie@89: # AC_JNI_INCLUDE_DIR jamie@89: # jamie@89: # for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS jamie@89: # do jamie@89: # CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" jamie@89: # done jamie@89: # jamie@89: # If you want to force a specific compiler: jamie@89: # jamie@89: # - at the configure.in level, set JAVAC=yourcompiler before calling jamie@89: # AC_JNI_INCLUDE_DIR jamie@89: # jamie@89: # - at the configure level, setenv JAVAC jamie@89: # jamie@89: # Note: This macro can work with the autoconf M4 macros for Java jamie@89: # programs. This particular macro is not part of the original set of jamie@89: # macros. jamie@89: # jamie@89: # LAST MODIFICATION jamie@89: # jamie@89: # 2006-05-27 jamie@89: # jamie@89: # COPYLEFT jamie@89: # jamie@89: # Copyright (c) 2006 Don Anderson jamie@89: # jamie@89: # Copying and distribution of this file, with or without jamie@89: # modification, are permitted in any medium without royalty provided jamie@89: # the copyright notice and this notice are preserved. jamie@89: jamie@89: AC_DEFUN([AC_JNI_INCLUDE_DIR],[ jamie@89: jamie@89: JNI_INCLUDE_DIRS="" jamie@89: jamie@89: test "x$JAVAC" = x && AC_MSG_ERROR(['\$JAVAC' undefined]) jamie@89: AC_PATH_PROG(_ACJNI_JAVAC, $JAVAC, no) jamie@89: test "x$_ACJNI_JAVAC" = xno && AC_MSG_ERROR([$JAVAC could not be found in path]) jamie@89: jamie@89: _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") jamie@89: _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` jamie@89: case "$host_os" in jamie@89: darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` jamie@89: _JINC="$_JTOPDIR/Headers";; jamie@89: *) _JINC="$_JTOPDIR/include";; jamie@89: esac jamie@89: if test -f "$_JINC/jni.h"; then jamie@89: JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC" jamie@89: else jamie@89: _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` jamie@89: if test -f "$_JTOPDIR/include/jni.h"; then jamie@89: JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include" jamie@89: else jamie@89: AC_MSG_ERROR([cannot find java include files]) jamie@89: fi jamie@89: fi jamie@89: jamie@89: # get the likely subdirectories for system specific java includes jamie@89: case "$host_os" in jamie@89: bsdi*) _JNI_INC_SUBDIRS="bsdos";; jamie@89: linux*) _JNI_INC_SUBDIRS="linux genunix";; jamie@89: osf*) _JNI_INC_SUBDIRS="alpha";; jamie@89: solaris*) _JNI_INC_SUBDIRS="solaris";; jamie@89: mingw*) _JNI_INC_SUBDIRS="win32";; jamie@89: cygwin*) _JNI_INC_SUBDIRS="win32";; jamie@89: *) _JNI_INC_SUBDIRS="genunix";; jamie@89: esac jamie@89: jamie@89: # add any subdirectories that are present jamie@89: for JINCSUBDIR in $_JNI_INC_SUBDIRS jamie@89: do jamie@89: if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then jamie@89: JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" jamie@89: fi jamie@89: done jamie@89: ]) jamie@89: jamie@89: # _ACJNI_FOLLOW_SYMLINKS jamie@89: # Follows symbolic links on , jamie@89: # finally setting variable _ACJNI_FOLLOWED jamie@89: # -------------------- jamie@89: AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[ jamie@89: # find the include directory relative to the javac executable jamie@89: _cur="$1" jamie@89: while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do jamie@89: AC_MSG_CHECKING(symlink for $_cur) jamie@89: _slink=`ls -ld "$_cur" | sed 's/.* -> //'` jamie@89: case "$_slink" in jamie@89: /*) _cur="$_slink";; jamie@89: # 'X' avoids triggering unwanted echo options. jamie@89: *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; jamie@89: esac jamie@89: AC_MSG_RESULT($_cur) jamie@89: done jamie@89: _ACJNI_FOLLOWED="$_cur" jamie@89: ])# _ACJNI