annotate m4/gnulib-common.m4 @ 448:5cccf90bf838 3.0 tip

Fixed bug with complex external references generating invalid relocations in the object file
author lost@l-w.ca
date Fri, 05 Nov 2010 22:27:00 -0600
parents b8bf63962a99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
434
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
1 # gnulib-common.m4 serial 11
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
2 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
6
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
7 # gl_COMMON
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
8 # is expanded unconditionally through gnulib-tool magic.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
9 AC_DEFUN([gl_COMMON], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
10 dnl Use AC_REQUIRE here, so that the code is expanded once only.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
11 AC_REQUIRE([gl_00GNULIB])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
12 AC_REQUIRE([gl_COMMON_BODY])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
13 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
14 AC_DEFUN([gl_COMMON_BODY], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
15 AH_VERBATIM([isoc99_inline],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
16 [/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
17 the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
18 earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
19 __APPLE__ && __MACH__ test for MacOS X.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
20 __APPLE_CC__ tests for the Apple compiler and its version.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
21 __STDC_VERSION__ tests for the C99 mode. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
22 #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
23 # define __GNUC_STDC_INLINE__ 1
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
24 #endif])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
25 AH_VERBATIM([unused_parameter],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
26 [/* Define as a marker that can be attached to declarations that might not
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
27 be used. This helps to reduce warnings, such as from
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
28 GCC -Wunused-parameter. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
29 #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
30 # define _GL_UNUSED __attribute__ ((__unused__))
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
31 #else
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
32 # define _GL_UNUSED
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
33 #endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
34 /* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
35 is a misnomer outside of parameter lists. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
36 #define _UNUSED_PARAMETER_ _GL_UNUSED
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
37 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
38 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
39
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
40 # gl_MODULE_INDICATOR([modulename])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
41 # defines a C macro indicating the presence of the given module.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
42 AC_DEFUN([gl_MODULE_INDICATOR],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
43 [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
44 AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
45 [Define to 1 when using the gnulib module ]$1[.])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
46 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
47
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
48 # m4_foreach_w
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
49 # is a backport of autoconf-2.59c's m4_foreach_w.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
50 # Remove this macro when we can assume autoconf >= 2.60.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
51 m4_ifndef([m4_foreach_w],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
52 [m4_define([m4_foreach_w],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
53 [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
54
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
55 # AC_PROG_MKDIR_P
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
56 # is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
57 # Remove this macro when we can assume autoconf >= 2.60.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
58 m4_ifdef([AC_PROG_MKDIR_P], [], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
59 AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
60 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
61 MKDIR_P='$(mkdir_p)'
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
62 AC_SUBST([MKDIR_P])])])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
63
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
64 # AC_C_RESTRICT
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
65 # This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
66 # so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
67 # works.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
68 # This definition can be removed once autoconf >= 2.62 can be assumed.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
69 AC_DEFUN([AC_C_RESTRICT],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
70 [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
71 [ac_cv_c_restrict=no
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
72 # The order here caters to the fact that C++ does not require restrict.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
73 for ac_kw in __restrict __restrict__ _Restrict restrict; do
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
74 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
75 [[typedef int * int_ptr;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
76 int foo (int_ptr $ac_kw ip) {
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
77 return ip[0];
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
78 }]],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
79 [[int s[1];
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
80 int * $ac_kw t = s;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
81 t[0] = 0;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
82 return foo(t)]])],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
83 [ac_cv_c_restrict=$ac_kw])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
84 test "$ac_cv_c_restrict" != no && break
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
85 done
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
86 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
87 AH_VERBATIM([restrict],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
88 [/* Define to the equivalent of the C99 'restrict' keyword, or to
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
89 nothing if this is not supported. Do not define if restrict is
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
90 supported directly. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
91 #undef restrict
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
92 /* Work around a bug in Sun C++: it does not support _Restrict, even
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
93 though the corresponding Sun C compiler does, which causes
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
94 "#define restrict _Restrict" in the previous line. Perhaps some future
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
95 version of Sun C++ will work with _Restrict; if so, it'll probably
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
96 define __RESTRICT, just as Sun C does. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
97 #if defined __SUNPRO_CC && !defined __RESTRICT
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
98 # define _Restrict
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
99 #endif])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
100 case $ac_cv_c_restrict in
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
101 restrict) ;;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
102 no) AC_DEFINE([restrict], []) ;;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
103 *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
104 esac
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
105 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
106
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
107 # gl_BIGENDIAN
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
108 # is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
109 # Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
110 # macros invoke AC_C_BIGENDIAN with arguments.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
111 AC_DEFUN([gl_BIGENDIAN],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
112 [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
113 AC_C_BIGENDIAN
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
114 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
115
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
116 # gl_CACHE_VAL_SILENT(cache-id, command-to-set-it)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
117 # is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
118 # output a spurious "(cached)" mark in the midst of other configure output.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
119 # This macro should be used instead of AC_CACHE_VAL when it is not surrounded
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
120 # by an AC_MSG_CHECKING/AC_MSG_RESULT pair.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
121 AC_DEFUN([gl_CACHE_VAL_SILENT],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
122 [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
123 saved_as_echo_n="$as_echo_n"
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
124 as_echo_n=':'
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
125 AC_CACHE_VAL([$1], [$2])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
126 as_echo_n="$saved_as_echo_n"
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
127 ])