Codebase list glpk-java / HEAD configure.ac
HEAD

Tree @HEAD (Download .tar.gz)

configure.ac @HEADraw · history · blame

dnl GLPK for Java

dnl Initialization
AC_INIT([GLPK for Java], [1.12.0], [xypron.glpk@gmx.de],
  [libglpk-java], [http://glpk-java.sourceforge.net])
AC_CONFIG_SRCDIR([swig/glpk.i])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
LT_INIT

dnl Compiler check
AC_PROG_CC
AC_CHECK_PROG([have_cc],[$CC],[yes],[no])
if test [$have_cc] != [yes]; then
  AC_MSG_ERROR([$CC is missing])
fi

dnl Provide $(LN_S)
AC_PROG_LN_S

dnl Check for programs needed
AC_PATH_PROG([SWIG],[swig])
if test "x$SWIG" == "x"; then
  AC_MSG_ERROR([Swig is missing])
fi
AC_PATH_PROG([JAVAC],[javac])
if test "x$JAVAC" == "x"; then
  AC_MSG_ERROR([javac is missing])
fi
AC_PATH_PROG([JAVADOC],[javadoc])
if test "x$JAVADOC" == "x"; then
  AC_MSG_ERROR([javadoc is missing])
fi
AC_PATH_PROG([JAR],[jar])
if test "x$JAR" == "x"; then
  AC_MSG_ERROR([jar is missing])
fi

AC_ARG_ENABLE(maven,
AC_HELP_STRING([--enable-maven],
   [build maven project [[default=yes]]]),
   [case $enableval in
      yes | no) ;;
      *) AC_MSG_ERROR([invalid value $enableval for --enable-maven]);;
      esac],
   [enable_maven=yes;])

if test "x$enable_maven" == "xyes"; then
  AC_PATH_PROG([MVN],[mvn])
fi
AM_CONDITIONAL([HAVEMVN], [test "x$MVN" != "x"])
if test "x$enable_maven" == "xyes"; then
  AM_COND_IF([HAVEMVN],
    [],
    AC_MSG_WARN([Maven is missing])
    )
fi

AC_ARG_ENABLE(libpath,
AC_HELP_STRING([--enable-libpath],
   [load GLPK library from java.library.path [[default=no]]]),
   [case $enableval in
      yes | no) ;;
      *) AC_MSG_ERROR([invalid value $enableval for --enable-libpath]);;
      esac],
   [enable_libpath=no])


AC_MSG_CHECKING([whether to load GLPK library from java.library.path])
AC_MSG_RESULT([$enable_libpath])
if test "x$enable_libpath" == "xyes"; then
   SWIGFLAGS="-DGLPKPRELOAD $SWIGFLAGS"
fi

dnl Check JAVA_HOME is set
if test "x$JAVA_HOME" == "x"; then
  AC_MSG_ERROR([JAVA_HOME is not set])
fi

dnl Include path
CPPFLAGS+=" -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"

dnl SWIG
AC_ARG_VAR([SWIGFLAGS],[The list of flags that should be passed to SWIG.])
SWIGFLAGS="-I/usr/include -I/usr/local/include $SWIGFLAGS"
SWIGFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux $SWIGFLAGS"

dnl Thread local storage
AC_MSG_CHECKING(for thread local storage (TLS) class)
tls_keywords="_Thread_local __thread __declspec(thread)"
cv_tls="none"
for tls_keyword in $tls_keywords; do
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([
    #include <stdlib.h>
    static void foo(void) {
    static ] $tls_keyword [ int bar;
      exit(1);
    }])],
    [cv_tls=$tls_keyword ; break],
    []
   )
done
AC_MSG_RESULT($cv_tls)
if test "x$cv_tls" == "xnone"; then
  cv_tls="/**/"
fi
AC_DEFINE_UNQUOTED([TLS], $cv_tls, [Thread local storage])

dnl Check includes
AC_CHECK_HEADER([glpk.h],
  [],
  [AC_MSG_ERROR([glpk.h not found])]
  )
AC_CHECK_HEADER([jni.h],
  [],
  [AC_MSG_ERROR([jni.h not found])]
  )

dnl Makefiles
AC_CONFIG_FILES([
  Makefile
  doc/Makefile
  swig/Makefile
  ])
  
CPPFLAGS+=" -I.."
AC_MSG_NOTICE([CFLAGS = $CFLAGS])
AC_MSG_NOTICE([CPPFLAGS = $CPPFLAGS])
AC_MSG_NOTICE([SWIGFLAGS = $SWIGFLAGS])
AC_MSG_NOTICE([LDFLAGS = $LDFLAGS])

dnl Generate files
AC_OUTPUT