libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with basic scripting


From: Al
Subject: Re: Problem with basic scripting
Date: Sat, 10 May 2003 15:33:21 +0100

Stoopid. Sorry. Im all over the place.This was meant for address@hidden
Sorryyy ...

----- Original Message -----
From: "Al" <address@hidden>
To: <address@hidden>
Sent: Saturday, May 10, 2003 3:31 PM
Subject: Problem with basic scripting


> Im having a very annoying problem. Im using the macro ac_jni_include_dirs
> from the gnu archive to determine the location of the Java includes
> directories. Ill paste it below for convenience. The suggested usage is
>
> JAVAC="javac"
> AC_JNI_INCLUDE_DIR
> for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
> do
>     CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
> done
>
> Now, Im using Cygwin on Windows 98 and 2k and it happens that in both
cases
> my java home is nestled in the awful C:\Program Files directory This
causes
> problems on 2k because CPPFLAGS comes out something like
>
> -I/cygdrive/c/Program -IFiles/Java/include
>
> , its alright on 98 as $JNI_INCLUDE_DIRS comes back with the short windows
> paths, ie /cygdrive/c/Progra~1/...
>
> I thought this could be dealt with simply by changing the macro to wrap
each
> path in double quotes, but that doesnt work. The above for loop the
produces
> something stupid like
>
> -I" -I/cygdrive/c/Program -IFiles/Java/include
>
> When I type the for loop into the shell directly with exactly the same
value
> of $JNI_INCLUDE_DIRS as is used during configuration, the loop works as
you
> would expect it to. Whats the deal with the diference running it via
> configure?
>
> In an effort to avoid the for loop altogether I tried using sed;
>
> CPPFLAGS="$CPPFLAGS $(echo $JNI_INCLUDE_DIRS | sed 's,"[^"]",-I&,g')"
>
> but that doesnt work
>
> Any suggestions?
>
> Alan
>
> Ive made two slight modifications to the m4 source below. The first to
> recognise cygwin and the second to wrap paths in "s as described above.
>
> === AC_JNI_INCLUDE_DIR by Don Anderson <address@hidden> ===
>
> dnl Available from the GNU Autoconf Macro Archive at:
> dnl
http://www.gnu.org/software/ac-archive/htmldoc/ac_jni_include_dirs.html
> dnl
> AC_DEFUN(AC_JNI_INCLUDE_DIR,[
>
> JNI_INCLUDE_DIRS=""
>
> test "x$JAVAC" = x && AC_MSG_ERROR(['$JAVAC' undefined])
> AC_PATH_PROG(_ACJNI_JAVAC, $JAVAC, no)
> test "x$_ACJNI_JAVAC" = xno && AC_MSG_ERROR([$JAVAC could not be found in
> path])
>
> _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC")
> _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
> case "$host_os" in
>         darwin*)        _JTOPDIR=`echo "$_JTOPDIR" | sed -e
's:/[[^/]]*$::'`
>                         _JINC="$_JTOPDIR/Headers";;
>         *)              _JINC="$_JTOPDIR/include";;
> esac
> if test -f "$_JINC/jni.h"; then
>         JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"
> else
>         _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
>         if test -f "$_JTOPDIR/include/jni.h"; then
>                 JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"
>         else
>                 AC_MSG_ERROR([cannot find java include files])
>         fi
> fi
>
> # get the likely subdirectories for system specific java includes
> #
> # CYGWIN CASE ADDED HERE
> #
> case "$host_os" in
> *cygwin*)       _JNI_INC_SUBDIRS="win32";;
> bsdi*)          _JNI_INC_SUBDIRS="bsdos";;
> linux*)         _JNI_INC_SUBDIRS="linux genunix";;
> osf*)           _JNI_INC_SUBDIRS="alpha";;
> solaris*)       _JNI_INC_SUBDIRS="solaris";;
> *)              _JNI_INC_SUBDIRS="genunix";;
> esac
>
> # add any subdirectories that are present
> #
> # CHANGED SO THAT EACH DIRECTORY PATH IS WRAPPED IN \"
> #
> for JINCSUBDIR in $_JNI_INC_SUBDIRS
> do
>         if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then
>                 JNI_INCLUDE_DIRS="\"$JNI_INCLUDE_DIRS\"
> \"$_JTOPDIR/include/$JINCSUBDIR\""
>         fi
> done
> ])
>
> # _ACJNI_FOLLOW_SYMLINKS <path>
> # Follows symbolic links on <path>,
> # finally setting variable _ACJNI_FOLLOWED
> # --------------------
> AC_DEFUN(_ACJNI_FOLLOW_SYMLINKS,[
> # find the include directory relative to the javac executable
> _cur="$1"
> while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
>         AC_MSG_CHECKING(symlink for $_cur)
>         _slink=`ls -ld "$_cur" | sed 's/.* -> //'`
>         case "$_slink" in
>         /*) _cur="$_slink";;
>         # 'X' avoids triggering unwanted echo options.
>         *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e
> 's:[[^/]]*$::'`"$_slink";;
>         esac
>         AC_MSG_RESULT($_cur)
> done
> _ACJNI_FOLLOWED="$_cur"
> ])# _ACJNI
>
>
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]