From 3ff6158d857c952ea1936a6e387a20ad5b624d5a Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 24 Nov 2012 09:05:17 -0800 Subject: [PATCH] Fix configure check for libc++ --- aegisub/configure.ac | 22 ++++++++++++++++++++-- aegisub/m4macros/ac_flag.m4 | 15 --------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/aegisub/configure.ac b/aegisub/configure.ac index 9b1ecd0e0..c0cbf46dd 100644 --- a/aegisub/configure.ac +++ b/aegisub/configure.ac @@ -168,8 +168,6 @@ AS_IF([test x$enable_compiler_flags != xno], [ AC_CXX_FLAG([-pipe]) AC_CXX_FLAG([-g]) AC_CXX_FLAG([-std=c++11]) - AC_CXX_FLAG([-stdlib=libc++]) - AC_LD_FLAG([-stdlib=libc++]) # -O* messes with debugging. 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 ###################################### diff --git a/aegisub/m4macros/ac_flag.m4 b/aegisub/m4macros/ac_flag.m4 index f60e65d02..cf3248a4e 100644 --- a/aegisub/m4macros/ac_flag.m4 +++ b/aegisub/m4macros/ac_flag.m4 @@ -28,21 +28,6 @@ AC_DEFUN([AC_CXX_FLAG], [{ ]) 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_LANG_PUSH(C++) ac_cxx_flag_save="$CXXFLAGS"