From 7c8114cb5f85f2dd3eebe12ba7a8951f24c8a8b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Fri, 27 Dec 2013 17:57:52 +0100 Subject: [PATCH] * configure.ac: Detect xcrun on OSX and use it for make, gcc and libxml. --- ChangeLog | 5 +++++ configure.ac | 24 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ddf7d92ac14..107c28ca074 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-12-27 Jan Djärv + + * configure.ac: Detect xcrun on OSX and use it for make, gcc and + libxml. + 2013-12-26 Paul Eggert Fix core dumps with gcc -fsanitize=address and GNU/Linux. diff --git a/configure.ac b/configure.ac index 8aaf2c6a8ac..ca37219f1b2 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,18 @@ then esac fi +case "`uname 2>/dev/null`" in + *Darwin*) + xcsdkdir= + AC_CHECK_PROGS(XCRUN, [xcrun]) + if test x"$XCRUN" != x; then + AC_CHECK_PROGS(MAKE, [make "$XCRUN make"]) + export MAKE + xcsdkdir="`$XCRUN --show-sdk-path 2>/dev/null`" + fi + ;; +esac + dnl Set emacs_config_options to the options of 'configure', quoted for the shell, dnl and then quoted again for a C string. Separate options with spaces. dnl Add some environment variables, if they were passed via the environment @@ -638,7 +650,13 @@ fi #### Choose a compiler. dnl Sets GCC=yes if using gcc. -AC_PROG_CC +if test x$opsys = xdarwin && test x"$XCRUN" != x; then + AC_PROG_CC([gcc cc cl clang "$XCRUN gcc" "$XCRUN clang"]) + AC_CHECK_PROGS(AR, [ar "$XCRUN ar"]) + test x"$AR" != x && export AR +else + AC_PROG_CC +fi AM_PROG_CC_C_O if test x$GCC = xyes; then @@ -3275,14 +3293,14 @@ if test "${with_xml2}" != "no"; then # Built-in libxml2 on OS X 10.8 lacks libxml-2.0.pc. if test "${HAVE_LIBXML2}" != "yes" -a "$opsys" = "darwin"; then SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I/usr/include/libxml2" + CPPFLAGS="$CPPFLAGS -I$xcsdkdir/usr/include/libxml2" AC_CHECK_HEADER(libxml/HTMLparser.h, [AC_CHECK_DECL(HTML_PARSE_RECOVER, HAVE_LIBXML2=yes, , [#include ])]) CPPFLAGS="$SAVE_CPPFLAGS" if test "${HAVE_LIBXML2}" = "yes"; then + LIBXML2_CFLAGS="-I'$xcsdkdir/usr/include/libxml2'" LIBXML2_LIBS="-lxml2" - LIBXML2_CFLAGS="-I/usr/include/libxml2" fi fi if test "${HAVE_LIBXML2}" = "yes"; then -- 2.39.2