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

132 lines
3.7 KiB
Plaintext
Raw Normal View History

2013-11-03 14:12:38 +00:00
dnl Gecode support
2014-10-25 16:46:13 +01:00
AC_ARG_WITH(gecode,
[ --with-gecode install gecode library],
[use_gecode="$withval"], use_gecode=no)
2013-11-03 14:12:38 +00:00
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"
2014-10-25 16:46:13 +01:00
if test -d "$use_gecode"; then
CPPFLAGS="$CPPFLAGS -I $use_gecode/include"
GECODE_EXTRALIBS="-L $use_gecode/lib"
2015-02-03 02:37:25 +00:00
GECODE_INCLUDES=" $use_gecode/include"
2014-10-25 16:46:13 +01:00
GECODE_PATH="$use_gecode/bin"
dnl gecode is usually in /usr/local
elif test -d /usr/local/include/gecode -a x$SYSROOT = x; then
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
GECODE_EXTRALIBS="-L/usr/local/lib"
2013-11-03 14:12:38 +00:00
fi
2014-10-25 16:46:13 +01: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
2014-10-25 16:46:13 +01:00
if test "$use_gecode" != no; 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
2014-10-25 16:46:13 +01:00
if test "$use_gecode" = yes; then
GECODE_PATH=`which fzn-gecode`
2015-02-03 02:37:25 +00:00
GECODE_PATH=`dirname "$GECODE_PATH"`
2014-10-25 16:46:13 +01:00
else
GECODE_PATH="$use_gecode"
fi
2014-03-06 02:09:48 +00:00
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*)
2014-10-25 16:46:13 +01:00
if test "$use_gecode" = yes; then
2013-11-03 14:12:38 +00:00
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"
2014-10-25 16:46:13 +01:00
fi
2013-11-03 14:12:38 +00:00
;;
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
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
2015-02-03 02:37:25 +00:00
CPPFLAGS="$saved_CPPFLAGS"