#
# SYNOPSIS
#
-# AX_COMPILER_VENDOR
+# AX_COMPILER_VENDOR()
#
# DESCRIPTION
#
#serial 4
- AC_DEFUN([AX_C_COMPILER_VERSION],[
- AC_REQUIRE([AX_COMPILER_VENDOR])
+ AC_DEFUN([AX_C_COMPILER_VERSION],
+ [AC_REQUIRE([AX_COMPILER_VENDOR])
AC_MSG_CHECKING([C Compiler version])
- ax_cv_c_compiler_version_vendor="$ax_cv_c_compiler_vendor"
+ ax_c_compiler_version_vendor="$ax_c_compiler_vendor"
- AC_CHECK_DECL([__GNUC_PATCHLEVEL__],[
- GNUCC=yes
- ],[GNUCC=no])
+ AC_CHECK_DECL([__GNUC_PATCHLEVEL__],
+ [GNUCC=yes
+ ax_c_compiler_version_gcc="`$CC --dumpversion`"],
+ [GNUCC=no])
AC_MSG_CHECKING([GNUCC])
AC_MSG_RESULT([$GNUCC])
AC_MSG_CHECKING([CLANG])
AC_MSG_RESULT([$CLANG])
- AC_CHECK_DECL([__MINGW32__],[
- MINGW=yes
- ax_cv_c_compiler_version_vendor=mingw
- ],[MINGW=no])
+ AC_CHECK_DECL([__MINGW32__],
+ [MINGW=yes
+ ax_c_compiler_version_vendor=mingw],
+ [MINGW=no])
AC_MSG_CHECKING([MINGW])
AC_MSG_RESULT([$MINGW])
- AS_CASE(["$ax_cv_c_compiler_version_vendor"],[
- sun],[ax_c_compiler_version=`$CC -V 2>&1 | sed 1q`],[
- intel],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],[
- clang],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],[
- gnu],[ax_c_compiler_version=`$CC --version | sed 1q`],[
- mingw],[ax_c_compiler_version=`$CC --version | sed 1q`],[
- ax_c_compiler_version=unknown])
+ AS_CASE(["$ax_c_compiler_version_vendor"],
+ [sun],[ax_c_compiler_version="`$CC -V 2>&1 | sed 1q`"],
+ [intel],[ax_c_compiler_version="`$CC --version 2>&1 | sed 1q`"],
+ [clang],[ax_c_compiler_version="`$CC --version 2>&1 | sed 1q`"],
+ [gnu],[ax_c_compiler_version="`$CC --version | sed 1q`"],
+ [mingw],[ax_c_compiler_version="`$CC --version | sed 1q`"],
+ [ax_c_compiler_version=unknown])
AC_MSG_RESULT(["$ax_c_compiler_version"])
- AC_SUBST([CC_VERSION_VENDOR],["$ax_cv_c_compiler_version_vendor"])
+ AC_SUBST([CC_VERSION_VENDOR],["$ax_c_compiler_version_vendor"])
AC_SUBST([CC_VERSION],["$ax_c_compiler_version"])
+
+ AS_IF([test "$GCC" = "yes"],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 2))
+# error GCC is Too Old!
+#endif
+ ]])],
+ [ac_c_gcc_recent=yes],
+ [ac_c_gcc_recent=no])])
])
- AC_DEFUN([AX_CXX_COMPILER_VERSION],[
- AC_REQUIRE([AX_C_COMPILER_VERSION])
+ AC_DEFUN([AX_CXX_COMPILER_VERSION],
+ [AC_REQUIRE([AX_C_COMPILER_VERSION])
AC_MSG_CHECKING([C++ Compiler version])
- AS_CASE(["$ax_cv_c_compiler_version_vendor"],[
- sun],[ax_cxx_compiler_version=`$CC -V 2>&1 | sed 1q`],[
- intel],[ax_cxx_compiler_version=`$CC --version 2>&1 | sed 1q`],[
- clang],[ax_cxx_compiler_version=`$CC --version 2>&1 | sed 1q`],[
- gnu],[ax_cxx_compiler_version=`$CC --version | sed 1q`],[
- mingw],[ax_cxx_compiler_version=`$CC --version | sed 1q`],[
- ax_cxx_compiler_version=unknown])
+ AS_CASE(["$ax_c_compiler_version_vendor"],
+ [sun],[ax_cxx_compiler_version="`$CC -V 2>&1 | sed 1q`"],
+ [intel],[ax_cxx_compiler_version="`$CC --version 2>&1 | sed 1q`"],
+ [clang],[ax_cxx_compiler_version="`$CC --version 2>&1 | sed 1q`"],
+ [gnu],[ax_cxx_compiler_version="`$CC --version | sed 1q`"],
+ [mingw],[ax_cxx_compiler_version="`$CC --version | sed 1q`"],
+ [ax_cxx_compiler_version=unknown])
AC_MSG_RESULT(["$ax_cxx_compiler_version"])
- AC_SUBST([CXX_VERSION_VENDOR],["$ax_cv_c_compiler_version_vendor"])
+ AC_SUBST([CXX_VERSION_VENDOR],["$ax_c_compiler_version_vendor"])
AC_SUBST([CXX_VERSION],["$ax_cxx_compiler_version"])
])
#
# SYNOPSIS
#
-# AX_ENDIAN
+# AX_ENDIAN()
#
# DESCRIPTION
#
AC_DEFUN([AX_APPEND_LINK_FLAGS_ERROR],
[AC_PREREQ([2.63])dnl
- AX_APPEND_LINK_FLAGS([$1],[LIB],[-Werror])])
+ AX_APPEND_LINK_FLAGS([$1],[LIB],[-Werror])
+ ])
AC_DEFUN([AX_APPEND_COMPILE_FLAGS_ERROR],
[AC_PREREQ([2.63])dnl
- AX_APPEND_COMPILE_FLAGS([$1])])
+ AX_APPEND_COMPILE_FLAGS([$1],,[-Werror])
+ ])
AC_DEFUN([AX_HARDEN_LINKER_FLAGS],
[AC_PREREQ([2.63])dnl
- AC_REQUIRE([AX_CHECK_LINK_FLAG])
- AC_REQUIRE([AX_VCS_CHECKOUT])
- AC_REQUIRE([AX_DEBUG])
+ AC_REQUIRE([AX_APPEND_LINK_FLAGS])
AC_REQUIRE([AX_CXX_COMPILER_VERSION])
+ AC_REQUIRE([AX_DEBUG])
+ AC_REQUIRE([AX_VCS_CHECKOUT])
+
AX_APPEND_LINK_FLAGS_ERROR([-z relro -z now])
AX_APPEND_LINK_FLAGS_ERROR([-pie])
+
AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[AX_APPEND_LINK_FLAGS_ERROR([-Werror])])
])
AC_DEFUN([AX_HARDEN_CC_COMPILER_FLAGS],
[AC_PREREQ([2.63])dnl
- AC_LANG_PUSH([C])dnl
- AC_REQUIRE([AX_APPEND_COMPILE_FLAGS_ERROR])
- AC_REQUIRE([AX_HARDEN_LINKER_FLAGS])
+ AC_REQUIRE([AX_APPEND_LINK_FLAGS])
+ AC_REQUIRE([AX_CXX_COMPILER_VERSION])
+ AC_REQUIRE([AX_DEBUG])
+ AC_REQUIRE([AX_VCS_CHECKOUT])
- ac_cv_warnings_as_errors=no
- AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
- [AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])
- ac_cv_warnings_as_errors=yes],
- [AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
+ AC_LANG_PUSH([C])dnl
- AX_APPEND_LINK_FLAGS_ERROR([-g])
+ AX_APPEND_COMPILE_FLAGS_ERROR([-g])
AS_IF([test "x$ax_enable_debug" = xyes],
- [AX_APPEND_LINK_FLAGS_ERROR([-ggdb])
- AX_APPEND_LINK_FLAGS_ERROR([-O0])],
- [AX_APPEND_LINK_FLAGS_ERROR([-O2])])
+ [AX_APPEND_COMPILE_FLAGS_ERROR([-ggdb])
+ AX_APPEND_COMPILE_FLAGS_ERROR([-O0])],
+ [AX_APPEND_COMPILE_FLAGS_ERROR([-O2])])
AX_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])
AX_APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
AX_APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
AX_APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
+ AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
AC_LANG_POP([C])
-])
+ ])
AC_DEFUN([AX_HARDEN_CXX_COMPILER_FLAGS],
[AC_PREREQ([2.63])dnl
- AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
- AC_LANG_PUSH([C++])
+ AC_REQUIRE([AX_APPEND_LINK_FLAGS])
+ AC_REQUIRE([AX_CXX_COMPILER_VERSION])
+ AC_REQUIRE([AX_DEBUG])
+ AC_REQUIRE([AX_VCS_CHECKOUT])
- AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
- [AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])],
- [AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
+ AC_LANG_PUSH([C++])
AX_APPEND_COMPILE_FLAGS_ERROR([-g])
AS_IF([test "x$ax_enable_debug" = xyes],
[AX_APPEND_COMPILE_FLAGS_ERROR([-O0])
AX_APPEND_COMPILE_FLAGS_ERROR([-ggdb])],
- [AX_APPEND_COMPILE_FLAGS_ERROR([-O2])
- AX_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])])
+ [AX_APPEND_COMPILE_FLAGS_ERROR([-O2])])
+
+ AS_IF([test "x$ac_c_gcc_recent" = xyes],
+ [AX_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])])
AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
[AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])
AX_APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
AX_APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
AX_APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
+ AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
AC_LANG_POP([C++])
])
AC_DEFUN([AX_HARDEN_COMPILER_FLAGS],
[AC_PREREQ([2.63])dnl
+ AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
+ AC_REQUIRE([AX_APPEND_LINK_FLAGS])
+ AC_REQUIRE([AX_CXX_COMPILER_VERSION])
+ AC_REQUIRE([AX_DEBUG])
+ AC_REQUIRE([AX_VCS_CHECKOUT])
+
+ AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors],
+ [AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ac_cv_warnings_as_errors=yes],
+ [ac_cv_warnings_as_errors=no])
+ ])
+
+# All of the actual checks happen via these Macros
+ AC_REQUIRE([AX_HARDEN_LINKER_FLAGS])
+ AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
AC_REQUIRE([AX_HARDEN_CXX_COMPILER_FLAGS])
AC_REQUIRE([AX_CC_OTHER_FLAGS])
+
AC_REQUIRE([gl_VISIBILITY])
- AS_IF([test -n "$CFLAG_VISIBILITY"],[ CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY" ])
+ AS_IF([test -n "$CFLAG_VISIBILITY"],[CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"])
])
AC_DEFUN([AX_CC_OTHER_FLAGS],
[AC_PREREQ([2.63])dnl
AC_REQUIRE([AX_APPEND_COMPILE_FLAGS_ERROR])
AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
+
AC_LANG_PUSH([C])
AX_APPEND_COMPILE_FLAGS_ERROR([-pipe])
AC_LANG_POP([C])
#
# SYNOPSIS
#
-# AX_LIBEVENT(), AX_LIBEVENT2()
+# AX_LIBEVENT(), AX_LIBEVENT2(), AX_LIBEVENT2_EVHTTP()
#
# DESCRIPTION
#
#serial 2
- AC_DEFUN([AX_LIBEVENT],[
- AC_CACHE_CHECK([test for a working libevent], [ax_cv_libevent], [
- AX_SAVE_FLAGS
- LIBS="-levent $LIBS"
- AC_LANG_PUSH([C])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([
+AC_DEFUN([AX_LIBEVENT],
+ [AC_PREREQ([2.63])dnl
+ AC_CACHE_CHECK([test for a working libevent], [ax_cv_libevent], [
+ AX_SAVE_FLAGS
+ LIBS="-levent $LIBS"
+ AC_LANG_PUSH([C])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/time.h>
#include <stdlib.h>
#include <event.h>
- ], [
- struct event_base *tmp_event= event_init();
- event_base_free(tmp_event);
- ])],
- [ax_cv_libevent=yes],
- [ax_cv_libevent=no],
- [AC_MSG_WARN([test program execution failed])])
- AC_LANG_POP
- AX_RESTORE_FLAGS
- ])
+ ], [
+ struct event_base *tmp_event= event_init();
+ event_base_free(tmp_event);
+ ])],
+ [ax_cv_libevent=yes],
+ [ax_cv_libevent=no],
+ [AC_MSG_WARN([test program execution failed])])
+ AC_LANG_POP
+ AX_RESTORE_FLAGS
+ ])
- AS_IF([test "x$ax_cv_libevent" = "xyes"],[
+ AS_IF([test "x$ax_cv_libevent" = "xyes"],[
LIBEVENT_LDFLAGS="-levent"
AC_SUBST(LIBEVENT_LDFLAGS)
AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],[
AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])
])
- AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes")
- ])
+ AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes")
+ ])
AC_DEFUN([AX_LIBEVENT2],[
AC_REQUIRE([AX_LIBEVENT])
#include <sys/time.h>
#include <stdlib.h>
#include <event2/event.h>
-#include <event2/http.h>
- ], [
+ ],[
struct event_base *tmp_event= event_init();
event_base_free(tmp_event);
])],
AM_CONDITIONAL(HAVE_LIBEVENT2, test "x$ax_cv_libevent2" = "xyes")
])
+ AC_DEFUN([AX_LIBEVENT2_EVHTTP],[
+ AC_REQUIRE([AX_LIBEVENT2])
+ AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp], [
+ AX_SAVE_FLAGS
+ LIBS="-levent $LIBS"
+ AC_LANG_PUSH([C])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([
+#include <sys/types.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <event2/event.h>
+#include <event2/http.h>
+ ],[
+ struct event_base *libbase= event_base_new();
+ struct evhttp *libsrvr= evhttp_new(libbase);
+ ])],
+ [ax_cv_libevent2_evhttp=yes],
+ [ax_cv_libevent2_evhttp=no],
+ [AC_MSG_WARN([test program execution failed])])
+ AC_LANG_POP
+ AX_RESTORE_FLAGS
+ ])
+
+ AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"],[
+ LIBEVENT2_LDFLAGS="-levent"
+ AC_SUBST(LIBEVENT2_LDFLAGS)
+ AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],[
+ AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])
+ ])
+
+ AM_CONDITIONAL(HAVE_LIBEVENT2_EVHTTP, test "x$ax_cv_libevent2_evhttp" = "xyes")
+ ])
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 18
+#serial 19
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AS_IF([test -d ".hg"],[ac_cv_vcs_system="mercurial"])
AS_IF([test -d ".git"],[ac_cv_vcs_system="git"])
])
+ AC_DEFINE_UNQUOTED([VCS_SYSTEM],["$ac_cv_vcs_system"],[VCS system])
])
AC_DEFUN([AX_VCS_CHECKOUT],
])
AM_CONDITIONAL([IS_VCS_CHECKOUT], [test "x$ac_cv_vcs_checkout" = "xyes"])
- AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"],
- [AC_DEFINE([VCS_CHECKOUT], [1], [Define if the code was built from VCS.])
- ])
+ AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"],[AC_DEFINE([VCS_CHECKOUT],[1],[Define if the code was built from VCS.])],
+ [AC_DEFINE([VCS_CHECKOUT],[0],[Define if the code was built from VCS.])])
])
#
# SYNOPSIS
#
-# AX_CXX_CINTTYPES
+# AX_CXX_CINTTYPES()
#
# DESCRIPTION
#
AC_REQUIRE([AX_CXX_CSTDINT])
AC_CACHE_CHECK([for location of cinttypes], [ac_cv_cxx_cinttypes], [
- save_CXXFLAGS="${CXXFLAGS}"
+ AX_SAVE_FLAGS
CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
AC_LANG_PUSH([C++])
[ac_cxx_cinttypes_boost_cinttypes_hpp="<boost/cinttypes.hpp>"])
AC_LANG_POP
- CXXFLAGS="${save_CXXFLAGS}"
+ AX_RESTORE_FLAGS
AS_IF([test -n "$ac_cxx_cinttypes_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_cinttypes],
[test -n "$ac_cxx_cinttypes_tr1_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_tr1_cinttypes],
#
# SYNOPSIS
#
-# AX_CXX_CSTDINT
+# AX_CXX_CSTDINT()
#
# DESCRIPTION
#
AC_CACHE_CHECK([for location of cstdint], [ac_cv_cxx_cstdint], [
AC_LANG_PUSH([C++])
- save_CXXFLAGS="${CXXFLAGS}"
+ AX_SAVE_FLAGS
CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
AC_COMPILE_IFELSE([
[ac_cxx_cstdint_boost_cstdint_hpp="<boost/cstdint.hpp>"])
AC_LANG_POP
- CXXFLAGS="${save_CXXFLAGS}"
+ AX_RESTORE_FLAGS
AS_IF([test -n "$ac_cxx_cstdint_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_cstdint],
[test -n "$ac_cxx_cstdint_tr1_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_tr1_cstdint],
[test -n "$ac_cxx_cstdint_boost_cstdint_hpp"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_boost_cstdint_hpp])
])
- AS_IF([test -n "$ac_cv_cxx_cstdint"], [
- AC_MSG_RESULT([$ac_cv_cxx_cstdint])
- ],[
+ AS_IF([test -n "$ac_cv_cxx_cstdint"], [AC_MSG_RESULT([$ac_cv_cxx_cstdint])], [
ac_cv_cxx_cstdint="<stdint.h>"
AC_MSG_WARN([Could not find a cstdint header.])
AC_MSG_RESULT([$ac_cv_cxx_cstdint])