support cross-compilation for windows

This commit is contained in:
Vitor Santos Costa 2014-01-23 01:46:16 +00:00
parent fe6142ca69
commit 0391988788
8 changed files with 99 additions and 28 deletions

View File

@ -181,12 +181,14 @@ special_functors;
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr); INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
#if SIZEOF_DOUBLE == SIZEOF_INT_P
#define MkFloatTerm(fl) __MkFloatTerm((fl) PASS_REGS) #define MkFloatTerm(fl) __MkFloatTerm((fl) PASS_REGS)
INLINE_ONLY inline EXTERN Term __MkFloatTerm (Float USES_REGS); INLINE_ONLY inline EXTERN Term __MkFloatTerm (Float USES_REGS);
INLINE_ONLY inline EXTERN Float FloatOfTerm (Term t);
#if SIZEOF_DOUBLE == SIZEOF_INT_P
INLINE_ONLY inline EXTERN Term INLINE_ONLY inline EXTERN Term
__MkFloatTerm (Float dbl USES_REGS) __MkFloatTerm (Float dbl USES_REGS)
{ {
@ -196,8 +198,6 @@ __MkFloatTerm (Float dbl USES_REGS)
} }
INLINE_ONLY inline EXTERN Float FloatOfTerm (Term t);
INLINE_ONLY inline EXTERN Float INLINE_ONLY inline EXTERN Float
FloatOfTerm (Term t) FloatOfTerm (Term t)
{ {
@ -258,10 +258,6 @@ CpFloatUnaligned (CELL * ptr)
#endif #endif
INLINE_ONLY inline EXTERN Term MkFloatTerm (Float);
#define MkFloatTerm(fl) __MkFloatTerm((fl) PASS_REGS)
INLINE_ONLY inline EXTERN Term INLINE_ONLY inline EXTERN Term
__MkFloatTerm (Float dbl USES_REGS) __MkFloatTerm (Float dbl USES_REGS)
{ {
@ -273,8 +269,6 @@ __MkFloatTerm (Float dbl USES_REGS)
} }
INLINE_ONLY inline EXTERN Float FloatOfTerm (Term t);
INLINE_ONLY inline EXTERN Float INLINE_ONLY inline EXTERN Float
FloatOfTerm (Term t) FloatOfTerm (Term t)
{ {

60
configure vendored
View File

@ -5081,6 +5081,7 @@ fi
i_am_cross_compiling=$cross_compiling
if test "$target_os" = "cygwin" -o "$target_os" = "mingw32" -o "$target_os" = "mingw64" if test "$target_os" = "cygwin" -o "$target_os" = "mingw32" -o "$target_os" = "mingw64"
then then
INSTALL_COMMAND=install_win32 INSTALL_COMMAND=install_win32
@ -5505,6 +5506,7 @@ fi
else else
prefix="$SYSTEMDRIVE/Yap" prefix="$SYSTEMDRIVE/Yap"
fi fi
i_am_cross_compiling=yes
;; ;;
**) **)
if test "$target_cpu" = "x86_64" if test "$target_cpu" = "x86_64"
@ -10989,6 +10991,12 @@ elif test -d "$cudd_dir/lib"; then
LIBS="$LIBS -L $cudd_dir/lib" LIBS="$LIBS -L $cudd_dir/lib"
fi fi
if test $i_am_cross_compiling = yes
then
#mingw: we know where things are
CUDD_LDFLAGS="-L $cudd_dir/lib -lall_cudd"
else
if test -d "$cudd_dir/util"; then if test -d "$cudd_dir/util"; then
LIBS="$LIBS -L $cudd_dir/util" LIBS="$LIBS -L $cudd_dir/util"
fi fi
@ -11312,6 +11320,7 @@ EOF
LIBS="$oldlibs" LIBS="$oldlibs"
fi fi
fi
@ -11424,7 +11433,23 @@ if test "$yap_cv_R" != "no" -a -e "$srcdir"/packages/real/Makefile.in; then
for ac_prog in R if test $i_am_cross_compiling = yes
then
REAL_TARGET="ritf"
REAL_INCLUDES=-I"\"$yap_cv_R\""/include
case "$target_cpu" in
i*86*)
REAL_LIBS="-L\"$yap_cv_R\"/bin/i386 -lR"
;;
x86*)
REAL_LIBS="-L\"$yap_cv_R\"/bin/x64 -lR"
;;
**)
REAL_TARGET="dummy"
;;
esac
else
for ac_prog in R
do do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
@ -11467,9 +11492,9 @@ fi
done done
test -n "$REXE" || REXE=""none"" test -n "$REXE" || REXE=""none""
if test $REXE = none; then if test $REXE = none; then
REAL_TARGET="dummy" REAL_TARGET="dummy"
else else
REAL_TARGET="ritf" REAL_TARGET="ritf"
REAL_INCLUDES="$($REXE CMD config --cppflags | grep -v ^WARNING)" REAL_INCLUDES="$($REXE CMD config --cppflags | grep -v ^WARNING)"
REAL_LIBS="$($REXE CMD config --ldflags | grep -v ^WARNING)" REAL_LIBS="$($REXE CMD config --ldflags | grep -v ^WARNING)"
@ -11494,6 +11519,7 @@ done
CFLAGS="$ocflags" CFLAGS="$ocflags"
CPPFLAGS="$ocppflags" CPPFLAGS="$ocppflags"
fi
fi fi
@ -11729,7 +11755,7 @@ else
JAVA_TEST=Test.java JAVA_TEST=Test.java
CLASS_TEST=Test.class CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST cat << \EOF > $JAVA_TEST
/* #line 11732 "configure" */ /* #line 11758 "configure" */
public class Test { public class Test {
} }
EOF EOF
@ -11905,7 +11931,7 @@ EOF
if uudecode$EXEEXT Test.uue; then if uudecode$EXEEXT Test.uue; then
ac_cv_prog_uudecode_base64=yes ac_cv_prog_uudecode_base64=yes
else else
echo "configure: 11908: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 echo "configure: 11934: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: failed file was:" >&5 echo "configure: failed file was:" >&5
cat Test.uue >&5 cat Test.uue >&5
ac_cv_prog_uudecode_base64=no ac_cv_prog_uudecode_base64=no
@ -12036,7 +12062,7 @@ else
JAVA_TEST=Test.java JAVA_TEST=Test.java
CLASS_TEST=Test.class CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST cat << \EOF > $JAVA_TEST
/* #line 12039 "configure" */ /* #line 12065 "configure" */
public class Test { public class Test {
} }
EOF EOF
@ -12071,7 +12097,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class CLASS_TEST=Test.class
TEST=Test TEST=Test
cat << \EOF > $JAVA_TEST cat << \EOF > $JAVA_TEST
/* [#]line 12074 "configure" */ /* [#]line 12100 "configure" */
public class Test { public class Test {
public static void main (String args[]) { public static void main (String args[]) {
System.exit (0); System.exit (0);
@ -12722,6 +12748,12 @@ _ACEOF
if test $i_am_cross_compiling = yes
then
#mingw: we know where things are
JPLCFLAGS="-I \"$yap_cv_java\"/include -I \"$yap_cv_java\"/include/win32"
JAVALIBS="-L \"$yap_cv_java\"/jre/bin/server -L \"$yap_cv_java\"/jre/bin/client -ljvm"
fi
@ -12829,6 +12861,10 @@ GECODE_VERSION=unknown-gecode-version
if test "$use_gecode" = yes; then if test "$use_gecode" = yes; then
if test $i_am_cross_compiling = yes
then
GECODE_VERSION=4.2.1
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gecode version" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking gecode version" >&5
$as_echo_n "checking gecode version... " >&6; } $as_echo_n "checking gecode version... " >&6; }
if test "$cross_compiling" = yes; then : if test "$cross_compiling" = yes; then :
@ -12914,6 +12950,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
;; ;;
esac esac
fi fi
fi
GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'` GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'`
@ -13331,6 +13368,14 @@ test -n "$PYTHON" || PYTHON=""none""
else else
PYTHON="$yap_cv_python" PYTHON="$yap_cv_python"
fi fi
if test $i_am_cross_compiling = yes
then
#mingw
PYTHON_DIR=`dirname "$PYTHON"`
PYTHON_DLL=`echo "$PYTHON_DIR"/python*.dll`
PYTHON_LIBS="\"$PYTHON_DLL\""
PYTHON_INCLUDES="-I \"$PYTHON_DIR\"/include"
else
PYTHONHOME=`$PYTHON -c'import sys; sys.stdout.write(sys.prefix)'` PYTHONHOME=`$PYTHON -c'import sys; sys.stdout.write(sys.prefix)'`
PYTHONVERSION=`"$PYTHON" -c "import sys; sys.stdout.write(sys.version[:3])"` PYTHONVERSION=`"$PYTHON" -c "import sys; sys.stdout.write(sys.version[:3])"`
if test -d "$PYTHONHOME/libs"; then if test -d "$PYTHONHOME/libs"; then
@ -13415,6 +13460,7 @@ fi
echo "Could not find includes for Python" echo "Could not find includes for Python"
ENABLE_PYTHON="@# " ENABLE_PYTHON="@# "
fi fi
fi
else else
PYTHON_TARGET="dummy" PYTHON_TARGET="dummy"
ENABLE_PYTHON="@# " ENABLE_PYTHON="@# "

View File

@ -514,6 +514,7 @@ dnl Check for libraries.
dnl mingw does not get along well with libm dnl mingw does not get along well with libm
dnl cygnus and mingw32 also need wsock32 to use sockets. dnl cygnus and mingw32 also need wsock32 to use sockets.
dnl dnl
i_am_cross_compiling=$cross_compiling
if test "$target_os" = "cygwin" -o "$target_os" = "mingw32" -o "$target_os" = "mingw64" if test "$target_os" = "cygwin" -o "$target_os" = "mingw32" -o "$target_os" = "mingw64"
then then
INSTALL_COMMAND=install_win32 INSTALL_COMMAND=install_win32
@ -557,6 +558,7 @@ then
else else
prefix="$SYSTEMDRIVE/Yap" prefix="$SYSTEMDRIVE/Yap"
fi fi
i_am_cross_compiling=yes
;; ;;
**) **)
if test "$target_cpu" = "x86_64" if test "$target_cpu" = "x86_64"

View File

@ -330,6 +330,7 @@ int main(int argc, char **arg) {
SETMAXBUFSIZE(params.maxbufsize); SETMAXBUFSIZE(params.maxbufsize);
signal(SIGINT, termhandler); signal(SIGINT, termhandler);
#ifndef __MINGW32__
if (params.ppid != NULL) { if (params.ppid != NULL) {
signal(SIGALRM, pidhandler); signal(SIGALRM, pidhandler);
alarm(5); alarm(5);
@ -337,6 +338,7 @@ int main(int argc, char **arg) {
signal(SIGALRM, handler); signal(SIGALRM, handler);
alarm(params.timeout); alarm(params.timeout);
} }
#endif
if (params.online) { if (params.online) {
if (params.dynreorder == 1) if (params.dynreorder == 1)
@ -1769,7 +1771,9 @@ void pidhandler(int num) {
s = (char *) malloc(sizeof(char) * (19 + strlen(params.ppid))); s = (char *) malloc(sizeof(char) * (19 + strlen(params.ppid)));
strcpy(s, "ps "); strcat(s, params.ppid); strcat(s, " >/dev/null"); strcpy(s, "ps "); strcat(s, params.ppid); strcat(s, " >/dev/null");
if (system(s) != 0) exit(4); if (system(s) != 0) exit(4);
#ifndef __MINGW32__
signal(SIGALRM, pidhandler); signal(SIGALRM, pidhandler);
#endif
alarm(5); alarm(5);
free(s); free(s);
} }

View File

@ -284,6 +284,7 @@ int main(int argc, char **arg) {
SETMAXBUFSIZE(params.maxbufsize); SETMAXBUFSIZE(params.maxbufsize);
signal(SIGINT, termhandler); signal(SIGINT, termhandler);
#ifndef __MINGW32__
if (params.ppid != NULL) { if (params.ppid != NULL) {
signal(SIGALRM, pidhandler); signal(SIGALRM, pidhandler);
alarm(5); alarm(5);
@ -291,6 +292,7 @@ int main(int argc, char **arg) {
signal(SIGALRM, handler); signal(SIGALRM, handler);
alarm(params.timeout); alarm(params.timeout);
} }
#endif
if (params.online) { if (params.online) {
MyManager.manager = simpleBDDinit(0); MyManager.manager = simpleBDDinit(0);
@ -688,7 +690,9 @@ void pidhandler(int num) {
s = (char *) malloc(sizeof(char) * (19 + strlen(params.ppid))); s = (char *) malloc(sizeof(char) * (19 + strlen(params.ppid)));
strcpy(s, "ps "); strcat(s, params.ppid); strcat(s, " >/dev/null"); strcpy(s, "ps "); strcat(s, params.ppid); strcat(s, " >/dev/null");
if (system(s) != 0) exit(4); if (system(s) != 0) exit(4);
#ifndef __MINGW32__
signal(SIGALRM, pidhandler); signal(SIGALRM, pidhandler);
#endif
alarm(5); alarm(5);
free(s); free(s);
} }

View File

@ -51,6 +51,12 @@ elif test -d "$cudd_dir/lib"; then
LIBS="$LIBS -L $cudd_dir/lib" LIBS="$LIBS -L $cudd_dir/lib"
fi fi
if test $i_am_cross_compiling = yes
then
#mingw: we know where things are
CUDD_LDFLAGS="-L $cudd_dir/lib -lall_cudd"
else
if test -d "$cudd_dir/util"; then if test -d "$cudd_dir/util"; then
LIBS="$LIBS -L $cudd_dir/util" LIBS="$LIBS -L $cudd_dir/util"
fi fi
@ -96,6 +102,7 @@ EOF
LIBS="$oldlibs" LIBS="$oldlibs"
fi
fi fi
AC_SUBST(ENABLE_CUDD) AC_SUBST(ENABLE_CUDD)

View File

@ -41,6 +41,10 @@ GECODE_VERSION=unknown-gecode-version
if test "$use_gecode" = yes; then 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_MSG_CHECKING([gecode version])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include "gecode/support/config.hpp" #include "gecode/support/config.hpp"
@ -72,6 +76,7 @@ return 0;
;; ;;
esac esac
fi fi
fi
GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'` GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'`

View File

@ -21,6 +21,14 @@ elif test -e "$srcdir"/packages/python/Makefile.in ; then
else else
PYTHON="$yap_cv_python" PYTHON="$yap_cv_python"
fi fi
if test $i_am_cross_compiling = yes
then
#mingw
PYTHON_DIR=`dirname "$PYTHON"`
PYTHON_DLL=`echo "$PYTHON_DIR"/python*.dll`
PYTHON_LIBS="\"$PYTHON_DLL\""
PYTHON_INCLUDES="-I \"$PYTHON_DIR\"/include"
else
PYTHONHOME=`$PYTHON -c'import sys; sys.stdout.write(sys.prefix)'` PYTHONHOME=`$PYTHON -c'import sys; sys.stdout.write(sys.prefix)'`
PYTHONVERSION=`"$PYTHON" -c "import sys; sys.stdout.write(sys.version[[:3]])"` PYTHONVERSION=`"$PYTHON" -c "import sys; sys.stdout.write(sys.version[[:3]])"`
if test -d "$PYTHONHOME/libs"; then if test -d "$PYTHONHOME/libs"; then
@ -49,6 +57,7 @@ elif test -e "$srcdir"/packages/python/Makefile.in ; then
echo "Could not find includes for Python" echo "Could not find includes for Python"
ENABLE_PYTHON="@# " ENABLE_PYTHON="@# "
fi fi
fi
else else
PYTHON_TARGET="dummy" PYTHON_TARGET="dummy"
ENABLE_PYTHON="@# " ENABLE_PYTHON="@# "