From: Brian Aker Date: Tue, 11 Sep 2012 11:03:54 +0000 (-0400) Subject: Update autoconf macros X-Git-Tag: 1.0.11~1^2~3 X-Git-Url: https://git.m6w6.name/?p=awesomized%2Flibmemcached;a=commitdiff_plain;h=f3b89b9159152927ca1c547ef30c892bfba05e19 Update autoconf macros --- diff --git a/m4/ax_pthread_timedjoin_np.m4 b/m4/ax_pthread_timedjoin_np.m4 index 833b2846..a0e6c253 100644 --- a/m4/ax_pthread_timedjoin_np.m4 +++ b/m4/ax_pthread_timedjoin_np.m4 @@ -4,7 +4,7 @@ # # SYNOPSIS # -# AX_LIB_UUID +# AX_PTHREAD_TIMEDJOIN_NP # # DESCRIPTION # @@ -19,30 +19,37 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 2 +#serial 3 AC_DEFUN([AX_PTHREAD_TIMEDJOIN_NP], [ - AC_CACHE_CHECK([check for pthread_timedjoin_np], [ax_cv_pthread_timedjoin_np], [ - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$PTHREAD_LIBS" - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([ -#include - ], [ - uuid_t out; - pthread_timedjoin_np(out); - ]), [ax_cv_pthread_timedjoin_np=yes ], [ax_cv_pthread_timedjoin_np=no ] - ]) + AC_REQUIRE([AX_PTHREAD]) + AC_CACHE_CHECK([check for pthread_timedjoin_np], [ax_cv_pthread_timedjoin_np], [ + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$PTHREAD_LIBS" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif - AC_LANG_POP - LDFLAGS="$save_LDFLAGS" +#include +#include + ], [ + pthread_t thread; + pthread_timedjoin_np(thread, NULL); + ])], + [ax_cv_pthread_timedjoin_np=yes], + []) - ]) + AC_LANG_POP + LDFLAGS="$save_LDFLAGS" - AS_IF([test "$ax_cv_pthread_timedjoin_np" = yes],[ - AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[1],[Define if pthread_timedjoin_np is present in pthread.h.])],[ - AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[0],[Define if pthread_timedjoin_np is present in pthread.h.]) - ]) -]) + ]) + + AS_IF([test "$ax_cv_pthread_timedjoin_np" = yes],[ + AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[1],[Define if pthread_timedjoin_np is present in pthread.h.])],[ + AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[0],[Define if pthread_timedjoin_np is present in pthread.h.]) + ]) + ]) diff --git a/m4/check_sock_cloexec.m4 b/m4/check_sock_cloexec.m4 index 30587745..6936ab40 100644 --- a/m4/check_sock_cloexec.m4 +++ b/m4/check_sock_cloexec.m4 @@ -1,18 +1,26 @@ -dnl CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found]) -AC_DEFUN([AX_CHECK_SOCK_CLOEXEC], [{ - AC_MSG_CHECKING(whether SOCK_CLOEXEC is supported) - AC_TRY_RUN([/* SOCK_CLOEXEC test */ +# Author? +# AX_CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found]) +# + +#serial 1 + +AC_DEFUN([AX_CHECK_SOCK_CLOEXEC], [ + AC_CACHE_CHECK([whether SOCK_CLOEXEC is supported], [ax_cv_sock_cloexec], [ + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ + + /* SOCK_CLOEXEC test */ #include #include -int main (int argc, char *argv []) -{ - int s= socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); - return (s == -1); -} - ], - [AC_MSG_RESULT(yes) ; ax_cv_sock_cloexec="yes" ; $1], - [AC_MSG_RESULT(no) ; ax_cv_sock_cloexec="no" ; $2], - [AC_MSG_RESULT(not during cross-compile) ; ax_cv_sock_cloexec="no"] - ) -}]) + ], [ + int s= socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); + return (s == -1); + ])], + [ax_cv_sock_cloexec=yes], + [ax_cv_sock_cloexec=no]) + ]) + + AS_IF([test x"ax_cv_sock_cloexec" = xyes], [AC_MSG_RESULT([yes]) ; $1], AC_MSG_RESULT([no]) ; $2) + ]) diff --git a/m4/have_cinttypes.m4 b/m4/have_cinttypes.m4 index bcfea1c3..6d03cf5d 100644 --- a/m4/have_cinttypes.m4 +++ b/m4/have_cinttypes.m4 @@ -40,47 +40,54 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 1 +#serial 2 - -AC_DEFUN([AX_CXX_CINTTYPES], - [ +AC_DEFUN([AX_CXX_CINTTYPES], [ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) AC_REQUIRE([AX_CXX_CSTDINT]) - AC_MSG_CHECKING(the location of cinttypes) - save_CXXFLAGS="${CXXFLAGS}" - CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" - ac_cv_cxx_cinttypes="" - AC_LANG_PUSH([C++]) -# AC_CACHE_CHECK([for location of cinttypes], [ac_cv_cxx_cinttypes], -# [ -# Look for cinttypes - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ uint32_t foo= UINT32_C(1) ])], - [ac_cv_cxx_cinttypes=""], - [ + AC_CACHE_CHECK([for location of cinttypes], [ac_cv_cxx_cinttypes], [ + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" + AC_LANG_PUSH([C++]) + + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ + uint32_t foo= UINT32_C(1); + ])], + [ac_cxx_cinttypes_cinttypes=""]) + # Look for tr1/cinttypes - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ uint32_t foo= UINT32_C(1) ])], - [ac_cv_cxx_cinttypes=""], - [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ + uint32_t foo= UINT32_C(1); + ])], + [ac_cxx_cinttypes_tr1_cinttypes=""]) + # Look for boost/cinttypes.hpp - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ uint32_t foo= UINT32_C(1) ])], - [ac_cv_cxx_cinttypes=""]) - ]) - ]) -# ]) - AC_LANG_POP() + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ + uint32_t foo= UINT32_C(1); + ])], + [ac_cxx_cinttypes_boost_cinttypes_hpp=""]) + + AC_LANG_POP + CXXFLAGS="${save_CXXFLAGS}" + + 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], + [test -n "$ac_cxx_cinttypes_boost_cinttypes_hpp"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_boost_cinttypes_hpp]) + ]) - CXXFLAGS="${save_CXXFLAGS}" - if test -n "$ac_cv_cxx_cinttypes"; then - AC_MSG_RESULT([$ac_cv_cxx_cinttypes]) - else - ac_cv_cxx_cinttypes="" - AC_MSG_WARN([Could not find a cinttypes header.]) - AC_MSG_RESULT([$ac_cv_cxx_cinttypes]) - fi + AS_IF([ test -n "$ac_cv_cxx_cinttypes"], [ + AC_MSG_RESULT([$ac_cv_cxx_cinttypes]) + ],[ + ac_cv_cxx_cinttypes="" + AC_MSG_WARN([Could not find a cinttypes header.]) + AC_MSG_RESULT([$ac_cv_cxx_cinttypes]) + ]) AC_DEFINE([__STDC_LIMIT_MACROS],[1],[Use STDC Limit Macros in C++]) - AC_DEFINE_UNQUOTED(CINTTYPES_H,$ac_cv_cxx_cinttypes, [the location of ]) + AC_DEFINE_UNQUOTED([CINTTYPES_H],[$ac_cv_cxx_cinttypes],[the location of ]) ]) diff --git a/m4/have_cstdint.m4 b/m4/have_cstdint.m4 index ef084352..685d4ade 100644 --- a/m4/have_cstdint.m4 +++ b/m4/have_cstdint.m4 @@ -40,50 +40,46 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 1 +#serial 2 -AC_DEFUN([AX_CXX_CSTDINT], - [ +AC_DEFUN([AX_CXX_CSTDINT], [ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) - AC_MSG_CHECKING(the location of cstdint) - AC_LANG_PUSH([C++]) - save_CXXFLAGS="${CXXFLAGS}" - CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" - ac_cv_cxx_cstdint="" + AC_CACHE_CHECK([for location of cstdint], [ac_cv_cxx_cstdint], [ + AC_LANG_PUSH([C++]) + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" - AC_LANG_PUSH([C++]) -# AC_CACHE_CHECK([for location of cstdint], [ac_cv_cxx_cstdint], -# [ -# Look for cstdint - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ uint32_t t ])], - [ac_cv_cxx_cstdint=""], - [ -# Look for tr1/cstdint - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ uint32_t t ])], - [ac_cv_cxx_cstdint=""], - [ -# Look for boost/cstdint.hpp - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ uint32_t t ])], - [ac_cv_cxx_cstdint=""]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ uint32_t t ])], + [ac_cxx_cstdint_cstdint=""]) - ]) - ]) -# ]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ uint32_t t ])], + [ac_cxx_cstdint_tr1_cstdint=""]) - AC_LANG_POP() + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ uint32_t t ])], + [ac_cxx_cstdint_boost_cstdint_hpp=""]) - CXXFLAGS="${save_CXXFLAGS}" - if test -n "$ac_cv_cxx_cstdint"; then - AC_MSG_RESULT([$ac_cv_cxx_cstdint]) - else - ac_cv_cxx_cstdint="" - AC_MSG_WARN([Could not find a cstdint header.]) - AC_MSG_RESULT([$ac_cv_cxx_cstdint]) - fi + AC_LANG_POP + CXXFLAGS="${save_CXXFLAGS}" - AC_DEFINE_UNQUOTED(CSTDINT_H,$ac_cv_cxx_cstdint, [the location of ]) + 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]) + ],[ + ac_cv_cxx_cstdint="" + AC_MSG_WARN([Could not find a cstdint header.]) + AC_MSG_RESULT([$ac_cv_cxx_cstdint]) + ]) + +AC_DEFINE_UNQUOTED([CSTDINT_H],[$ac_cv_cxx_cstdint], [the location of ]) ]) diff --git a/m4/uuid.m4 b/m4/uuid.m4 index 9fc0cf33..1122bb49 100644 --- a/m4/uuid.m4 +++ b/m4/uuid.m4 @@ -4,7 +4,8 @@ # # SYNOPSIS # -# AX_LIB_UUID +# AX_UUID +# AX_UUID_GENERATE_TIME_SAFE # # DESCRIPTION # @@ -19,25 +20,66 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 2 +#serial 3 -AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], [ - AC_CACHE_CHECK([check for uuid_generate_time_safe], [ax_cv_uuid_generate_time_safe], [ - save_LDFLAGS="$LDFLAGS" - LDFLAGS="-luuid" - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([ -#include - ], [ - uuid_t out; - uuid_generate_time_safe(out); - ]), [ax_cv_uuid_generate_time_safe=yes ], [ax_cv_uuid_generate_time_safe=no ] +AC_DEFUN([AX_UUID], [ + AC_CHECK_HEADER([uuid/uuid.h], [ + AC_CACHE_CHECK([check to see if we need -luuid], [ax_cv_libuuid_is_required], [ + save_LDFLAGS="$LDFLAGS" + LDFLAGS="-luuid" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([#include ], [ + uuid_t out; + uuid_generate(out); + ])], + [ax_cv_libuuid_is_required=yes], + []) + AC_LANG_POP + LDFLAGS="$save_LDFLAGS" + ]) + AS_IF([test x"ax_cv_libuuid_is_required" = xyes], [ + LIBUUID_LDFLAGS="-luuid" + UUID_UUID_H=yes + ],[ + AC_CACHE_CHECK([check to see if -luuid is not needed], [ax_cv_libuuid_is_not_required], [ + AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ + uuid_t out; + uuid_generate(out); + ])], + [ax_cv_libuuid_is_not_required=yes], + [ax_cv_libuuid_is_not_required=no]) + AC_LANG_POP + ]) + AS_IF([test x"ax_cv_libuuid_is_not_required" = xyes], [UUID_UUID_H=yes], [UUID_UUID_H=]) + ]) + ], [UUID_UUID_H=]) + +AS_IF([test x"$UUID_UUID_H" = xyes], [ + AC_DEFINE([HAVE_UUID_UUID_H], [ 1 ], [Have uuid/uuid.h]) + ],[ + AC_DEFINE([HAVE_UUID_UUID_H], [ 0 ], [Have uuid/uuid.h]) ]) +]) - AC_LANG_POP - LDFLAGS="$save_LDFLAGS" - ]) +AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], [ + AC_REQUIRE([AX_UUID]) + AC_CACHE_CHECK([for uuid_generate_time_safe], [ax_cv_uuid_generate_time_safe], [ + save_LDFLAGS="$LDFLAGS" + LDFLAGS=$LIBUUID_LDFLAGS + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([#include ], [ + uuid_t out; + uuid_generate_time_safe(out); + ])], + [ax_cv_uuid_generate_time_safe=yes], + [ax_cv_uuid_generate_time_safe=no]) + AC_LANG_POP + LDFLAGS="$save_LDFLAGS" + ]) AS_IF([test "$ax_cv_uuid_generate_time_safe" = yes],[ AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE,[1],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])],[