win32 patches

This commit is contained in:
Vítor Santos Costa 2014-10-28 12:56:26 +00:00
parent 6b93b8ee5a
commit 546af97345
9 changed files with 172 additions and 69 deletions

View File

@ -338,7 +338,8 @@ Yap_gmp_ior_int_big(Int i, Term t)
} }
#if USE_GMP #if USE_GMP
#if !defined(HAVE_MPZ_XOR) // cross-compilers...
#if !defined(HAVE_MPZ_XOR) && !defined(mpz_xor)
static void static void
mpz_xor(MP_INT *new, MP_INT *r1, MP_INT *r2) mpz_xor(MP_INT *new, MP_INT *r1, MP_INT *r2)
{ {

View File

@ -276,7 +276,7 @@ Yap_InitSysPath(void) {
/* couldn't find it where it was supposed to be, /* couldn't find it where it was supposed to be,
let's try using the executable */ let's try using the executable */
if (!GetModuleFileName( GetCurrentProcess(), LOCAL_FileNameBuf, YAP_FILENAME_MAX)) { if (!GetModuleFileName( NULL, LOCAL_FileNameBuf, YAP_FILENAME_MAX)) {
Yap_Error(OPERATING_SYSTEM_ERROR, TermNil, "could not find executable name"); Yap_Error(OPERATING_SYSTEM_ERROR, TermNil, "could not find executable name");
/* do nothing */ /* do nothing */
return; return;
@ -1438,7 +1438,7 @@ Yap_MathException__( USES_REGS1 )
return EVALUATION_ERROR_UNDEFINED; return EVALUATION_ERROR_UNDEFINED;
} }
} }
#elif _WIN32 #elif _WIN32 && FALSE
unsigned int raised; unsigned int raised;
int err; int err;

16
H/Yap.h
View File

@ -217,6 +217,22 @@ typedef int _Bool;
#define LOW_PROF 1 #define LOW_PROF 1
#endif #endif
#if !defined(HAVE_STRNLEN)
INLINE_ONLY inline EXTERN size_t
strnlen(const char *s, size_t maxlen);
INLINE_ONLY inline EXTERN size_t
strnlen(const char *s, size_t maxlen)
{
size_t i = 0;
while (s[i]) {
if (i == maxlen)
return i;
i++;
}
return i;
}
#endif
/* #define FORCE_SECOND_QUADRANT 1 */ /* #define FORCE_SECOND_QUADRANT 1 */

View File

@ -337,6 +337,9 @@
/* Define to 1 if you have the <ieeefp.h> header file. */ /* Define to 1 if you have the <ieeefp.h> header file. */
#undef HAVE_IEEEFP_H #undef HAVE_IEEEFP_H
/* Define to 1 if you have the <IntSafe.h> header file. */
#undef HAVE_INTSAFE_H
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
@ -794,6 +797,9 @@
/* Define to 1 if you have the `strncpy' function. */ /* Define to 1 if you have the `strncpy' function. */
#undef HAVE_STRNCPY #undef HAVE_STRNCPY
/* Define to 1 if you have the `strnlen' function. */
#undef HAVE_STRNLEN
/* Define to 1 if you have the <stropts.h> header file. */ /* Define to 1 if you have the <stropts.h> header file. */
#undef HAVE_STROPTS_H #undef HAVE_STROPTS_H
@ -923,6 +929,9 @@
/* Define to 1 if you have the <windef.h> header file. */ /* Define to 1 if you have the <windef.h> header file. */
#undef HAVE_WINDEF_H #undef HAVE_WINDEF_H
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* Define to 1 if you have the <winsock2.h> header file. */ /* Define to 1 if you have the <winsock2.h> header file. */
#undef HAVE_WINSOCK2_H #undef HAVE_WINSOCK2_H

47
configure vendored
View File

@ -6936,6 +6936,31 @@ fi
fi fi
for ac_header in IntSafe.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "IntSafe.h" "ac_cv_header_IntSafe_h" "$ac_includes_default"
if test "x$ac_cv_header_IntSafe_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_INTSAFE_H 1
_ACEOF
fi
done
for ac_header in windows.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default"
if test "x$ac_cv_header_windows_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_WINDOWS_H 1
_ACEOF
fi
done
if test "$threads" = yes if test "$threads" = yes
then then
for ac_header in pthread.h for ac_header in pthread.h
@ -9792,7 +9817,19 @@ _ACEOF
fi fi
done done
for ac_func in strchr strerror stricmp strlwr strncat strncpy strtod for ac_func in strchr strerror stricmp
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in strnlen strlwr strncat strncpy strtod
do : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -14042,7 +14079,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 14045 "configure" */ /* #line 14082 "configure" */
public class Test { public class Test {
} }
EOF EOF
@ -14218,7 +14255,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: 14221: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 echo "configure: 14258: 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
@ -14349,7 +14386,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 14352 "configure" */ /* #line 14389 "configure" */
public class Test { public class Test {
} }
EOF EOF
@ -14384,7 +14421,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 14387 "configure" */ /* [#]line 14424 "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);

View File

@ -660,6 +660,9 @@ if test "$yap_cv_judy" != "no"; then
AC_CHECK_LIB(Judy, Judy1Set,,[AC_MSG_RESULT([libJudy not found, UDI will only work with one Index at a time])]) AC_CHECK_LIB(Judy, Judy1Set,,[AC_MSG_RESULT([libJudy not found, UDI will only work with one Index at a time])])
fi fi
AC_CHECK_HEADERS(IntSafe.h)
AC_CHECK_HEADERS(windows.h)
if test "$threads" = yes if test "$threads" = yes
then then
AC_CHECK_HEADERS(pthread.h) AC_CHECK_HEADERS(pthread.h)
@ -1659,7 +1662,8 @@ AC_CHECK_FUNCS(rename rint sbrk select setbuf setlinebuf)
AC_CHECK_FUNCS(setitimer setsid setlinebuf sigaction) AC_CHECK_FUNCS(setitimer setsid setlinebuf sigaction)
AC_CHECK_FUNCS(siggetmask siginterrupt) AC_CHECK_FUNCS(siggetmask siginterrupt)
AC_CHECK_FUNCS(signal sigprocmask socket srand srandom stat) AC_CHECK_FUNCS(signal sigprocmask socket srand srandom stat)
AC_CHECK_FUNCS(strchr strerror stricmp strlwr strncat strncpy strtod) AC_CHECK_FUNCS(strchr strerror stricmp)
AC_CHECK_FUNCS(strnlen strlwr strncat strncpy strtod)
AC_CHECK_FUNCS(time times tmpnam usleep utime vsnprintf wcsdup wcsnlen) AC_CHECK_FUNCS(time times tmpnam usleep utime vsnprintf wcsdup wcsnlen)
# android does not really have locale stuff.. # android does not really have locale stuff..

148
misc/mkwin Normal file → Executable file
View File

@ -19,9 +19,10 @@
# http://nsis.sourceforge.net/Main_Page # http://nsis.sourceforge.net/Main_Page
# #
# #
TOP=$HOME
TOP="/z"
VERSION=6.3.4 VERSION=6.3.4
#cross-compiler for OSX, see http://mxe.cc/
#notice that OSX does not allow WIN64 emulation (wine64)
MXE=$HOME/Yap/mxe/usr
# by default, compile without threads # by default, compile without threads
THREADS=no THREADS=no
# use 64 bits # use 64 bits
@ -39,18 +40,18 @@ while test $I -gt 0
do do
if test $1 = threads if test $1 = threads
then then
THREADS=yes THREADS=yes
elif test $1 = no_threads elif test $1 = no_threads
then then
THREADS=no THREADS=no
elif test $1 = 32 elif test $1 = 32
then then
ABI=32 ABI=32
elif test $1 = 64 elif test $1 = 64
then then
ABI=64 ABI=64
else else
echo "received \"$1\", should be one of threads, no_threads, 32, 64" echo "received \"$1\", should be one of threads, no_threads, 32, 64"
fi fi
I=$(( $I - 1 )) I=$(( $I - 1 ))
done done
@ -73,45 +74,53 @@ else
fi fi
if test $ABI = 64; then if test $ABI = 64; then
#GCC_PATH=/l/Work/noth/mingw-w64/x86_64-4.9.0-posix-seh-rt_v3-rev1/mingw64 #GCC_PATH=/l/Work/noth/mingw-w64/x86_64-4.9.0-posix-seh-rt_v3-rev1/mingw64
GCC_PATH=$HOME/mxe/usr/bin case $( uname ) in
PATH=$PATH:$GCC_PATH *Darwin*)
HOST="--host=x86_64-w64-mingw32" GCC_PATH="$MXE"/bin
# ok. PATH=$PATH:$GCC_PATH
HOST="x86_64-w64-mingw32"
LIB_PATH="$MXE"/"$HOST"/lib
;;
esac
# ok.
CUDD=no # BDD compiler package. Get version that compiles on Windows from Vitor! CUDD=no # BDD compiler package. Get version that compiles on Windows from Vitor!
GECODE=no #does not link with mingw64, VC++ trouble GECODE=no #does not link with mingw64, VC++ trouble
GMP=yes # Compile it for infinite precision numbers and rationals GMP=yes # Compile it for infinite precision numbers and rationals
JAVA=no # for JPL only JAVA=no # for JPL only
PYTHON=no # does not work in Windows anyway (currently) PYTHON=no # does not work in Windows anyway (currently)
REAL=no # interface to R REAL=no # interface to R
# it seems python2.7 does not support mingw64 # it seems python2.7 does not support mingw64
PYTHON_PATH="/c/Python33-64" PYTHON_PATH="/c/Python33-64"
export PATH="$GCC_PATH"/bin:"$PATH" export PATH="$PYTHON_PATH"/bin:"$PATH"
GECODE_PATH="/c/Program Files/Gecode" GECODE_PATH="/c/Program Files/Gecode"
# GMP=/l/Work/noth/msys/1.0/local # GMP=/l/Work/noth/msys/1.0/local
GMP=yes GMP=yes
CUDD_PATH=/c/cygwin/Yap/cudd-2.5.0-mingw64 CUDD_PATH=/c/cygwin/Yap/cudd-2.5.0-mingw64
JAVA_PATH="/c/Program Files/Java/jdk1.7.0_51" JAVA_PATH="/c/Program Files/Java/jdk1.7.0_51"
R_PATH="/c/Program Files/R/R-3.1.0" R_PATH="/c/Program Files/R/R-3.1.0"
if test $THREADS = yes
then
cp "$GCC_PATH/x86_64-w64-mingw32/lib/libwinpthread-1.dll" . # interface from posix threads to windows native threads
cp libwinpthread-1.dll pthreadGC2.dll
fi
fi fi
# HOME WIN32 configuration # HOME WIN32 configuration
if test $ABI = 32; then if test $ABI = 32; then
GCC_PATH="/c/TDM-GCC-64" case $( uname ) in
*Darwin*)
CUDD=yes #use mxe as a cross compiler
GECODE=no # install only allows one of 32 or 64 bits echo $( uname )
GMP=yes GCC_PATH="$MXE"/bin
JAVA=yes PATH="$GCC_PATH":"$PATH"
PYTHON=no HOST="i686-pc-mingw32"
REAL=yes LIB_PATH="$MXE"/"$HOST"/lib
CUDD=yes
GECODE=no # install only allows one of 32 or 64 bits
GMP=yes
JAVA=no
PYTHON=no
REAL=no
;;
esac
PYTHON_PATH="/c/Python27" PYTHON_PATH="/c/Python27"
export PATH="$GCC_PATH"/bin:$PATH export PATH="$GCC_PATH"/bin:$PATH
@ -120,32 +129,42 @@ REAL=yes
CUDD_PATH=/c/cygwin/Yap/cudd-2.5.0-mingw32 CUDD_PATH=/c/cygwin/Yap/cudd-2.5.0-mingw32
JAVA_PATH="/c/Program Files (x86)/Java/jdk1.7.0_51" JAVA_PATH="/c/Program Files (x86)/Java/jdk1.7.0_51"
R_PATH="/c/Program Files/R/R-3.0.2" R_PATH="/c/Program Files/R/R-3.0.2"
HOST="--enable-abi=32" HOST+=" --enable-abi=32"
cp $GCC_PATH/bin/libwinpthread-1.dll . fi
if test $THREADS = yes
then
cp "$LIB_PATH"/libwinpthread-1.dll .
cp libwinpthread-1.dll pthreadGC2.dll cp libwinpthread-1.dll pthreadGC2.dll
fi fi
if test $CUDD = yes if test $CUDD != no
then then
CUDD="$CUDD_PATH" CUDD="$CUDD_PATH"
BDDLIB="--enable-bddlib" BDDLIB="yes"
CPLINT="yes"
else else
BDDLIB="" BDDLIB="no"
CPLINT="no"
fi fi
if test $GECODE = yes if test $GECODE = yes
then then
export PATH="$PATH":"$GECODE_PATH"/bin export PATH="$PATH":"$GECODE_PATH"/bin
fi fi
if test $JAVA = yes if test $JAVA = yes
then then
export PATH="$PATH":"$JAVA_PATH"/bin export PATH="$PATH":"$JAVA_PATH"/bin
fi fi
if test $PYTHON = yes if test $PYTHON = yes
then then
export PATH="$PATH":"$PYTHON_PATH" export PATH="$PATH":"$PYTHON_PATH"
fi fi
if test $REAL = yes if test $REAL = yes
then then
if test $ABI = 32; then if test $ABI = 32; then
@ -159,26 +178,39 @@ fi
export INSTALL_SH=$SRC/yap-6.3/install.sh export INSTALL_SH=$SRC/yap-6.3/install.sh
# avoid using relative paths # avoid using relative paths
if test "$do_compile" = true; then if test "$do_compile" = true; then
"$CONFIGURE" $HOST \ "$CONFIGURE" --host=$HOST \
--prefix=$TARGET \ --prefix=$TARGET \
--with-R="$REAL" \ --with-R="$REAL" \
--with-java="$JAVA" \ --with-java="$JAVA" \
--with-gmp="$GMP" \ --with-gmp="$GMP" \
--with-python="$PYTHON" \ --with-python="$PYTHON" \
--with-cudd="$CUDD" "$BDDLIB" \ --with-cudd="$CUDD" --enable-bddlib="$BDDLIB" --with-cplint="$CPLINT" \
--enable-gecode="$GECODE" \ --with-gecode="$GECODE" \
--enable-threads="$THREADS" --enable-pthread-locking \ --enable-threads="$THREADS" --enable-pthread-locking \
--enable-debug-yap --enable-low-level-tracer --enable-debug-yap --enable-low-level-tracer
make -j 4 install
make #-j 4 install
fi fi
if test "$do_install" = true; then if test "$do_install" = true; then
if test $ABI = 64; then if test $ABI = 64; then
cp $DOCS_DIR/*html $TARGET/share/doc/Yap cp $DOCS_DIR/*html $TARGET/share/doc/Yap
cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 -DROOTDIR=$TARGET -DABI="$ABI" -DVERSION="$FULL_VERSION" -DOPTIONS="$SRC_WIN\\yap-6.3\\misc\\options.ini" -DOUT_DIR=".." -D"WIN64=1" -NOCD $SRC/yap-6.3/misc/Yap.nsi "$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 \
else -DROOTDIR=$TARGET \
cp $DOCS_DIR/*html $TARGET/share/doc/Yap -DABI="$ABI" \
cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap -DVERSION="$FULL_VERSION" \
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog -DROOTDIR=$TARGET -DABI="$ABI" -DVERSION="$FULL_VERSION" -DOPTIONS="$SRC_WIN\\yap-6.3\\misc\\options.ini" -DOUT_DIR=".." -NOCD $SRC/yap-6.3/misc/Yap.nsi -DOPTIONS="$SRC_WIN\\yap-6.3\\misc\\options.ini" \
fi -DOUT_DIR=".." -D"WIN64=1" \
-NOCD $SRC/yap-6.3/misc/Yap.nsi
else
cp $DOCS_DIR/*html $TARGET/share/doc/Yap
cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog \
-DROOTDIR=$TARGET \
-DABI="$ABI" \
-DVERSION="$FULL_VERSION" \
-DOPTIONS="$SRC_WIN\\yap-6.3\\misc\\options.ini" \
-DOUT_DIR=".." \
-NOCD $SRC/yap-6.3/misc/Yap.nsi
fi
fi fi

View File

@ -196,15 +196,19 @@ int_mbscoll(const char *s1, const char *s2, int icase)
mbstate_t mbs; mbstate_t mbs;
int rc; int rc;
#if HAVE_ALLOCA
if ( l1 < 1024 && (w1 = alloca(sizeof(wchar_t)*(l1+1))) ) if ( l1 < 1024 && (w1 = alloca(sizeof(wchar_t)*(l1+1))) )
{ ml1 = FALSE; { ml1 = FALSE;
} else } else
#endif
{ w1 = PL_malloc_atomic(sizeof(wchar_t)*(l1+1)); { w1 = PL_malloc_atomic(sizeof(wchar_t)*(l1+1));
ml1 = TRUE; ml1 = TRUE;
} }
#if HAVE_ALLOCA
if ( l2 < 1024 && (w2 = alloca(sizeof(wchar_t)*(l2+1))) ) if ( l2 < 1024 && (w2 = alloca(sizeof(wchar_t)*(l2+1))) )
{ ml2 = FALSE; { ml2 = FALSE;
} else } else
#endif
{ w2 = PL_malloc_atomic(sizeof(wchar_t)*(l2+1)); { w2 = PL_malloc_atomic(sizeof(wchar_t)*(l2+1));
ml2 = TRUE; ml2 = TRUE;
} }

View File

@ -25,9 +25,9 @@
#ifndef PL_STRING_H_INCLUDED #ifndef PL_STRING_H_INCLUDED
#define PL_STRING_H_INCLUDED #define PL_STRING_H_INCLUDED
COMMON(char *) store_string(const char *s); COMMON(char *) store_string(const char *s);
COMMON(void) remove_string(char *s); COMMON(void) remove_string(char *s);
COMMON(char) digitName(int n, int small); COMMON(char) digitName(int n, int smll);
COMMON(int) digitValue(int b, int c); COMMON(int) digitValue(int b, int c);
COMMON(bool) strprefix(const char *string, const char *prefix); COMMON(bool) strprefix(const char *string, const char *prefix);
COMMON(bool) strpostfix(const char *string, const char *postfix); COMMON(bool) strpostfix(const char *string, const char *postfix);