#
# LICENSE
#
+# Copyright (c) 2012 Brian Aker <brian@tangent.org>
# Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
#serial 6
-AC_DEFUN([AX_CHECK_LIBRARY], [
- AC_ARG_VAR($1[_CPPFLAGS], [C preprocessor flags for ]$1[ headers])
- AC_ARG_VAR($1[_LDFLAGS], [linker flags for ]$1[ libraries])
+AC_DEFUN([AX_CHECK_LIBRARY],
+ [AC_ARG_VAR($1[_CPPFLAGS],[C preprocessor flags for ]$1[ headers])
+ AC_ARG_VAR($1[_LDFLAGS],[linker flags for ]$1[ libraries])
- AC_CACHE_VAL(AS_TR_SH([ax_cv_have_]$1),
- [save_CPPFLAGS="$CPPFLAGS"
- save_LDFLAGS="$LDFLAGS"
- save_LIBS="$LIBS"
+ AC_CACHE_VAL(AS_TR_SH([ax_cv_have_]$1),
+ [AX_SAVE_FLAGS
- AS_IF([test "x$]$1[_CPPFLAGS" != "x"],
- [CPPFLAGS="$CPPFLAGS $]$1[_CPPFLAGS"])
+ AS_IF([test "x$]$1[_CPPFLAGS" != "x"],
+ [CPPFLAGS="$CPPFLAGS $]$1[_CPPFLAGS"])
- AS_IF([test "x$]$1[_LDFLAGS" != "x"],
- [LDFLAGS="$LDFLAGS $]$1[_LDFLAGS"])
+ AS_IF([test "x$]$1[_LDFLAGS" != "x"],
+ [LDFLAGS="$LDFLAGS $]$1[_LDFLAGS"])
- AC_CHECK_HEADER($2, [
- AC_CHECK_LIB($3, [main],
- [AS_TR_SH([ax_cv_have_]$1)=yes],
- [AS_TR_SH([ax_cv_have_]$1)=no])
- ], [AS_TR_SH([ax_cv_have_]$1)=no])
+ AC_CHECK_HEADER($2, [
+ AC_CHECK_LIB($3, [main],
+ [AS_TR_SH([ax_cv_have_]$1)=yes],
+ [AS_TR_SH([ax_cv_have_]$1)=no])
+ ], [AS_TR_SH([ax_cv_have_]$1)=no])
- CPPFLAGS="$save_CPPFLAGS"
- LDFLAGS="$save_LDFLAGS"
- LIBS="$save_LIBS"
- ])
+ AX_RESTORE_FLAGS
+ ])
- AS_IF([test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"],
- [AC_DEFINE([HAVE_]$1, [1], [Define to 1 if ]$1[ is found])
- AC_SUBST($1[_CPPFLAGS])
- AC_SUBST($1[_LDFLAGS])
- AC_SUBST($1[_LIB],[-l]$3)
- m4_ifval( m4_normalize([$4]), [$4]),
- m4_ifval( m4_normalize([$5]), [$5])])
- AM_CONDITIONAL([HAVE_]$1,[test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"])
- ])
+ AS_IF([test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"],
+ [AC_DEFINE([HAVE_]$1, [1], [Define to 1 if ]$1[ is found])
+ AC_SUBST($1[_CPPFLAGS])
+ AC_SUBST($1[_LDFLAGS])
+ AC_SUBST($1[_LIB],[-l]$3)
+ ifelse([$4], , :, [$4])],
+ [ifelse([$5], , :, [$5])])
+ AM_CONDITIONAL([HAVE_]$1,[test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"])
+ ])
#
# LICENSE
#
+# Copyright (c) 2012 Brian Aker <brian@tangent.org>
# Copyright (c) 2008 Neil Ferguson <nferguso@eso.org>
#
# Copying and distribution of this file, with or without modification, are
#serial 9
- AC_DEFUN([AX_CXX_GCC_ABI_DEMANGLE],
- [AC_CACHE_CHECK([whether the compiler supports GCC C++ ABI name demangling],
- [ax_cv_cxx_gcc_abi_demangle],
- [AC_LANG_PUSH([C++])
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [
-#include <typeinfo>
+AC_DEFUN([AX_CXX_GCC_ABI_DEMANGLE],
+ [AC_CACHE_CHECK([whether the compiler supports GCC C++ ABI name demangling],
+ [ax_cv_cxx_gcc_abi_demangle],
+ [AC_LANG_PUSH([C++])
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <typeinfo>
#include <cxxabi.h>
#include <cstdlib>
-#include <string>
+#include <string>],
+ [template<typename TYPE>
+ class A {};
+ ],[A<int> instance;
+ int status = 0;
+ char* c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status);
-template<typename TYPE> class A {};
- ],[
-A<int> instance;
-int status = 0;
-char* c_name = 0;
+ std::string name(c_name);
+ ::free(c_name);
-c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status);
-std::string name(c_name);
-::free(c_name);
-return name == "A<int>";
- ])],
- [ax_cv_cxx_gcc_abi_demangle=yes],
+ return name == "A<int>";
+ ])],[ax_cv_cxx_gcc_abi_demangle=yes],
+ [ax_cv_cxx_gcc_abi_demangle=no],
[ax_cv_cxx_gcc_abi_demangle=no])
- AC_LANG_POP()
- ])
-
- if test "$ax_cv_cxx_gcc_abi_demangle" = yes; then
- AC_DEFINE(HAVE_GCC_ABI_DEMANGLE, [1], [define if the compiler supports GCC C++ ABI name demangling])
- fi
- ])
+ AC_LANG_POP])
+ AS_IF([test "x$ax_cv_cxx_gcc_abi_demangle" = xyes],
+ [AC_DEFINE([HAVE_GCC_ABI_DEMANGLE],[1],[define if the compiler supports GCC C++ ABI name demangling])])
+ ])