Skip to content

Commit

Permalink
[autoconf] Fix m4 quoting for newer autotools
Browse files Browse the repository at this point in the history
This simply fixes up quoting of macro invocations to appease newer versions of autotools.

http://llvm-reviews.chandlerc.com/D332

Signed-off-by: Saleem Abdulrasool <[email protected]>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173878 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chapuni committed Jan 30, 2013
1 parent fd6fbec commit a4afeef
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 111 deletions.
93 changes: 57 additions & 36 deletions autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1237,10 +1237,15 @@ fi
dnl Verify that GCC is version 3.0 or higher
if test "$GCC" = "yes"
then
AC_COMPILE_IFELSE([[#if !defined(__GNUC__) || __GNUC__ < 3
#error Unsupported GCC version
#endif
]], [], [AC_MSG_ERROR([gcc 3.x required, but you have a lower version])])
AC_COMPILE_IFELSE(
[
AC_LANG_SOURCE([[
#if !defined(__GNUC__) || __GNUC__ < 3
#error Unsupported GCC version
#endif
]])
],
[], [AC_MSG_ERROR([gcc 3.x required, but you have a lower version])])
fi

dnl Check for GNU Make. We use its extensions, so don't build without it
Expand Down Expand Up @@ -1487,18 +1492,23 @@ AC_CHECK_HEADERS([CrashReporterClient.h])
dnl Try to find Darwin specific crash reporting global.
AC_MSG_CHECKING([__crashreporter_info__])
AC_LINK_IFELSE(
AC_LANG_SOURCE(
[[extern const char *__crashreporter_info__;
int main() {
__crashreporter_info__ = "test";
return 0;
}
]]),
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CRASHREPORTER_INFO, 1, Can use __crashreporter_info__),
AC_MSG_RESULT(no)
AC_DEFINE(HAVE_CRASHREPORTER_INFO, 0,
Define if __crashreporter_info__ exists.))
[
AC_LANG_SOURCE([[
extern const char *__crashreporter_info__;
int main() {
__crashreporter_info__ = "test";
return 0;
}
]])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CRASHREPORTER_INFO], [1], [Can use __crashreporter_info__])
],
[
AC_MSG_RESULT([no])
AC_DEFINE([HAVE_CRASHREPORTER_INFO], [0], [Define if __crashreporter_info__ exists.])
])

dnl===-----------------------------------------------------------------------===
dnl===
Expand Down Expand Up @@ -1561,10 +1571,15 @@ fi
dnl Check Win32 API EnumerateLoadedModules.
if test "$llvm_cv_os_type" = "MingW" ; then
AC_MSG_CHECKING([whether EnumerateLoadedModules() accepts new decl])
AC_COMPILE_IFELSE([[#include <windows.h>
#include <imagehlp.h>
extern void foo(PENUMLOADED_MODULES_CALLBACK);
extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));]],
AC_COMPILE_IFELSE(
[
AC_LANG_SOURCE([[
#include <windows.h>
#include <imagehlp.h>
extern void foo(PENUMLOADED_MODULES_CALLBACK);
extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));
]])
],
[
AC_MSG_RESULT([yes])
llvm_cv_win32_elmcb_pcstr="PCSTR"
Expand Down Expand Up @@ -1605,22 +1620,28 @@ dnl Since we'll be using these atomic builtins in C++ files we should test
dnl the C++ compiler.
AC_LANG_PUSH([C++])
AC_LINK_IFELSE(
AC_LANG_SOURCE(
[[int main() {
volatile unsigned long val = 1;
__sync_synchronize();
__sync_val_compare_and_swap(&val, 1, 0);
__sync_add_and_fetch(&val, 1);
__sync_sub_and_fetch(&val, 1);
return 0;
}
]]),
AC_LANG_POP([C++])
AC_MSG_RESULT(yes)
AC_DEFINE(LLVM_HAS_ATOMICS, 1, Has gcc/MSVC atomic intrinsics),
AC_MSG_RESULT(no)
AC_DEFINE(LLVM_HAS_ATOMICS, 0, Has gcc/MSVC atomic intrinsics)
AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing]))
[
AC_LANG_SOURCE([[
int main() {
volatile unsigned long val = 1;
__sync_synchronize();
__sync_val_compare_and_swap(&val, 1, 0);
__sync_add_and_fetch(&val, 1);
__sync_sub_and_fetch(&val, 1);
return 0;
}
]])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([LLVM_HAS_ATOMICS], [1], [Has gcc/MSVC atomic intrinsics])
],
[
AC_MSG_RESULT([no])
AC_DEFINE([LLVM_HAS_ATOMICS], [0], [Has gcc/MSVC atomic intrinsics])
AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing])
])
AC_LANG_POP([C++])

dnl===-----------------------------------------------------------------------===
dnl===
Expand Down
10 changes: 4 additions & 6 deletions autoconf/m4/huge_val.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ AC_DEFUN([AC_HUGE_VAL_CHECK],[
AC_LANG_PUSH([C++])
ac_save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -pedantic"
AC_RUN_IFELSE(
AC_LANG_PROGRAM(
[#include <math.h>],
[double x = HUGE_VAL; return x != x; ]),
[ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no],
[ac_cv_huge_val_sanity=yes])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
[[double x = HUGE_VAL; return x != x;]])],
[ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no],
[ac_cv_huge_val_sanity=yes])
CXXFLAGS=$ac_save_CXXFLAGS
AC_LANG_POP([C++])
])
Expand Down
20 changes: 13 additions & 7 deletions autoconf/m4/single_cxx_check.m4
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
dnl
dnl AC_SINGLE_CXX_CHECK(CACHEVAR, FUNCTION, HEADER, PROGRAM)
dnl $1, $2, $3, $4,
dnl
dnl $1, $2, $3, $4,

AC_DEFUN([AC_SINGLE_CXX_CHECK],
[AC_CACHE_CHECK([for $2 in $3], [$1],
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include $3],[$4]),[$1=yes],[$1=no])
AC_LANG_POP([C++])])
])
[
AC_CACHE_CHECK([for $2 in $3], [$1],
[
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]][$3], [$4])],
[$1][[=yes]],
[$1][[=no]])
AC_LANG_POP([C++])
])
])

Loading

0 comments on commit a4afeef

Please sign in to comment.