~akopytov/percona-xtrabackup/bug1002688-2.1

« back to all changes in this revision

Viewing changes to src/libarchive/build/autoconf/check_stdcall_func.m4

merge parallel compression branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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, $@)])
 
6
 
 
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
 
17
])# AC_CHECK_FUNC
 
18
 
 
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)],
 
25
[AC_LANG_PROGRAM(
 
26
[/* System header to define __stub macros and hopefully few prototypes,
 
27
    which can conflict with char __stdcall $1 ( $2 ) below.  */
 
28
#include <assert.h>
 
29
/* Override any gcc2 internal prototype to avoid an error.  */
 
30
#ifdef __cplusplus
 
31
extern "C"
 
32
#endif
 
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 );
 
36
char (*f) ( $2 );
 
37
],
 
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)
 
42
choke me
 
43
#else
 
44
f = $1;
 
45
#endif
 
46
])])
 
47
 
 
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++)])
 
51