Merge branch 'master' into elfmerge
[nasm.git] / aclocal.m4
blobd8d8ed7c20d751c833bb3ab67e4bde04c39eae18
1 dnl --------------------------------------------------------------------------
2 dnl PA_ADD_CFLAGS()
3 dnl
4 dnl Attempt to add the given option to CFLAGS, if it doesn't break compilation
5 dnl --------------------------------------------------------------------------
6 AC_DEFUN(PA_ADD_CFLAGS,
7 [AC_MSG_CHECKING([if $CC accepts $1])
8  pa_add_cflags__old_cflags="$CFLAGS"
9  CFLAGS="$CFLAGS $1"
10  AC_TRY_LINK([#include <stdio.h>],
11  [printf("Hello, World!\n");],
12  AC_MSG_RESULT([yes]),
13  AC_MSG_RESULT([no])
14  CFLAGS="$pa_add_cflags__old_cflags")])
16 dnl --------------------------------------------------------------------------
17 dnl PA_HAVE_FUNC
18 dnl
19 dnl Look for a function with the specified arguments which could be
20 dnl a builtin/intrinsic function.
21 dnl --------------------------------------------------------------------------
22 AC_DEFUN(PA_HAVE_FUNC,
23 [AC_MSG_CHECKING([for $1])
24 AC_TRY_LINK([], [(void)$1$2;],
25 AC_MSG_RESULT([yes])
26 AC_DEFINE(m4_toupper([HAVE_$1]), [1],
27   [Define to 1 if you have the `$1' intrinsic function.]),
28 AC_MSG_RESULT([no]))])
30 dnl --------------------------------------------------------------------------
31 dnl PA_REPLACE_FUNC
32 dnl
33 dnl Look for a function and possible alternatives, unlike AC_REPLACE_FUNCS
34 dnl this will only add *one* replacement to LIBOBJS if no alternative is
35 dnl found.
36 dnl --------------------------------------------------------------------------
37 AC_DEFUN(PA_REPLACE_FUNC_WITH,
38 [pa_replace_func__$2_missing=true
39 AC_CHECK_FUNCS([$1], [pa_replace_func__$2_missing=false], [])
40 if $pa_replace_func__$2_missing; then
41   AC_LIBOBJ([$2])
42 fi])
44 AC_DEFUN(PA_REPLACE_FUNC,
45 [PA_REPLACE_FUNC_WITH([$1], m4_car(m4_unquote(m4_split(m4_normalize[$1]))))])