file: improve the file access interface
[nasm.git] / aclocal.m4
blobde80e143101d312414ad8e1089ff74de41c8cadd
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  CFLAGS="$pa_add_cflags__old_cflags ifelse([$2],[],[$1],[$2])",
14  AC_MSG_RESULT([no])
15  CFLAGS="$pa_add_cflags__old_cflags")])
17 dnl --------------------------------------------------------------------------
18 dnl PA_HAVE_FUNC
19 dnl
20 dnl Look for a function with the specified arguments which could be
21 dnl a builtin/intrinsic function.
22 dnl --------------------------------------------------------------------------
23 AC_DEFUN(PA_HAVE_FUNC,
24 [AC_MSG_CHECKING([for $1])
25 AC_TRY_LINK([], [(void)$1$2;],
26 AC_MSG_RESULT([yes])
27 AC_DEFINE(m4_toupper([HAVE_$1]), [1],
28   [Define to 1 if you have the `$1' intrinsic function.]),
29 AC_MSG_RESULT([no]))])
31 dnl --------------------------------------------------------------------------
32 dnl PA_LIBEXT
33 dnl
34 dnl Guess the library extension based on the object extension
35 dnl --------------------------------------------------------------------------
36 AC_DEFUN(PA_LIBEXT,
37 [AC_MSG_CHECKING([for suffix of library files])
38 if test x"$LIBEXT" = x; then
39   case "$OBJEXT" in
40     obj )
41       LIBEXT=lib
42       ;;
43     *)
44       LIBEXT=a
45       ;;
46   esac
48 AC_MSG_RESULT([$LIBEXT])
49 AC_SUBST([LIBEXT])])