2013-11-03 14:12:38 +00:00
|
|
|
dnl Gecode support
|
|
|
|
|
2014-03-06 02:09:48 +00:00
|
|
|
AC_ARG_ENABLE(gecode,
|
|
|
|
[ --enable-gecode install gecode library],
|
|
|
|
[use_gecode="$enableval"], use_gecode=no)
|
|
|
|
|
2013-11-03 14:12:38 +00:00
|
|
|
dnl gecode is usually in /usr/local
|
2014-06-11 19:36:50 +01:00
|
|
|
if test -d /usr/local/include/gecode -a x$SYSROOT = x; then
|
2013-11-03 14:12:38 +00:00
|
|
|
CFLAGS="$CFLAGS -I/usr/local/include"
|
2014-05-06 23:00:17 +01:00
|
|
|
SHLIB_CXXFLAGS="$SHLIB_CXXFLAGS -I/usr/local/include"
|
2013-11-03 14:12:38 +00:00
|
|
|
GECODE_EXTRALIBS="-L/usr/local/lib"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$use_gecode" = no; then
|
2014-02-10 23:30:21 +00:00
|
|
|
PKG_GECODE=""
|
2013-11-03 14:12:38 +00:00
|
|
|
else
|
2014-02-10 23:30:21 +00:00
|
|
|
PKG_GECODE="packages/gecode"
|
2013-11-03 14:12:38 +00:00
|
|
|
fi
|
2014-02-10 23:30:21 +00:00
|
|
|
AC_SUBST(PKG_GECODE)
|
2013-11-03 14:12:38 +00:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([if dynamic arrays are supported])
|
|
|
|
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([[void foo(int n) { int a[n]; a[1]=0; }]],[[foo(3);]])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_DEFINE([HAVE_DYNARRAY],[1],[Define if dynamic arrays are supported])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
GECODE_VERSION=unknown-gecode-version
|
|
|
|
|
|
|
|
|
|
|
|
if test "$use_gecode" = yes; then
|
2014-01-23 01:46:16 +00:00
|
|
|
if test $i_am_cross_compiling = yes
|
|
|
|
then
|
|
|
|
GECODE_VERSION=4.2.1
|
2014-03-06 02:09:48 +00:00
|
|
|
elif test x"$WINDOWS" = x; then
|
|
|
|
if test $ac_cv_sizeof_int_p = 8; then
|
|
|
|
GECODE_ARCH=x64
|
|
|
|
else
|
|
|
|
GECODE_ARCH=i386
|
|
|
|
fi
|
|
|
|
GECODE_PATH=`which fzn-gecode`
|
|
|
|
GECODE_PATH=`dirname "$GECODE_PATH"`
|
|
|
|
GECODE_PATH=`dirname "$GECODE_PATH"`
|
|
|
|
GECODE_INCLUDES="$GECODE_PATH"/include
|
|
|
|
GECODE_LIBDIR="\"$GECODE_PATH\""/lib
|
|
|
|
GECODE_BINDIR="\"$GECODE_PATH\""/bin
|
|
|
|
GECODE_TVERSION=`echo "$GECODE_PATH"/lib/GecodeDriver-*-d-"$GECODE_ARCH".lib | cut -d'-' -f 2-4`
|
|
|
|
GECODE_VERSION=`echo "$GECODE_TVERSION"|sed 's/-/\./g'`
|
|
|
|
GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'`
|
|
|
|
GE_SUF="-$GECODE_TVERSION-r-$GECODE_ARCH.dll"
|
|
|
|
GECODE_EXTRALIBS="$GECODE_BINDIR/GecodeDriver$GE_SUF \
|
|
|
|
$GECODE_BINDIR/GecodeSupport$GE_SUF \
|
|
|
|
$GECODE_BINDIR/GecodeKernel$GE_SUF \
|
|
|
|
$GECODE_BINDIR/GecodeInt$GE_SUF \
|
|
|
|
$GECODE_BINDIR/GecodeSet$GE_SUF \
|
|
|
|
$GECODE_BINDIR/GecodeSearch$GE_SUF"
|
|
|
|
if test "$GECODE_MAJOR" = "4"; then
|
|
|
|
GECODE_EXTRALIBS="$GECODE_EXTRALIBS $GECODE_BINDIR/GecodeFloat$GE_SUF"
|
|
|
|
fi
|
|
|
|
else
|
2013-11-03 14:12:38 +00:00
|
|
|
AC_MSG_CHECKING([gecode version])
|
|
|
|
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
|
|
|
|
#include "gecode/support/config.hpp"
|
|
|
|
#include <stdio.h>
|
|
|
|
]],[[
|
|
|
|
FILE* out = fopen("conftest.out","w");
|
|
|
|
fprintf(out,"%s\n",GECODE_VERSION);
|
|
|
|
fclose(out);
|
|
|
|
return 0;
|
|
|
|
]])],[GECODE_VERSION=$(cat conftest.out)
|
|
|
|
AC_MSG_RESULT([$GECODE_VERSION])],
|
|
|
|
[AC_MSG_ERROR([cannot determine gecode version])])
|
|
|
|
case "$target_os" in
|
|
|
|
*darwin*)
|
|
|
|
AC_MSG_CHECKING([if -framework gecode is required])
|
|
|
|
AC_LANG_PUSH([C++])
|
|
|
|
saved_CXXFLAGS="$CXXFLAGS"
|
|
|
|
CXXFLAGS="$CXXFLAGS -framework gecode"
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
|
|
#include "gecode/int.hh"
|
|
|
|
]],[[
|
|
|
|
Gecode::Exception e("","");
|
|
|
|
return 0;
|
|
|
|
]])],[GECODE_EXTRALIBS="-framework gecode"
|
|
|
|
AC_MSG_RESULT([yes])],
|
|
|
|
[AC_MSG_RESULT([no])])
|
|
|
|
AC_LANG_POP()
|
|
|
|
CXXFLAGS="$saved_CXXFLAGS"
|
|
|
|
;;
|
|
|
|
esac
|
2014-03-06 02:09:48 +00:00
|
|
|
|
|
|
|
GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'`
|
|
|
|
if test "$GECODE_MAJOR" = "3"; then
|
|
|
|
GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodeint -lgecodeset -lgecodesearch"
|
|
|
|
else
|
|
|
|
GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodefloat -lgecodeint -lgecodeset -lgecodesearch"
|
|
|
|
fi
|
|
|
|
|
2013-11-03 14:12:38 +00:00
|
|
|
fi
|
2014-01-23 01:46:16 +00:00
|
|
|
fi
|
2013-11-03 14:12:38 +00:00
|
|
|
|
2014-03-06 02:09:48 +00:00
|
|
|
saved_CPPFLAGS="$CPPFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS -I \"$GECODE_INCLUDES\""
|
2013-11-03 14:12:38 +00:00
|
|
|
|
2014-03-06 02:09:48 +00:00
|
|
|
AC_CHECK_HEADER(gecode/support/config.hpp)
|
2013-11-04 10:00:32 +00:00
|
|
|
|
2014-03-06 02:09:48 +00:00
|
|
|
CPPFLAGS="$saved_CPPFLAGS"
|
2013-11-04 10:00:32 +00:00
|
|
|
|
|
|
|
AC_SUBST(GECODE_EXTRALIBS)
|
2014-03-06 02:09:48 +00:00
|
|
|
AC_SUBST(GECODE_INCLUDES)
|
|
|
|
AC_SUBST(GECODE_VERSION)
|
|
|
|
AC_SUBST(GECODE_MAJOR)
|
|
|
|
|
2014-02-10 23:30:21 +00:00
|
|
|
|
|
|
|
if test "$PKG_GECODE" = "packages/gecode"; then
|
|
|
|
AC_CONFIG_FILES([packages/gecode/Makefile])
|
|
|
|
fi
|
|
|
|
|