diff options
author | Morgan Deters <mdeters@gmail.com> | 2010-04-08 20:49:11 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2010-04-08 20:49:11 +0000 |
commit | c3a6ff8c6e4a0c743cd33eb29931f837eeb2959e (patch) | |
tree | df8d8a97baebea55aaf94cc816974a86475c3a4b /configure.ac | |
parent | de2b6c4ee9c2ecad88bddd0a60f10e94d6f8c71f (diff) |
A handful of build system fixes:
* (test/unit/Makefile.am) libtool was being passed relative paths of
sources in .cpp, confusing lcov if -b wasn't given. Fixed.
Closes bug #102.
* (configure.ac) --enable-coverage now implies --enable-static
--enable-static-binary --disable-shared.
* (configure.ac) Create top-level config.status for informational and
re-configuration purposes.
* (configure.ac) Remove -fvisibility=hidden for debug builds.
Closes bug #104.
* (test/unit/Makefile.am) Build unit tests with -Wall.
* (various unit tests) Fixed trivially-fixable warnings in building
unit tests. (Signedness in comparison, unused variables, etc.)
* (Makefile.builds.in) Copy the binary correctly if it is static.
(It was failing, but only with --enable-static --enable-shared
--enable-static-binary.) Closes bug #103.
* (src/parser/Makefile.am) libcvc4parser.so now links with libcvc4.so.
* Other minor cleanups to the build system.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 107 |
1 files changed, 76 insertions, 31 deletions
diff --git a/configure.ac b/configure.ac index d23cf4a6d..a44dc4b66 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,10 @@ CVC4_PARSER_LIBRARY_VERSION=$CVC4_MAJOR:$CVC4_MINOR:$CVC4_RELEASE # some things.) config_cmdline="$@" +# remember if the user set these explicitly (or whether autoconf does) +user_specified_enable_or_disable_static=${enable_static+yes} +user_specified_enable_or_disable_shared=${enable_shared+yes} + # turn off static lib building by default AC_ENABLE_SHARED AC_DISABLE_STATIC @@ -157,7 +161,24 @@ elif test -e src/include/cvc4_public.h; then cd "builds/$target/$build_type" CVC4_CONFIGURE_IN_BUILDS=yes; export CVC4_CONFIGURE_IN_BUILDS echo ../../../configure $config_cmdline - exec ../../../configure $config_cmdline + `pwd`/../../../configure $config_cmdline + exitval=$? + cd ../../.. + if test $exitval -eq 0; then + cat >config.status <<EOF +#!/bin/sh -ex +# Generated by configure, `date` +# This script part of CVC4. + +target='$target' +build_type='$build_type' + +cd "builds/$target/$build_type" +./config.status "\$@" +EOF + chmod +x config.status + fi + exit $exitval else AC_MSG_RESULT([this one (user-specified)]) fi @@ -174,6 +195,7 @@ case "$with_build" in CVC4CXXFLAGS= CVC4CFLAGS= CVC4LDFLAGS= + FLAG_VISIBILITY_HIDDEN='-fvisibility=hidden' if test -z "${OPTLEVEL+set}" ; then OPTLEVEL=3 ; fi if test -z "${enable_optimized+set}" ; then enable_optimized=yes ; fi if test -z "${enable_debug_symbols+set}"; then enable_debug_symbols=yes ; fi @@ -186,6 +208,7 @@ case "$with_build" in CVC4CXXFLAGS='-fno-inline' CVC4CFLAGS='-fno-inline' CVC4LDFLAGS= + FLAG_VISIBILITY_HIDDEN= if test -z "${enable_optimized+set}" ; then enable_optimized=no ; fi if test -z "${enable_debug_symbols+set}"; then enable_debug_symbols=yes ; fi if test -z "${enable_assertions+set}" ; then enable_assertions=yes ; fi @@ -197,6 +220,7 @@ case "$with_build" in CVC4CXXFLAGS= CVC4CFLAGS= CVC4LDFLAGS= + FLAG_VISIBILITY_HIDDEN='-fvisibility=hidden' if test -z "${OPTLEVEL+set}" ; then OPTLEVEL=2 ; fi if test -z "${enable_optimized+set}" ; then enable_optimized=yes ; fi if test -z "${enable_debug_symbols+set}"; then enable_debug_symbols=yes ; fi @@ -209,6 +233,7 @@ case "$with_build" in CVC4CXXFLAGS='-funroll-all-loops -fexpensive-optimizations -fno-enforce-eh-specs' CVC4CFLAGS='-funroll-all-loops -fexpensive-optimizations -fno-enforce-eh-specs' CVC4LDFLAGS= + FLAG_VISIBILITY_HIDDEN='-fvisibility=hidden' if test -z "${OPTLEVEL+set}" ; then OPTLEVEL=9 ; fi if test -z "${enable_optimized+set}" ; then enable_optimized=yes ; fi if test -z "${enable_debug_symbols+set}"; then enable_debug_symbols=no ; fi @@ -225,12 +250,12 @@ esac AC_MSG_CHECKING([whether to build a static binary]) AC_ARG_ENABLE([static-binary], [AS_HELP_STRING([--enable-static-binary], - [build a statically-linked binary [default=no]])]) + [build a fully statically-linked binary [default=no]])]) if test -z "${enable_static_binary+set}"; then enable_static_binary=no fi AC_MSG_RESULT([$enable_static_binary]) -if test "${enable_static_binary}" = yes -a "${enable_static}" != yes; then +if test "$enable_static_binary" = yes -a "$enable_static" != yes; then enable_static=yes AC_MSG_WARN([forcing static-library building, --enable-static-binary given]) fi @@ -248,11 +273,11 @@ fi AC_MSG_RESULT([$enable_optimized]) if test "$enable_optimized" = yes; then - CVC4CXXFLAGS="$CVC4CXXFLAGS -O$OPTLEVEL" - CVC4CFLAGS="$CVC4CFLAGS -O$OPTLEVEL" + CVC4CXXFLAGS="${CVC4CXXFLAGS:+$CVC4CXXFLAGS }-O$OPTLEVEL" + CVC4CFLAGS="${CVC4CFLAGS:+$CVC4CFLAGS }-O$OPTLEVEL" else - CVC4CXXFLAGS="$CVC4CXXFLAGS -O0" - CVC4CFLAGS="$CVC4CFLAGS -O0" + CVC4CXXFLAGS="${CVC4CXXFLAGS:+$CVC4CXXFLAGS }-O0" + CVC4CFLAGS="${CVC4CFLAGS:+$CVC4CFLAGS }-O0" fi AC_MSG_CHECKING([whether to include debugging symbols in libcvc4]) @@ -268,8 +293,8 @@ fi AC_MSG_RESULT([$enable_debug_symbols]) if test "$enable_debug_symbols" = yes; then - CVC4CXXFLAGS="$CVC4CXXFLAGS -ggdb3" - CVC4CFLAGS="$CVC4CFLAGS -ggdb3" + CVC4CXXFLAGS="${CVC4CXXFLAGS:+$CVC4CXXFLAGS }-ggdb3" + CVC4CFLAGS="${CVC4CFLAGS:+$CVC4CFLAGS }-ggdb3" fi AC_MSG_CHECKING([whether to include assertions in build]) @@ -285,7 +310,7 @@ fi AC_MSG_RESULT([$enable_assertions]) if test "$enable_assertions" = yes; then - CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_ASSERTIONS" + CVC4CPPFLAGS="${CVC4CPPFLAGS:+$CVC4CPPFLAGS }-DCVC4_ASSERTIONS" fi AC_MSG_CHECKING([whether to do a traceable build of CVC4]) @@ -300,7 +325,7 @@ fi AC_MSG_RESULT([$enable_tracing]) if test "$enable_tracing" = yes; then - CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_TRACING" + CVC4CPPFLAGS="${CVC4CPPFLAGS:+$CVC4CPPFLAGS }-DCVC4_TRACING" fi AC_MSG_CHECKING([whether to do a muzzled build of CVC4]) @@ -315,7 +340,7 @@ fi AC_MSG_RESULT([$enable_muzzle]) if test "$enable_muzzle" = yes; then - CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_MUZZLE" + CVC4CPPFLAGS="${CVC4CPPFLAGS:+$CVC4CPPFLAGS }-DCVC4_MUZZLE" fi AC_MSG_CHECKING([whether to do a gcov-enabled build of CVC4]) @@ -330,16 +355,38 @@ fi AC_MSG_RESULT([$enable_coverage]) if test "$enable_coverage" = yes; then -dnl TODO: Is there someway to detect if enable_shared is set by default, -dnl so that we can automatically disable shared and enable static? - if test "$enable_shared" = yes; then - AC_MSG_ERROR([Gcov requires static libraries. Use --disable-shared.]) + # For coverage testing, we prefer: + # --enable-static --disable-shared --disable-static-binary + # If the user didn't specify these, we force them here. If the + # user specified them in opposite phase, give warnings that they + # shouldn't do that, or bomb out. + if test "$user_specified_enable_or_disable_shared" != yes; then + enable_shared=no + AC_MSG_WARN([turning off shared library building due to --enable-coverage]) + elif test "$enable_shared" = yes; then + AC_MSG_WARN([]) + AC_MSG_WARN([It is not recommended to configure with --enable-coverage --enable-shared]) + AC_MSG_WARN([gcov does not support shared libraries, so only your static libraries will be coverage-testable.]) + AC_MSG_WARN([Your cvc4 driver and testing binaries will not be coverage-testable.]) + AC_MSG_WARN([]) + fi + if test "${enable_static_binary+set}" = set -a "$enable_static_binary" = yes; then + AC_MSG_WARN([]) + AC_MSG_WARN([It is not recommended to configure with --enable-coverage --enable-static-binary]) + AC_MSG_WARN([Your cvc4 driver and testing binaries will be fully-statically linked and may not be coverage-testable.]) + AC_MSG_WARN([]) + fi + if test "$user_specified_enable_or_disable_static" != yes; then + enable_static=yes + AC_MSG_WARN([turning on static library building due to --enable-coverage]) + elif test "$enable_static" != yes; then + AC_MSG_ERROR([--enable-coverage and --disable-static are incompatible; gcov only supports static libraries.]) fi - CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_COVERAGE" - CVC4CXXFLAGS="$CVC4CXXFLAGS --coverage" - CVC4CFLAGS="$CVC4CFLAGS --coverage" - CVC4LDFLAGS="$CVC4LDFLAGS --coverage" + CVC4CPPFLAGS="${CVC4CPPFLAGS:+$CVC4CPPFLAGS }-DCVC4_COVERAGE" + CVC4CXXFLAGS="${CVC4CXXFLAGS:+$CVC4CXXFLAGS }--coverage" + CVC4CFLAGS="${CVC4CFLAGS:+$CVC4CFLAGS }--coverage" + CVC4LDFLAGS="${CVC4LDFLAGS:+$CVC4LDFLAGS }--coverage" fi AC_MSG_CHECKING([whether to do a profiling-enabled build of CVC4]) @@ -355,10 +402,10 @@ fi AC_MSG_RESULT([$enable_profiling]) if test "$enable_profiling" = yes; then - CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_PROFILING" - CVC4CXXFLAGS="$CVC4CXXFLAGS -pg" - CVC4CFLAGS="$CVC4CFLAGS -pg" - CVC4LDFLAGS="$CVC4LDFLAGS -pg" + CVC4CPPFLAGS="${CVC4CPPFLAGS:+$CVC4CPPFLAGS }-DCVC4_PROFILING" + CVC4CXXFLAGS="${CVC4CXXFLAGS:+$CVC4CXXFLAGS }-pg" + CVC4CFLAGS="${CVC4CFLAGS:+$CVC4CFLAGS }-pg" + CVC4LDFLAGS="${CVC4LDFLAGS:+$CVC4LDFLAGS }-pg" fi AM_INIT_AUTOMAKE([1.11 no-define]) @@ -462,10 +509,12 @@ AC_TYPE_SIZE_T # Prepare configure output -if test "$enable_shared" = yes; then BUILDING_SHARED=1; fi -if test "$enable_static" = yes; then BUILDING_STATIC=1; fi +if test "$enable_shared" = yes; then BUILDING_SHARED=1; else BUILDING_SHARED=0; fi +if test "$enable_static" = yes; then BUILDING_STATIC=1; else BUILDING_STATIC=0; fi +if test "$enable_static_binary" = yes; then STATIC_BINARY=1; else STATIC_BINARY=0; fi AC_SUBST(BUILDING_SHARED) AC_SUBST(BUILDING_STATIC) +AC_SUBST(STATIC_BINARY) AM_CONDITIONAL([STATIC_BINARY], [test "$enable_static_binary" = yes]) AC_SUBST(CVC4_LIBRARY_VERSION) @@ -481,7 +530,6 @@ CXXFLAGS="${CXXFLAGS:+$CXXFLAGS }$CVC4CXXFLAGS -Wno-deprecated" CFLAGS="${CFLAGS:+$CFLAGS }$CVC4CFLAGS -Wno-deprecated -fexceptions" LDFLAGS="${LDFLAGS:+$LDFLAGS }$CVC4LDFLAGS" -FLAG_VISIBILITY_HIDDEN='-fvisibility=hidden' AC_SUBST(FLAG_VISIBILITY_HIDDEN) # mk_include @@ -520,10 +568,7 @@ if test "$custom_build_profile" = yes; then if test "$with_build" = default; then with_build=custom else - AC_MSG_WARN([]) - AC_MSG_WARN([This is a customized $with_build build profile.]) - AC_MSG_WARN([]) - with_build="$with_build-custom" + with_build="$with_build (customized)" fi fi |