version 1.1.1.1, 2012/02/21 22:57:49
|
version 1.1.1.2, 2012/05/29 09:29:44
|
Line 1
|
Line 1
|
# gnulib-common.m4 serial 11 | # gnulib-common.m4 serial 29 |
dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. | dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. |
dnl This file is free software; the Free Software Foundation |
dnl This file is free software; the Free Software Foundation |
dnl gives unlimited permission to copy and/or distribute it, |
dnl gives unlimited permission to copy and/or distribute it, |
dnl with or without modifications, as long as this notice is preserved. |
dnl with or without modifications, as long as this notice is preserved. |
Line 12 AC_DEFUN([gl_COMMON], [
|
Line 12 AC_DEFUN([gl_COMMON], [
|
AC_REQUIRE([gl_COMMON_BODY]) |
AC_REQUIRE([gl_COMMON_BODY]) |
]) |
]) |
AC_DEFUN([gl_COMMON_BODY], [ |
AC_DEFUN([gl_COMMON_BODY], [ |
|
AH_VERBATIM([_Noreturn], |
|
[/* The _Noreturn keyword of draft C1X. */ |
|
#ifndef _Noreturn |
|
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ |
|
|| 0x5110 <= __SUNPRO_C) |
|
# define _Noreturn __attribute__ ((__noreturn__)) |
|
# elif 1200 <= _MSC_VER |
|
# define _Noreturn __declspec (noreturn) |
|
# else |
|
# define _Noreturn |
|
# endif |
|
#endif |
|
]) |
AH_VERBATIM([isoc99_inline], |
AH_VERBATIM([isoc99_inline], |
[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports |
[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports |
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of |
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of |
Line 23 AC_DEFUN([gl_COMMON_BODY], [
|
Line 36 AC_DEFUN([gl_COMMON_BODY], [
|
# define __GNUC_STDC_INLINE__ 1 |
# define __GNUC_STDC_INLINE__ 1 |
#endif]) |
#endif]) |
AH_VERBATIM([unused_parameter], |
AH_VERBATIM([unused_parameter], |
[/* Define as a marker that can be attached to function parameter declarations | [/* Define as a marker that can be attached to declarations that might not |
for parameters that are not used. This helps to reduce warnings, such as | be used. This helps to reduce warnings, such as from |
from GCC -Wunused-parameter. */ | GCC -Wunused-parameter. */ |
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) |
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) |
# define _UNUSED_PARAMETER_ __attribute__ ((__unused__)) | # define _GL_UNUSED __attribute__ ((__unused__)) |
#else |
#else |
# define _UNUSED_PARAMETER_ | # define _GL_UNUSED |
#endif |
#endif |
|
/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name |
|
is a misnomer outside of parameter lists. */ |
|
#define _UNUSED_PARAMETER_ _GL_UNUSED |
|
|
|
/* The __pure__ attribute was added in gcc 2.96. */ |
|
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) |
|
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
|
#else |
|
# define _GL_ATTRIBUTE_PURE /* empty */ |
|
#endif |
|
|
|
/* The __const__ attribute was added in gcc 2.95. */ |
|
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) |
|
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) |
|
#else |
|
# define _GL_ATTRIBUTE_CONST /* empty */ |
|
#endif |
]) |
]) |
|
dnl Preparation for running test programs: |
|
dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not |
|
dnl to /dev/tty, so they can be redirected to log files. Such diagnostics |
|
dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N. |
|
LIBC_FATAL_STDERR_=1 |
|
export LIBC_FATAL_STDERR_ |
]) |
]) |
|
|
|
# gl_MODULE_INDICATOR_CONDITION |
|
# expands to a C preprocessor expression that evaluates to 1 or 0, depending |
|
# whether a gnulib module that has been requested shall be considered present |
|
# or not. |
|
m4_define([gl_MODULE_INDICATOR_CONDITION], [1]) |
|
|
|
# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) |
|
# sets the shell variable that indicates the presence of the given module to |
|
# a C preprocessor expression that will evaluate to 1. |
|
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], |
|
[ |
|
gl_MODULE_INDICATOR_SET_VARIABLE_AUX( |
|
[GNULIB_[]m4_translit([[$1]], |
|
[abcdefghijklmnopqrstuvwxyz./-], |
|
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], |
|
[gl_MODULE_INDICATOR_CONDITION]) |
|
]) |
|
|
|
# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable]) |
|
# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION. |
|
# The shell variable's value is a C preprocessor expression that evaluates |
|
# to 0 or 1. |
|
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX], |
|
[ |
|
m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1], |
|
[ |
|
dnl Simplify the expression VALUE || 1 to 1. |
|
$1=1 |
|
], |
|
[gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1], |
|
[gl_MODULE_INDICATOR_CONDITION])]) |
|
]) |
|
|
|
# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition]) |
|
# modifies the shell variable to include the given condition. The shell |
|
# variable's value is a C preprocessor expression that evaluates to 0 or 1. |
|
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR], |
|
[ |
|
dnl Simplify the expression 1 || CONDITION to 1. |
|
if test "$[]$1" != 1; then |
|
dnl Simplify the expression 0 || CONDITION to CONDITION. |
|
if test "$[]$1" = 0; then |
|
$1=$2 |
|
else |
|
$1="($[]$1 || $2)" |
|
fi |
|
fi |
|
]) |
|
|
# gl_MODULE_INDICATOR([modulename]) |
# gl_MODULE_INDICATOR([modulename]) |
# defines a C macro indicating the presence of the given module. | # defines a C macro indicating the presence of the given module |
| # in a location where it can be used. |
| # | Value | Value | |
| # | in lib/ | in tests/ | |
| # --------------------------------------------+---------+-----------+ |
| # Module present among main modules: | 1 | 1 | |
| # --------------------------------------------+---------+-----------+ |
| # Module present among tests-related modules: | 0 | 1 | |
| # --------------------------------------------+---------+-----------+ |
| # Module not present at all: | 0 | 0 | |
| # --------------------------------------------+---------+-----------+ |
AC_DEFUN([gl_MODULE_INDICATOR], |
AC_DEFUN([gl_MODULE_INDICATOR], |
[ |
[ |
AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], | AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]], |
[Define to 1 when using the gnulib module ]$1[.]) | [abcdefghijklmnopqrstuvwxyz./-], |
| [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), |
| [gl_MODULE_INDICATOR_CONDITION], |
| [Define to a C preprocessor expression that evaluates to 1 or 0, |
| depending whether the gnulib module $1 shall be considered present.]) |
]) |
]) |
|
|
|
# gl_MODULE_INDICATOR_FOR_TESTS([modulename]) |
|
# defines a C macro indicating the presence of the given module |
|
# in lib or tests. This is useful to determine whether the module |
|
# should be tested. |
|
# | Value | Value | |
|
# | in lib/ | in tests/ | |
|
# --------------------------------------------+---------+-----------+ |
|
# Module present among main modules: | 1 | 1 | |
|
# --------------------------------------------+---------+-----------+ |
|
# Module present among tests-related modules: | 1 | 1 | |
|
# --------------------------------------------+---------+-----------+ |
|
# Module not present at all: | 0 | 0 | |
|
# --------------------------------------------+---------+-----------+ |
|
AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], |
|
[ |
|
AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]], |
|
[abcdefghijklmnopqrstuvwxyz./-], |
|
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], |
|
[Define to 1 when the gnulib module $1 should be tested.]) |
|
]) |
|
|
|
# gl_ASSERT_NO_GNULIB_POSIXCHECK |
|
# asserts that there will never be a need to #define GNULIB_POSIXCHECK. |
|
# and thereby enables an optimization of configure and config.h. |
|
# Used by Emacs. |
|
AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK], |
|
[ |
|
dnl Override gl_WARN_ON_USE_PREPARE. |
|
dnl But hide this definition from 'aclocal'. |
|
AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], []) |
|
]) |
|
|
|
# gl_ASSERT_NO_GNULIB_TESTS |
|
# asserts that there will be no gnulib tests in the scope of the configure.ac |
|
# and thereby enables an optimization of config.h. |
|
# Used by Emacs. |
|
AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS], |
|
[ |
|
dnl Override gl_MODULE_INDICATOR_FOR_TESTS. |
|
AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], []) |
|
]) |
|
|
|
# Test whether <features.h> exists. |
|
# Set HAVE_FEATURES_H. |
|
AC_DEFUN([gl_FEATURES_H], |
|
[ |
|
AC_CHECK_HEADERS_ONCE([features.h]) |
|
if test $ac_cv_header_features_h = yes; then |
|
HAVE_FEATURES_H=1 |
|
else |
|
HAVE_FEATURES_H=0 |
|
fi |
|
AC_SUBST([HAVE_FEATURES_H]) |
|
]) |
|
|
# m4_foreach_w |
# m4_foreach_w |
# is a backport of autoconf-2.59c's m4_foreach_w. |
# is a backport of autoconf-2.59c's m4_foreach_w. |
# Remove this macro when we can assume autoconf >= 2.60. |
# Remove this macro when we can assume autoconf >= 2.60. |
Line 49 m4_ifndef([m4_foreach_w],
|
Line 203 m4_ifndef([m4_foreach_w],
|
[m4_define([m4_foreach_w], |
[m4_define([m4_foreach_w], |
[m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) |
[m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) |
|
|
|
# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) |
|
# ---------------------------------------------------- |
|
# Backport of autoconf-2.63b's macro. |
|
# Remove this macro when we can assume autoconf >= 2.64. |
|
m4_ifndef([AS_VAR_IF], |
|
[m4_define([AS_VAR_IF], |
|
[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) |
|
|
|
# gl_PROG_AR_RANLIB |
|
# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler. |
|
AC_DEFUN([gl_PROG_AR_RANLIB], |
|
[ |
|
dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler |
|
dnl as "cc", and GCC as "gcc". They have different object file formats and |
|
dnl library formats. In particular, the GNU binutils programs ar, ranlib |
|
dnl produce libraries that work only with gcc, not with cc. |
|
AC_REQUIRE([AC_PROG_CC]) |
|
AC_EGREP_CPP([Amsterdam], |
|
[ |
|
#ifdef __ACK__ |
|
Amsterdam |
|
#endif |
|
], |
|
[AR='cc -c.a' |
|
ARFLAGS='-o' |
|
RANLIB=':' |
|
], |
|
[dnl Use the Automake-documented default values for AR and ARFLAGS. |
|
AR='ar' |
|
ARFLAGS='cru' |
|
dnl Use the ranlib program if it is available. |
|
AC_PROG_RANLIB |
|
]) |
|
AC_SUBST([AR]) |
|
AC_SUBST([ARFLAGS]) |
|
]) |
|
|
# AC_PROG_MKDIR_P |
# AC_PROG_MKDIR_P |
# is a backport of autoconf-2.60's AC_PROG_MKDIR_P. | # is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix |
# Remove this macro when we can assume autoconf >= 2.60. | # for interoperability with automake-1.9.6 from autoconf-2.62. |
m4_ifdef([AC_PROG_MKDIR_P], [], [ | # Remove this macro when we can assume autoconf >= 2.62 or |
| # autoconf >= 2.60 && automake >= 1.10. |
| m4_ifdef([AC_PROG_MKDIR_P], [ |
| dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. |
| m4_define([AC_PROG_MKDIR_P], |
| m4_defn([AC_PROG_MKDIR_P])[ |
| AC_SUBST([MKDIR_P])])], [ |
| dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. |
AC_DEFUN_ONCE([AC_PROG_MKDIR_P], |
AC_DEFUN_ONCE([AC_PROG_MKDIR_P], |
[AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake |
[AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake |
MKDIR_P='$(mkdir_p)' |
MKDIR_P='$(mkdir_p)' |
Line 63 m4_ifdef([AC_PROG_MKDIR_P], [], [
|
Line 261 m4_ifdef([AC_PROG_MKDIR_P], [], [
|
# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ |
# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ |
# works. |
# works. |
# This definition can be removed once autoconf >= 2.62 can be assumed. |
# This definition can be removed once autoconf >= 2.62 can be assumed. |
|
m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[ |
AC_DEFUN([AC_C_RESTRICT], |
AC_DEFUN([AC_C_RESTRICT], |
[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], |
[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], |
[ac_cv_c_restrict=no |
[ac_cv_c_restrict=no |
Line 70 AC_DEFUN([AC_C_RESTRICT],
|
Line 269 AC_DEFUN([AC_C_RESTRICT],
|
for ac_kw in __restrict __restrict__ _Restrict restrict; do |
for ac_kw in __restrict __restrict__ _Restrict restrict; do |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
[[typedef int * int_ptr; |
[[typedef int * int_ptr; |
int foo (int_ptr $ac_kw ip) { | int foo (int_ptr $ac_kw ip) { |
return ip[0]; | return ip[0]; |
}]], |
}]], |
[[int s[1]; |
[[int s[1]; |
int * $ac_kw t = s; | int * $ac_kw t = s; |
t[0] = 0; | t[0] = 0; |
return foo(t)]])], | return foo(t)]])], |
[ac_cv_c_restrict=$ac_kw]) |
[ac_cv_c_restrict=$ac_kw]) |
test "$ac_cv_c_restrict" != no && break |
test "$ac_cv_c_restrict" != no && break |
done |
done |
Line 99 AC_DEFUN([AC_C_RESTRICT],
|
Line 298 AC_DEFUN([AC_C_RESTRICT],
|
no) AC_DEFINE([restrict], []) ;; |
no) AC_DEFINE([restrict], []) ;; |
*) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; |
*) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; |
esac |
esac |
|
]) |
]) |
]) |
|
|
# gl_BIGENDIAN |
# gl_BIGENDIAN |