Fix MinGW-w64 build
authorAndres Notzli <andres.noetzli@gmail.com>
Wed, 8 Mar 2017 10:50:56 +0000 (02:50 -0800)
committerAndres Notzli <andres.noetzli@gmail.com>
Wed, 8 Mar 2017 18:06:13 +0000 (10:06 -0800)
This commit fixes configure.ac to try to get clock_gettime() from
pthread. Without it, clock_gettime() is detected as missing at
configuration time for MinGW-w64 but exists at compile time, which
causes conflicts. Additionally, this commit updates the helper script
for Windows to use MinGW-w64 by default instead of MinGW.

configure.ac
contrib/Makefile.am
contrib/win-build [new file with mode: 0755]
contrib/win32-build [deleted file]

index 3d645b24ed7aa2497e5b373ebca390f58dd9ee00..d2c08661b1350a92447641586bd9bc26180a8cc9 100644 (file)
@@ -999,7 +999,7 @@ fi
 
 # Checks for libraries.
 
-AC_SEARCH_LIBS([clock_gettime], [rt],
+AC_SEARCH_LIBS([clock_gettime], [rt pthread],
                [AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
                           [Defined to 1 if clock_gettime() is supported by the platform.])],
                [AC_LIBOBJ([clock_gettime])])
index ad3b6f220923ad07809c2727a344c9b596975fe5..ff12eb7e7f61cd0729bd3dcd953cc16aa53a5160 100644 (file)
@@ -12,7 +12,7 @@ EXTRA_DIST = \
        depgraph \
        get-antlr-3.4 \
        mac-build \
-       win32-build \
+       win-build \
        run-script-smtcomp2014 \
        run-script-cascj7-fnt \
        run-script-cascj7-fof \
