Commit 9d456e4f authored by Peter Griess's avatar Peter Griess Committed by Sara Golemon

Set -std=XXX flags earlier; use in AC_COMPILE_IFELSE()

Summary:
- We had a bug where AC_COMPILE_IFELSE() invocations weren't using the
same -std=XXX flags that we're using in our actual build. This
happened because we made these checks before figuring out which
flag to use.
- Stop setting -std=XXX flags in CPPFLAGS. It's only useful for
CFLAGS/CXXFLAGS.

Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac

Reviewed By: meyering@fb.com

FB internal diff: D1003972
parent e5b563e9
......@@ -23,6 +23,20 @@ AC_PROG_CXX
AC_PROG_CC
AC_CXX_COMPILE_STDCXX_0X
# Be sure to add any -std option to CXXFLAGS before we invoke any
# AC_COMPILE_IFELSE() or similar macros. Any such macros that are invoked
# before we update CXXFLAGS will not be run with the same options that we use
# during the real build.
STD=""
if test "x$ac_cv_cxx_compile_cxx0x_cxx" = xyes; then
STD="-std=c++0x"
fi
if test "x$ac_cv_cxx_compile_cxx0x_gxx" = xyes; then
STD="-std=gnu++0x"
fi
CXXFLAGS="$STD $CXXFLAGS"
# Checks for libraries.
AC_CHECK_LIB([glog],[openlog],[],[AC_MSG_ERROR(
[Please install google-glog library])])
......@@ -131,15 +145,7 @@ if test "$ac_cv_func_pthread_yield" = "no"; then
AC_CHECK_FUNCS([sched_yield])
fi
CXX_FLAGS=""
if test "$ac_cv_cxx_compile_cxx0x_cxx" = yes; then
CXX_FLAGS="-std=c++0x"
fi
if test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
CXX_FLAGS="-std=gnu++0x"
fi
AC_SUBST(AM_CPPFLAGS, '-I../$(top_srcdir)'" "'-I$(top_srcdir)/io'" "'-I$(top_srcdir)/test'" $CXX_FLAGS $BOOST_CPPFLAGS")
AC_SUBST(AM_CPPFLAGS, '-I../$(top_srcdir)'" "'-I$(top_srcdir)/io'" "'-I$(top_srcdir)/test'" $BOOST_CPPFLAGS")
AC_SUBST(AM_LDFLAGS, "$BOOST_LDFLAGS $BOOST_THREAD_LIB $BOOST_SYSTEM_LIB $BOOST_REGEX_LIB -lpthread")
AM_CONDITIONAL([HAVE_STD_THREAD], [test "$ac_cv_header_features" = "yes"])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment