1
# AC_LANG_STDCALL_FUNC_LINK_TRY(FUNCTION, SIGNATURE)
2
# -------------------------------
3
# Produce a source which links correctly iff the FUNCTION exists.
4
AC_DEFUN([AC_LANG_STDCALL_FUNC_LINK_TRY],
5
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
7
# AC_CHECK_STDCALL_FUNC(FUNCTION, SIGNATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
8
# -----------------------------------------------------------------
9
AC_DEFUN([AC_CHECK_STDCALL_FUNC],
10
[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
11
AC_CACHE_CHECK([for $1], ac_var,
12
[AC_LINK_IFELSE([AC_LANG_STDCALL_FUNC_LINK_TRY([$1],[$2])],
13
[AS_VAR_SET(ac_var, yes)],
14
[AS_VAR_SET(ac_var, no)])])
15
AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
16
AS_VAR_POPDEF([ac_var])dnl
19
# AC_LANG_STDCALL_FUNC_LINK_TRY(C)(FUNCTION, SIGNATURE)
20
# ----------------------------------
21
# Don't include <ctype.h> because on OSF/1 3.0 it includes
22
# <sys/types.h> which includes <sys/select.h> which contains a
23
# prototype for select. Similarly for bzero.
24
m4_define([AC_LANG_STDCALL_FUNC_LINK_TRY(C)],
26
[/* System header to define __stub macros and hopefully few prototypes,
27
which can conflict with char __stdcall $1 ( $2 ) below. */
29
/* Override any gcc2 internal prototype to avoid an error. */
33
/* We use char because int might match the return type of a gcc2
34
builtin and then its argument prototype would still apply. */
35
char __stdcall $1 ( $2 );
38
[/* The GNU C library defines this for functions which it implements
39
to always fail with ENOSYS. Some functions are actually named
40
something starting with __ and the normal name is an alias. */
41
#if defined (__stub_$1) || defined (__stub___$1)
48
# AC_LANG_STDCALL_FUNC_LINK_TRY(C++)(FUNCTION)
49
# ------------------------------------
50
m4_copy([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], [AC_LANG_STDCALL_FUNC_LINK_TRY(C++)])