version 1.1.1.1, 2012/05/29 09:29:44
|
version 1.1.1.2, 2021/03/17 13:38:46
|
Line 1
|
Line 1
|
# warn-on-use.m4 serial 4 | # warn-on-use.m4 serial 6 |
dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. | dnl Copyright (C) 2010-2019 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. |
|
|
# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) |
# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) |
# --------------------------------------- |
# --------------------------------------- |
|
# If the module 'posixcheck' is in use: |
|
# |
# For each whitespace-separated element in the list of NAMES, define |
# For each whitespace-separated element in the list of NAMES, define |
# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES |
# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES |
# even after being undefined as a macro. |
# even after being undefined as a macro. |
Line 18 dnl with or without modifications, as long as this not
|
Line 20 dnl with or without modifications, as long as this not
|
# some systems declare functions in the wrong header, then INCLUDES |
# some systems declare functions in the wrong header, then INCLUDES |
# should do likewise. |
# should do likewise. |
# |
# |
# If you assume C89, then it is generally safe to assume declarations | # It is generally safe to assume declarations for functions declared |
# for functions declared in that standard (such as gets) without | # in the intersection of C89 and C11 (such as printf) without |
# needing gl_WARN_ON_USE_PREPARE. |
# needing gl_WARN_ON_USE_PREPARE. |
AC_DEFUN([gl_WARN_ON_USE_PREPARE], |
AC_DEFUN([gl_WARN_ON_USE_PREPARE], |
[ |
[ |
m4_foreach_w([gl_decl], [$2], | m4_ifdef([gl_POSIXCHECK], |
[AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), | [m4_foreach_w([gl_decl], [$2], |
[Define to 1 if ]m4_defn([gl_decl])[ is declared even after | [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), |
undefining macros.])])dnl | [Define to 1 if ]m4_defn([gl_decl])[ is declared even after |
| undefining macros.])])dnl |
dnl FIXME: gl_Symbol must be used unquoted until we can assume |
dnl FIXME: gl_Symbol must be used unquoted until we can assume |
dnl autoconf 2.64 or newer. |
dnl autoconf 2.64 or newer. |
for gl_func in m4_flatten([$2]); do | for gl_func in m4_flatten([$2]); do |
AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl | AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl |
AC_CACHE_CHECK([whether $gl_func is declared without a macro], | AC_CACHE_CHECK([whether $gl_func is declared without a macro], |
gl_Symbol, | gl_Symbol, |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], |
[@%:@undef $gl_func |
[@%:@undef $gl_func |
(void) $gl_func;])], |
(void) $gl_func;])], |
[AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) | [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) |
AS_VAR_IF(gl_Symbol, [yes], | AS_VAR_IF(gl_Symbol, [yes], |
[AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) | [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) |
dnl shortcut - if the raw declaration exists, then set a cache | dnl shortcut - if the raw declaration exists, then set a cache |
dnl variable to allow skipping any later AC_CHECK_DECL efforts | dnl variable to allow skipping any later AC_CHECK_DECL efforts |
eval ac_cv_have_decl_$gl_func=yes]) | eval ac_cv_have_decl_$gl_func=yes]) |
AS_VAR_POPDEF([gl_Symbol])dnl | AS_VAR_POPDEF([gl_Symbol])dnl |
done | done |
| ]) |
]) |
]) |