Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcbd5154

Browse files
committed
Replace obsolete AC_LANG_FUNC_LINK_TRY autoconf macro.
The version of this macro used in autoconf 2.59 is capable of incorrectlysucceeding (ie, reporting that a library function is available when itisn't), if the compiler performs link-time optimization and decides thatit can optimize the function reference away entirely. Replace it with thecoding used in autoconf 2.61 and later, which forces the program result todepend on the function's result so that it cannot be optimized away. Thisshould fix build failures currently being seen on buildfarm member anchovy.This patch affects the 8.2 and 8.3 branches only, since later branches areusing autoconf versions that don't have this problem.
1 parenta2d9f94 commitcbd5154

File tree

2 files changed

+298
-325
lines changed

2 files changed

+298
-325
lines changed

‎config/c-library.m4

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,72 @@ int main()
297297
])dnl AC_CACHE_VAL
298298
AC_MSG_RESULT([$pgac_cv_printf_arg_control])
299299
])# PGAC_FUNC_PRINTF_ARG_CONTROL
300+
301+
302+
# backport improved FUNC_LINK_TRY test from Autoconf 2.61, cf
303+
# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=f50d0bd4c7d92fbabcd9169920a23889524790e7
304+
# This is needed to avoid incorrect results when compiler does link-time
305+
# optimization.
306+
307+
# AC_LANG_CALL(C)(PROLOGUE, FUNCTION)
308+
# -----------------------------------
309+
# Avoid conflicting decl of main.
310+
m4_define([AC_LANG_CALL(C)],
311+
[AC_LANG_PROGRAM([$1
312+
m4_if([$2],[main], ,
313+
[/* Override any GCC internal prototype to avoid an error.
314+
Use char because int might match the return type of a GCC
315+
builtin and then its argument prototype would still apply. */
316+
#ifdef __cplusplus
317+
extern "C"
318+
#endif
319+
char$2 ();])],[return$2 ();])])
320+
321+
322+
# AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
323+
# ----------------------------------
324+
# Don't include <ctype.h> because on OSF/1 3.0 it includes
325+
# <sys/types.h> which includes <sys/select.h> which contains a
326+
# prototype for select. Similarly for bzero.
327+
#
328+
# This test used to merely assign f=$1 in main(), but that was
329+
# optimized away by HP unbundled cc A.05.36 for ia64 under +O3,
330+
# presumably on the basis that there's no need to do that store if the
331+
# program is about to exit. Conversely, the AIX linker optimizes an
332+
# unused external declaration that initializes f=$1. So this test
333+
# program has both an external initialization of f, and a use of f in
334+
# main that affects the exit status.
335+
#
336+
m4_define([AC_LANG_FUNC_LINK_TRY(C)],
337+
[AC_LANG_PROGRAM(
338+
[/* Define$1 to an innocuous variant, in case <limits.h> declares$1.
339+
For example, HP-UX 11i <limits.h> declares gettimeofday. */
340+
#define$1 innocuous_$1
341+
342+
/* System header to define __stub macros and hopefully few prototypes,
343+
which can conflict with char$1 (); below.
344+
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
345+
<limits.h> exists even on freestanding compilers. */
346+
347+
#ifdef __STDC__
348+
# include <limits.h>
349+
#else
350+
# include <assert.h>
351+
#endif
352+
353+
#undef$1
354+
355+
/* Override any GCC internal prototype to avoid an error.
356+
Use char because int might match the return type of a GCC
357+
builtin and then its argument prototype would still apply. */
358+
#ifdef __cplusplus
359+
extern "C"
360+
#endif
361+
char$1 ();
362+
/* The GNU C library defines this for functions which it implements
363+
to always fail with ENOSYS. Some functions are actually named
364+
something starting with __ and the normal name is an alias. */
365+
#if defined __stub_$1 || defined __stub___$1
366+
choke me
367+
#endif
368+
],[return$1 ();])])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp