summaryrefslogtreecommitdiff
path: root/infrastructure/m4/ax_check_define_pragma.m4
blob: 176faf3d7ddfd38f5dfff7856d77fd56083c6386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
dnl @synopsis AX_CHECK_DEFINE_PRAGMA([ACTION-IF-TRUE], [ACTION-IF-FALSE])
dnl
dnl This macro will find out if the compiler will accept #pragma inside a
dnl #define. HAVE_DEFINE_PRAGMA will be defined if this is the case, and
dnl ACTION-IF-TRUE and ACTION-IF-FALSE are run as appropriate
dnl
dnl @category C
dnl @author Martin Ebourne
dnl @version 2005/07/03
dnl @license AllPermissive

AC_DEFUN([AX_CHECK_DEFINE_PRAGMA], [
  AC_CACHE_CHECK([for pre-processor pragma defines], [have_define_pragma],
    [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
        #define TEST_DEFINE #pragma pack(1)
        TEST_DEFINE
      ]])],
      [have_define_pragma=yes], [have_define_pragma=no]
    )])
  if test "x$have_define_pragma" = "xyes"; then
    AC_DEFINE([HAVE_DEFINE_PRAGMA], 1, [Define to 1 if #define of pragmas works])
    m4_ifvaln([$1],[$1],[:])dnl
    m4_ifvaln([$2],[else $2])dnl
  fi
  ])dnl