Skip to content

Commit

Permalink
fail when java/ruby/lua are enabled but not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Aug 20, 2011
1 parent 569d85e commit 226853f
Showing 1 changed file with 95 additions and 91 deletions.
186 changes: 95 additions & 91 deletions src/configure
Expand Up @@ -115,11 +115,7 @@ _libshogun=yes
_python=auto
_octave=auto
_r=auto
_java=no
_csharp=no
_ruby=no
_ruby_narray=auto
_lua=no
#static interfaces
_cmdline_static=auto
_python_static=auto
Expand Down Expand Up @@ -495,76 +491,8 @@ check_python()
fi
}

test_java()
{
if test "$_libshogun" = no
then
if test "$_java_modular" = yes
then
die "libshogun is required for java_modular"
else
_java_modular=no
fi
fi

if test "$_java_modular" = no
then
return
fi
echocheck "Java"
if java -version >/dev/null 2>&1
then
JAVAVER=`java -version 2>&1 | head -n 1 | cut -f 3 -d ' ' | tr -d '"'`
echores "${JAVAVER}"

cat > $TMPJAVA << EOF
public class configure {
public static void main(String[] args) {
for (String arg: args) {
System.out.println(System.getProperty(arg));
}
}
}
EOF
echocheck "Java native interface files (jni.h)"
if javac $TMPJAVA >/dev/null 2>&1
then
EXT_IF_SWIG_JAVA_MODULAR='stop'
PRE_LIB_SWIG_JAVA_MODULAR='lib'
EXT_LIB_SWIG_JAVA_MODULAR=.so
mkdir -p interfaces/java_modular/org/shogun >/dev/null 2>&1
SWIGFLAGS_JAVA_MODULAR="-c++ -java -package org.shogun -outdir org/shogun"
INCLUDES_JAVA="-I$(dirname $(java configure java.home))/include"
INCLUDES_JAVA="$INCLUDES_JAVA $INCLUDES_JAVA/`uname -s | tr 'A-Z' 'a-z'`"

COMPFLAGS_CPP="$COMPFLAGS_CPP -fno-strict-aliasing"
COMPFLAGS_C="$COMPFLAGS_C -fno-strict-aliasing"
LINKFLAGS_JAVA="--shared"
echores "yes"

echocheck "Ant"
if ant -version >/dev/null 2>&1
then
echores "`ant -version | cut -f 4 -d ' '`"
_java=yes
else
echores "ant not detected"
fi
else
echores "javac not detected"
fi
else
echores "not detected"
fi
}

