Blame build/autoconf/check_stdcall_func.m4

Packit Service 1d0348
# AC_LANG_STDCALL_FUNC_LINK_TRY(FUNCTION, SIGNATURE)
Packit Service 1d0348
# -------------------------------
Packit Service 1d0348
# Produce a source which links correctly iff the FUNCTION exists.
Packit Service 1d0348
AC_DEFUN([AC_LANG_STDCALL_FUNC_LINK_TRY],
Packit Service 1d0348
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
Packit Service 1d0348
Packit Service 1d0348
# AC_CHECK_STDCALL_FUNC(FUNCTION, SIGNATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
Packit Service 1d0348
# -----------------------------------------------------------------
Packit Service 1d0348
AC_DEFUN([AC_CHECK_STDCALL_FUNC],
Packit Service 1d0348
[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
Packit Service 1d0348
AC_CACHE_CHECK([for $1], ac_var,
Packit Service 1d0348
[AC_LINK_IFELSE([AC_LANG_STDCALL_FUNC_LINK_TRY([$1],[$2])],
Packit Service 1d0348
                [AS_VAR_SET(ac_var, yes)],
Packit Service 1d0348
                [AS_VAR_SET(ac_var, no)])])
Packit Service 1d0348
AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
Packit Service 1d0348
AS_VAR_POPDEF([ac_var])dnl
Packit Service 1d0348
])# AC_CHECK_FUNC
Packit Service 1d0348
Packit Service 1d0348
# AC_LANG_STDCALL_FUNC_LINK_TRY(C)(FUNCTION, SIGNATURE)
Packit Service 1d0348
# ----------------------------------
Packit Service 1d0348
# Don't include <ctype.h> because on OSF/1 3.0 it includes
Packit Service 1d0348
# <sys/types.h> which includes <sys/select.h> which contains a
Packit Service 1d0348
# prototype for select.  Similarly for bzero.
Packit Service 1d0348
m4_define([AC_LANG_STDCALL_FUNC_LINK_TRY(C)],
Packit Service 1d0348
[AC_LANG_PROGRAM(
Packit Service 1d0348
[/* System header to define __stub macros and hopefully few prototypes,
Packit Service 1d0348
    which can conflict with char __stdcall $1 ( $2 ) below.  */
Packit Service 1d0348
#include <assert.h>
Packit Service 1d0348
/* Override any gcc2 internal prototype to avoid an error.  */
Packit Service 1d0348
#ifdef __cplusplus
Packit Service 1d0348
extern "C"
Packit Service 1d0348
#endif
Packit Service 1d0348
/* We use char because int might match the return type of a gcc2
Packit Service 1d0348
   builtin and then its argument prototype would still apply.  */
Packit Service 1d0348
char __stdcall $1 ( $2 );
Packit Service 1d0348
char (*f) ( $2 );
Packit Service 1d0348
],
Packit Service 1d0348
[/* The GNU C library defines this for functions which it implements
Packit Service 1d0348
    to always fail with ENOSYS.  Some functions are actually named
Packit Service 1d0348
    something starting with __ and the normal name is an alias.  */
Packit Service 1d0348
#if defined (__stub_$1) || defined (__stub___$1)
Packit Service 1d0348
choke me
Packit Service 1d0348
#else
Packit Service 1d0348
f = $1;
Packit Service 1d0348
#endif
Packit Service 1d0348
])])
Packit Service 1d0348
Packit Service 1d0348
# AC_LANG_STDCALL_FUNC_LINK_TRY(C++)(FUNCTION)
Packit Service 1d0348
# ------------------------------------
Packit Service 1d0348
m4_copy([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], [AC_LANG_STDCALL_FUNC_LINK_TRY(C++)])
Packit Service 1d0348