Skip to content

Commit

Permalink
Use string substitution and shell redirection that works with dash.
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiccooney committed Jul 16, 2013
1 parent f691d91 commit 258c1dd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ set -e
unset GCC

while [ $# -gt 0 ] ; do
if [ "${1:0:11}" = "--with-gcc=" ] ; then
GCC=${1:11}
maybe_gcc=${1#--with-gcc=}
if [ "$maybe_gcc" != "$1" ]; then
GCC=$maybe_gcc
fi
shift
done

rm -f foreign-jni.buildinfo

if ! echo '#include <jni.h>' | $GCC -E - &> /dev/null ; then
JNI_GCC_INCLUDES=$"-I${JAVA_HOME}/include/"
if ! echo '#include <jni.h>' | $GCC -E - 2>&1 > /dev/null ; then
JNI_GCC_INCLUDES="-I${JAVA_HOME}/include/"
if [ -d "${JAVA_HOME}/include/linux" ] ; then
JNI_GCC_INCLUDES="$JNI_GCC_INCLUDES -I${JAVA_HOME}/include/linux/"
fi
Expand All @@ -22,8 +23,8 @@ if ! echo '#include <jni.h>' | $GCC -E - &> /dev/null ; then
if [ -d "${JAVA_HOME}/include/win32" ] ; then
JNI_GCC_INCLUDES="$JNI_GCC_INCLUDES -I${JAVA_HOME}/include/win32/"
fi
if ! echo '#include <jni.h>' | $GCC ${JNI_GCC_INCLUDES} -E - &> /dev/null ; then
echo "Include file jni.h not found! Please set $JAVA_HOME or install jni.h in your compiler include path."
if ! echo '#include <jni.h>' | $GCC ${JNI_GCC_INCLUDES} -E - 2>&1 > /dev/null ; then
echo "Include file jni.h not found! Please set \$JAVA_HOME or install jni.h in your compiler include path."
exit 1
else
echo cc-options: ${JNI_GCC_INCLUDES} >> foreign-jni.buildinfo
Expand Down

0 comments on commit 258c1dd

Please sign in to comment.