test_jblas()
{
if test "$_java" = no
then
return
fi

echocheck "Jblas"
cat > $TMPJAVA << EOF
import org.jblas.DoubleMatrix;
Expand Down Expand Up @@ -600,11 +528,6 @@ EOF

test_ujmp()
{
if test "$_java" = no
then
return
fi

echocheck "UJMP"
cat > $TMPJAVA << EOF
import org.ujmp.core.Matrix;
Expand Down Expand Up @@ -639,6 +562,72 @@ EOF
fi
}


test_java()
{
if test "$_libshogun" = no
then
if test "$_java_modular" = yes
then
die "libshogun is required for java_modular"
else
_java_modular=no
fi
fi

if test "$_java_modular" = no
then
return
fi
echocheck "Java"
if java -version >/dev/null 2>&1
then
JAVAVER=`java -version 2>&1 | head -n 1 | cut -f 3 -d ' ' | tr -d '"'`
echores "${JAVAVER}"

cat > $TMPJAVA << EOF
public class configure {
public static void main(String[] args) {
for (String arg: args) {
System.out.println(System.getProperty(arg));
}
}
}
EOF
echocheck "Java native interface files (jni.h)"
if javac $TMPJAVA >/dev/null 2>&1
then
EXT_IF_SWIG_JAVA_MODULAR='stop'
PRE_LIB_SWIG_JAVA_MODULAR='lib'
EXT_LIB_SWIG_JAVA_MODULAR=.so
mkdir -p interfaces/java_modular/org/shogun >/dev/null 2>&1
SWIGFLAGS_JAVA_MODULAR="-c++ -java -package org.shogun -outdir org/shogun"
INCLUDES_JAVA="-I$(dirname $(java configure java.home))/include"
INCLUDES_JAVA="$INCLUDES_JAVA $INCLUDES_JAVA/`uname -s | tr 'A-Z' 'a-z'`"

COMPFLAGS_CPP="$COMPFLAGS_CPP -fno-strict-aliasing"
COMPFLAGS_C="$COMPFLAGS_C -fno-strict-aliasing"
LINKFLAGS_JAVA="--shared"
echores "yes"

echocheck "Ant"
if ant -version >/dev/null 2>&1
then
echores "`ant -version | cut -f 4 -d ' '`"
_java_modular=yes
test_jblas
test_ujmp
else
echores "ant not detected"
fi
else
echores "javac not detected"
fi
else
echores "not detected"
fi
}

test_csharp()
{
if test "$_csharp_modular" = no
Expand All @@ -659,9 +648,15 @@ test_csharp()
INCLUDES_CSHARP=
LINKFLAGS_CSHARP="--shared"

_csharp=yes
_csharp_modular=yes
else
echores "not detected"
if test "$_csharp_modular" = yes
then
die "csharp/csharp development files missing"
else
echores "not detected"
_csharp_modular=no
fi
fi
}

Expand Down Expand Up @@ -701,18 +696,25 @@ EOF
PRE_LIB_SWIG_RUBY_MODULAR=
EXT_LIB_SWIG_RUBY_MODULAR=.so
SWIGFLAGS_RUBY_MODULAR="-c++ -ruby"
_ruby=yes
_ruby_modular=yes
test_ruby_narray
else
echores "no"
fi
else
echores "not detected"
if test "$_ruby_modular" = yes
then
die "ruby/ruby development files missing"
else
echores "not detected"
_ruby_modular=no
fi
fi
}

test_ruby_narray()
{
if test "$_ruby" = yes
if test "$_ruby_modular" = yes
then
cat >$TMPRUBY << EOF
require 'narray'
Expand Down Expand Up @@ -790,11 +792,16 @@ test_lua()
LINKFLAGS_LUA="-llua${LV} --shared"
INCLUDES_LUA="-I/usr/include/lua${LV} -I/usr/local/include/lua${LV}"
fi

echores "${LUAVER}"
_lua=yes
_lua_modular=yes
else
echores "not detected"
if test "$_lua_modular" = yes
then
die "lua/lua development files missing"
else
echores "not detected"
_lua_modular=no
fi
fi
}

Expand Down Expand Up @@ -3571,19 +3578,19 @@ test_modular()
JAVA_MODULAR_TARGET=java_modular
fi

if test "$_csharp" = yes && test "$_csharp_modular" != no
if test "$_csharp_modular" != no
then
PARTS="$PARTS csharp_modular"
CSHARP_MODULAR_TARGET=csharp_modular
fi

if test "$_ruby" = yes && test "$_ruby_modular" != no
if test "$_ruby_modular" != no
then
PARTS="$PARTS ruby_modular"
RUBY_MODULAR_TARGET=ruby_modular
fi

if test "$_lua" = yes && test "$_lua_modular" != no
if test "$_lua_modular" != no
then
PARTS="$PARTS lua_modular"
LUA_MODULAR_TARGET=lua_modular
Expand Down Expand Up @@ -4672,11 +4679,8 @@ test_r
test_matlab
test_elwms
test_java
test_jblas
test_ujmp
test_csharp
test_ruby
test_ruby_narray
test_lua
test_modular
test_static_linking
Expand Down

0 comments on commit 226853f

Please sign in to comment.