binutils-gdb/gnulib/import/m4/getprogname.m4
Paul E. Murphy 9c9d63b15a gnulib: update to 776af40e0
This fixes PR27184, a failure to compile gdb due to
cdefs.h being out of sync with glibc on ppc64le targets
which are compiled with -mabi=ieeelongdouble and glibc
2.32.

Likewise, update usage of _GL_ATTRIBUTE_FORMAT_PRINTF to
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD.

Likewise, disable newly added rpl_free gnulib api in
gdbserver support libraries.

Likewise, undefine read/write macros before redefining them
on mingw targets.

Likewise, wrap C++ usage of free with GNULIB_NAMESPACE namespace
as needed.

Change-Id: I86517613c0d8ac8f5ea45bbc4ebe2b54a3aef29f
2021-02-05 13:35:20 -05:00

43 lines
1.4 KiB
Text

# getprogname.m4 - check for getprogname or replacements for it
# Copyright (C) 2016-2021 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
AC_DEFUN([gl_FUNC_GETPROGNAME],
[
AC_CHECK_FUNCS_ONCE([getprogname getexecname])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
ac_found=0
AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [],
[#include <errno.h>])
AC_CHECK_DECLS([program_invocation_short_name], [ac_found=1], [],
[#include <errno.h>])
AC_CHECK_DECLS([__argv], [ac_found=1], [], [#include <stdlib.h>])
# Incur the cost of this test only if none of the above worked.
if test $ac_found = 0; then
# On OpenBSD 5.1, using the global __progname variable appears to be
# the only way to implement getprogname.
AC_CACHE_CHECK([whether __progname is defined in default libraries],
[gl_cv_var___progname],
[
gl_cv_var___progname=
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[extern char *__progname;]],
[[return *__progname;]]
)],
[gl_cv_var___progname=yes]
)
]
)
if test "$gl_cv_var___progname" = yes; then
AC_DEFINE([HAVE_VAR___PROGNAME], 1,
[Define if you have a global __progname variable])
fi
fi
])