This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/gecode/configure.in

123 lines
3.5 KiB
Plaintext
Raw Normal View History

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
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
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