98 lines
2.5 KiB
Plaintext
98 lines
2.5 KiB
Plaintext
dnl Gecode support
|
|
|
|
dnl gecode is usually in /usr/local
|
|
if test -d /usr/local/include/gecode; then
|
|
CFLAGS="$CFLAGS -I/usr/local/include"
|
|
SHLIB_CXXFLAGS="$SHLIB_CXXFLAGS -I/usr/local/include"
|
|
GECODE_EXTRALIBS="-L/usr/local/lib"
|
|
fi
|
|
|
|
AC_CHECK_HEADER(gecode/support/config.hpp,
|
|
have_gecode=yes, have_gecode=no)
|
|
|
|
AC_ARG_ENABLE(gecode,
|
|
[ --enable-gecode install gecode library],
|
|
[use_gecode="$enableval"
|
|
if test "$use_gecode" = yes; then
|
|
if test "$have_gecode" = no; then
|
|
AC_MSG_ERROR([cannot enable gecode: gecode library not found])
|
|
fi
|
|
fi], use_gecode=$have_gecode)
|
|
|
|
if test "$use_gecode" = no; then
|
|
PKG_GECODE=""
|
|
else
|
|
PKG_GECODE="packages/gecode"
|
|
fi
|
|
AC_SUBST(PKG_GECODE)
|
|
|
|
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
|
|
if test $i_am_cross_compiling = yes
|
|
then
|
|
GECODE_VERSION=4.2.1
|
|
else
|
|
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
|
|
fi
|
|
fi
|
|
|
|
GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'`
|
|
|
|
AC_SUBST(GECODE_MAJOR)
|
|
|
|
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
|
|
|
|
AC_SUBST(GECODE_VERSION)
|
|
AC_SUBST(GECODE_EXTRALIBS)
|
|
|
|
if test "$PKG_GECODE" = "packages/gecode"; then
|
|
AC_CONFIG_FILES([packages/gecode/Makefile])
|
|
fi
|
|
|