Fix bug 483: readline checks must come after Boost checks in configure
authorMorgan Deters <mdeters@cs.nyu.edu>
Tue, 18 Dec 2012 20:31:45 +0000 (15:31 -0500)
committerMorgan Deters <mdeters@cs.nyu.edu>
Tue, 18 Dec 2012 20:31:45 +0000 (15:31 -0500)
configure.ac

index 6cc422b79bec5d87a5fb37b945aecc3b2aebffa1..39672a554656f1224ed0ef1e02698a45df2adba9 100644 (file)
@@ -896,13 +896,6 @@ fi
 
 # Checks for libraries.
 
-# Check for libreadline (defined in config/readline.m4)
-AC_ARG_WITH([readline], [AS_HELP_STRING([--with-readline], [support the readline library])], [], [with_readline=check])
-CVC4_CHECK_FOR_READLINE
-AC_DEFINE_UNQUOTED([HAVE_LIBREADLINE], $have_libreadline, [Define to 1 to use libreadline])
-AC_DEFINE_UNQUOTED([READLINE_COMPENTRY_FUNC_RETURNS_CHARP], $readline_compentry_func_returns_charp, [Define to 1 if rl_completion_entry_function is declared to return pointer to char])
-AC_SUBST([READLINE_LIBS])
-
 AC_SEARCH_LIBS([clock_gettime], [rt],
                [AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
                           [Defined to 1 if clock_gettime() is supported by the platform.])],
@@ -976,6 +969,29 @@ if test "$with_portfolio" = yes; then
   CVC4CPPFLAGS="${CVC4CPPFLAGS:+$CVC4CPPFLAGS }-DCVC4_PORTFOLIO"
 fi
 
+# Check for libreadline (defined in config/readline.m4)
+AC_ARG_WITH([readline], [AS_HELP_STRING([--with-readline], [support the readline library])], [], [with_readline=check])
+# make the flags as close as possible to the final flags, because the Boost
+# flags can bring in a different, incompatible readline library than we'd
+# get otherwise (e.g. on Mac, where there are commonly two different readlines,
+# one in /usr and one in /opt/local)
+cvc4_rlcheck_save_CPPFLAGS="$CPPFLAGS"
+cvc4_rlcheck_save_CXXFLAGS="$CXXFLAGS"
+cvc4_rlcheck_save_CFLAGS="$CFLAGS"
+cvc4_rlcheck_save_LDFLAGS="$LDFLAGS"
+CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }${BOOST_CPPFLAGS:+$BOOST_CPPFLAGS }$CVC4CPPFLAGS"
+CXXFLAGS="${CXXFLAGS:+$CXXFLAGS }$CVC4CXXFLAGS -Wno-deprecated"
+CFLAGS="${CFLAGS:+$CFLAGS }$CVC4CFLAGS -Wno-deprecated -fexceptions"
+LDFLAGS="${LDFLAGS:+$LDFLAGS }$CVC4LDFLAGS"
+CVC4_CHECK_FOR_READLINE
+CPPFLAGS="$cvc4_rlcheck_save_CPPFLAGS"
+CXXFLAGS="$cvc4_rlcheck_save_CXXFLAGS"
+CFLAGS="$cvc4_rlcheck_save_CFLAGS"
+LDFLAGS="$cvc4_rlcheck_save_LDFLAGS"
+AC_DEFINE_UNQUOTED([HAVE_LIBREADLINE], $have_libreadline, [Define to 1 to use libreadline])
+AC_DEFINE_UNQUOTED([READLINE_COMPENTRY_FUNC_RETURNS_CHARP], $readline_compentry_func_returns_charp, [Define to 1 if rl_completion_entry_function is declared to return pointer to char])
+AC_SUBST([READLINE_LIBS])
+
 # Whether to build compatibility library
 CVC4_BUILD_LIBCOMPAT=yes
 AC_ARG_WITH([compat],