From a33fccac573ae84b1883dfbdb986563f34e622e2 Mon Sep 17 00:00:00 2001 From: trevor_hansen Date: Tue, 8 Feb 2011 12:20:23 +0000 Subject: [PATCH] Patch from Khoo Yit Phang. Clean up scripts/configure, and add flags to set CC and -fpic. - Use POSIX shell parameter expansion when parsing flags, instead of expr. - Fix the test for $CC/$CXX to work when they contain spaces (e.g., "gcc -m32"). - Export flags in config.info to ensure that the entire build, including recursive Makefiles, consistently use the given flags. - Don't create the installation directories when configuring; do it when installing. - Remove minisat configuration flags from scripts/configure, since they are unused. git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1127 e59a4935-1847-0410-ae03-e826735625c1 --- scripts/Makefile.common | 5 ---- scripts/Makefile.in | 3 +++ scripts/configure | 52 +++++++++++++++-------------------------- 3 files changed, 22 insertions(+), 38 deletions(-) diff --git a/scripts/Makefile.common b/scripts/Makefile.common index f64fc60..f5b0930 100644 --- a/scripts/Makefile.common +++ b/scripts/Makefile.common @@ -26,11 +26,6 @@ OPTIMIZE = -O3 -g # Maximum optimization #2) You need STP to use about half the memory. #CFLAGS_M32 = -m32 -# If you're compiling a 64-bit version of STP, and you want to use -# libstp.a in a shared library, you need the -fPIC option. -#CFLAGS_FPIC = -fPIC -CFLAGS_FPIC = - CFLAGS_BASE = $(OPTIMIZE) diff --git a/scripts/Makefile.in b/scripts/Makefile.in index ea56612..1043a68 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -65,6 +65,9 @@ FORCE: .PHONY: install install: all + @mkdir -p $(BIN_DIR) + @mkdir -p $(LIB_DIR) + @mkdir -p $(INCLUDE_DIR) @cp -f $(BINARIES) $(BIN_DIR) @cp -f $(LIBRARIES) $(LIB_DIR) @cp -f $(HEADERS) $(INCLUDE_DIR) diff --git a/scripts/configure b/scripts/configure index f4914b6..0106dbf 100755 --- a/scripts/configure +++ b/scripts/configure @@ -8,27 +8,22 @@ # LICENSE: Please view LICENSE file in the home dir of this Program #******************************************************************** -SAT=minisat - while [ $# -gt 0 ]; do case "$1" in --with-prefix=*) - arg=`expr "x$1" : 'x[^=]*=\(.*\)'` - PREFIX=$arg;; + PREFIX=${1#*=};; + --with-gcc=*) + CC=${1#*=};; --with-g++=*) - arg=`expr "x$1" : 'x[^=]*=\(.*\)'` - CXX=$arg - echo "Using g++ instead of gcc";; - --with-minisat-core) - SAT=minisat;; - --with-cryptominisat2) - SAT=cryptominisat2;; + CXX=${1#*=};; + --with-fpic) + CFLAGS_FPIC=-fpic;; *) echo "Usage: $0 [options]" echo " --with-prefix=/prefix/path Install STP at the specified path" + echo " --with-gcc=/path/to/gcc Use gcc at the specified path" echo " --with-g++=/path/to/g++ Use g++ at the specified path" - echo " --with-minisat-core Use core MiniSAT solver (default), runtime option to use simplifying" - echo " --with-cryptominisat2 Use CRYPTOMiniSAT 2.x solver" + echo " --with-pic Required to build 64-bit shared libraries." echo "$0 failed" exit 1;; esac @@ -36,32 +31,23 @@ while [ $# -gt 0 ]; do shift done -# check for an option --with-prefix=/path/to/prefix and use that as the +# check for an option --with-prefix=/path/to/prefix and use that as the # prefix, otherwise use /usr/local PREFIX=${PREFIX:-/usr/local} -echo "PREFIX=$PREFIX" > scripts/config.info +echo "export PREFIX=$PREFIX" > scripts/config.info echo "Setting prefix to... $PREFIX" -if [ $CXX ] -then echo "CXX=$CXX" >> scripts/config.info -export CXX="$CXX" -echo "Setting CXX to... $CXX" -fi - -if [ ! -d $PREFIX/include ] -then mkdir -p $PREFIX/include +if [ -n "$CC" ]; then + echo "export CC=$CC" >> scripts/config.info + echo "Setting CC to... $CC" fi - -if [ ! -d $PREFIX/bin ] -then mkdir -p $PREFIX/bin +if [ -n "$CXX" ]; then + echo "export CXX=$CXX" >> scripts/config.info + echo "Setting CXX to... $CXX" fi - -if [ ! -d $PREFIX/lib ] -then mkdir $PREFIX/lib -fi - -if [ ! -d $PREFIX/include/stp ] -then mkdir $PREFIX/include/stp +if [ -n "$CFLAGS_FPIC" ]; then + echo "export CFLAGS_FPIC=$CFLAGS_FPIC" >> scripts/config.info + echo "Setting CFLAGS_FPIC to... $CFLAGS_FPIC" fi echo "STP is configured successfully." -- 2.47.3