diff --git a/contrib/win-build b/contrib/win-build
new file mode 100755 (executable)
index 0000000..dee9a8a
--- /dev/null
@@ -0,0 +1,105 @@
+#!/bin/bash
+#
+# win32-build script
+# Morgan Deters <mdeters@cs.nyu.edu>
+# Tue, 15 Jan 2013 11:11:24 -0500
+#
+
+if [ $# -ne 0 ]; then
+  echo "usage: `basename $0`" >&2
+  echo >&2
+  echo "This script attempts to build CVC4 for Win32/64 using mingw-w64." >&2
+  exit 1
+fi
+
+if [ -z "$HOST" ]; then
+  HOST=i586-mingw32msvc
+  echo "WARNING:"
+  echo "WARNING: Using default HOST value: $HOST"
+  echo "WARNING: You should probably run this script like this:"
+  echo "WARNING:"
+  echo "WARNING:   HOST=i686-w64-mingw32 win-build"
+  echo "WARNING:"
+  echo "WARNING: (replacing the i686-w64-mingw32 with your build host)"
+  echo "WARNING: to ensure the script builds correctly."
+  echo "WARNING:"
+fi
+
+GMPVERSION=5.1.0
+BOOSTVERSION=1.55.0
+BOOSTBASE=boost_1_55_0
+
+function reporterror {
+  echo
+  echo =============================================================================
+  echo
+  echo "There was an error setting up the prerequisites.  Look above for details."
+  echo
+  exit 1
+}
+
+function webget {
+  if which curl &>/dev/null; then
+    curl -L "$1" >"$2"
+  elif which wget &>/dev/null; then
+    wget -c -O "$2" "$1"
+  else
+    echo "Can't figure out how to download from web.  Please install wget or curl." >&2
+    exit 1
+  fi
+}
+
+for dir in antlr-3.4 gmp-$GMPVERSION boost-$BOOSTVERSION; do
+  if [ -e "$dir" ]; then
+    echo "error: $dir directory exists; please move it out of the way." >&2
+    exit 1
+  fi
+done
+
+echo =============================================================================
+echo
+echo "Setting up ANTLR 3.4..."
+echo
+MACHINE_TYPE=x86 ANTLR_CONFIGURE_ARGS=--host=$HOST contrib/get-antlr-3.4 | grep -v 'Now configure CVC4 with' | grep -v '\./configure --with-antlr-dir='
+[ ${PIPESTATUS[0]} -eq 0 ] || reporterror
+echo
+echo =============================================================================
+echo
+echo "Setting up GMP $GMPVERSION..."
+echo
+( set -ex
+  mkdir gmp-$GMPVERSION
+  cd gmp-$GMPVERSION
+  gmpprefix=`pwd` &&
+  mkdir src &&
+  cd src &&
+  webget ftp://ftp.gmplib.org/pub/gmp-$GMPVERSION/gmp-$GMPVERSION.tar.bz2 gmp-$GMPVERSION.tar.bz2 &&
+  tar xfj gmp-$GMPVERSION.tar.bz2 &&
+  cd gmp-$GMPVERSION &&
+  ./configure --host=$HOST --prefix="$gmpprefix" --enable-cxx &&
+  make &&
+  make install
+) || exit 1
+echo
+echo =============================================================================
+echo
+echo "Setting up Boost..."
+echo
+( mkdir boost-$BOOSTVERSION &&
+  cd boost-$BOOSTVERSION &&
+  webget http://downloads.sourceforge.net/project/boost/boost/$BOOSTVERSION/$BOOSTBASE.tar.gz $BOOSTBASE.tar.gz &&
+  tar xfz $BOOSTBASE.tar.gz &&
+  cd $BOOSTBASE &&
+  ./bootstrap.sh --with-toolset=gcc --prefix=`pwd`/.. --with-libraries=thread &&
+  echo "using gcc : mingw32 : $HOST-gcc ;" >> project-config.jam &&
+  cp tools/build/v2/tools/gcc.jam tools/build/v2/tools/gcc.jam.orig &&
+  sed 's,option = -pthread ; libs = rt ;,,' tools/build/v2/tools/gcc.jam.orig > tools/build/v2/tools/gcc.jam &&
+  ./b2 gcc-mingw32 threadapi=win32 link=static install ) || exit 1
+echo
+echo =============================================================================
+echo
+echo 'Now just run:'
+echo "  ./configure --enable-static-binary --disable-shared --host=$HOST LDFLAGS=\"-L`pwd`/gmp-$GMPVERSION/lib -L`pwd`/antlr-3.4/lib -L`pwd`/boost-$BOOSTVERSION/lib\" CPPFLAGS=\"-I`pwd`/gmp-$GMPVERSION/include -I`pwd`/antlr-3.4/include -I`pwd`/boost-$BOOSTVERSION/include\" --with-antlr-dir=\"`pwd`/antlr-3.4\" ANTLR=\"`pwd`/antlr-3.4/bin/antlr3\""
+echo '  make'
+echo
+echo =============================================================================
diff --git a/contrib/win32-build b/contrib/win32-build
deleted file mode 100755 (executable)
index 290d537..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/bin/bash
-#
-# win32-build script
-# Morgan Deters <mdeters@cs.nyu.edu>
-# Tue, 15 Jan 2013 11:11:24 -0500
-#
-
-if [ $# -ne 0 ]; then
-  echo "usage: `basename $0`" >&2
-  echo >&2
-  echo "This script attempts to build CVC4 for Win32 using mingw." >&2
-  exit 1
-fi
-
-if [ -z "$HOST" ]; then
-  HOST=i586-mingw32msvc
-  echo "WARNING:"
-  echo "WARNING: Using default HOST value: $HOST"
-  echo "WARNING: You should probably run this script like this:"
-  echo "WARNING:"
-  echo "WARNING:   HOST=i586-mingw32msvc win32-build"
-  echo "WARNING:"
-  echo "WARNING: (replacing the i586-mingw32msvc with your build host)"
-  echo "WARNING: to ensure the script builds correctly."
-  echo "WARNING:"
-fi
-
-GMPVERSION=5.1.0
-BOOSTVERSION=1.55.0
-BOOSTBASE=boost_1_55_0
-
-function reporterror {
-  echo
-  echo =============================================================================
-  echo
-  echo "There was an error setting up the prerequisites.  Look above for details."
-  echo
-  exit 1
-}
-
-function webget {
-  if which curl &>/dev/null; then
-    curl -L "$1" >"$2"
-  elif which wget &>/dev/null; then
-    wget -c -O "$2" "$1"
-  else
-    echo "Can't figure out how to download from web.  Please install wget or curl." >&2
-    exit 1
-  fi
-}
-
-for dir in antlr-3.4 gmp-$GMPVERSION boost-$BOOSTVERSION; do
-  if [ -e "$dir" ]; then
-    echo "error: $dir directory exists; please move it out of the way." >&2
-    exit 1
-  fi
-done
-
-echo =============================================================================
-echo
-echo "Setting up ANTLR 3.4..."
-echo
-MACHINE_TYPE=x86 ANTLR_CONFIGURE_ARGS=--host=$HOST contrib/get-antlr-3.4 | grep -v 'Now configure CVC4 with' | grep -v '\./configure --with-antlr-dir='
-[ ${PIPESTATUS[0]} -eq 0 ] || reporterror
-echo
-echo =============================================================================
-echo
-echo "Setting up GMP $GMPVERSION..."
-echo
-( set -ex
-  mkdir gmp-$GMPVERSION
-  cd gmp-$GMPVERSION
-  gmpprefix=`pwd` &&
-  mkdir src &&
-  cd src &&
-  webget ftp://ftp.gmplib.org/pub/gmp-$GMPVERSION/gmp-$GMPVERSION.tar.bz2 gmp-$GMPVERSION.tar.bz2 &&
-  tar xfj gmp-$GMPVERSION.tar.bz2 &&
-  cd gmp-$GMPVERSION &&
-  ./configure --host=$HOST --prefix="$gmpprefix" --enable-cxx &&
-  make &&
-  make install
-) || exit 1
-echo
-echo =============================================================================
-echo
-echo "Setting up Boost..."
-echo
-( mkdir boost-$BOOSTVERSION &&
-  cd boost-$BOOSTVERSION &&
-  webget http://downloads.sourceforge.net/project/boost/boost/$BOOSTVERSION/$BOOSTBASE.tar.gz $BOOSTBASE.tar.gz &&
-  tar xfz $BOOSTBASE.tar.gz &&
-  cd $BOOSTBASE &&
-  ./bootstrap.sh --with-toolset=gcc --prefix=`pwd`/.. --with-libraries=thread &&
-  echo "using gcc : mingw32 : $HOST-gcc ;" >> project-config.jam &&
-  cp tools/build/v2/tools/gcc.jam tools/build/v2/tools/gcc.jam.orig &&
-  sed 's,option = -pthread ; libs = rt ;,,' tools/build/v2/tools/gcc.jam.orig > tools/build/v2/tools/gcc.jam &&
-  ./b2 gcc-mingw32 threadapi=win32 link=static install ) || exit 1
-echo
-echo =============================================================================
-echo
-echo 'Now just run:'
-echo "  ./configure --enable-static-binary --disable-shared --host=$HOST LDFLAGS=\"-L`pwd`/gmp-$GMPVERSION/lib -L`pwd`/antlr-3.4/lib -L`pwd`/boost-$BOOSTVERSION/lib\" CPPFLAGS=\"-I`pwd`/gmp-$GMPVERSION/include -I`pwd`/antlr-3.4/include -I`pwd`/boost-$BOOSTVERSION/include\" ANTLR_HOME=\"`pwd`/antlr-3.4\""
-echo '  make'
-echo
-echo =============================================================================