Fix configure check for libc++

This commit is contained in:
Thomas Goyne 2012-11-24 09:05:17 -08:00
parent bdf7a0ca83
commit 3ff6158d85
2 changed files with 20 additions and 17 deletions

View file

@ -168,8 +168,6 @@ AS_IF([test x$enable_compiler_flags != xno], [
AC_CXX_FLAG([-pipe]) AC_CXX_FLAG([-pipe])
AC_CXX_FLAG([-g]) AC_CXX_FLAG([-g])
AC_CXX_FLAG([-std=c++11]) AC_CXX_FLAG([-std=c++11])
AC_CXX_FLAG([-stdlib=libc++])
AC_LD_FLAG([-stdlib=libc++])
# -O* messes with debugging. # -O* messes with debugging.
AS_IF([test x$enable_debug = xyes], [ AS_IF([test x$enable_debug = xyes], [
@ -181,6 +179,26 @@ AS_IF([test x$enable_compiler_flags != xno], [
]) ])
]) ])
AC_ARG_WITH([libc++], AS_HELP_STRING([--with-libc++],[Use libc++ rather than libstdc++. [auto]]))
AS_IF([test x$with_libc__ != xno], [
AC_LANG_PUSH(C++)
ac_ld_flag_save="$LDFLAGS"
LDFLAGS="$LDFLAGS -stdlib=libc++"
AC_MSG_CHECKING([[whether $CXX supports -stdlib=libc++]])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]])], [
AC_MSG_RESULT([yes])
CXXFLAGS="$CXXFLAGS -stdlib=libc++"
], [
AS_IF([test x$with_libc__ = xyes], [
AC_MSG_FAILURE([no])
], [
LDFLAGS="$ac_ld_flag_save"
AC_MSG_RESULT([no])
])
])
AC_LANG_POP(C++)
])
###################################### ######################################
# Check Headers / Features / Libraries # Check Headers / Features / Libraries
###################################### ######################################

View file

@ -28,21 +28,6 @@ AC_DEFUN([AC_CXX_FLAG], [{
]) ])
AC_LANG_POP(C++) AC_LANG_POP(C++)
}]) }])
AC_DEFUN([AC_LD_FLAG], [{
AC_LANG_PUSH(C++)
ac_ld_flag_save="$LDFLAGS"
LDFLAGS="$LDFLAGS $1"
AC_MSG_CHECKING([[whether $CXX supports $1]])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]])],
[AC_MSG_RESULT([yes])],
[
LDFLAGS="$ac_ld_flag_save"
AC_MSG_RESULT([no])
$2
])
AC_LANG_POP(C++)
}])
AC_DEFUN([AC_PCH_FLAG], [{ AC_DEFUN([AC_PCH_FLAG], [{
AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
ac_cxx_flag_save="$CXXFLAGS" ac_cxx_flag_save="$CXXFLAGS"