doc: Correct JSON schema for `-fdiagnostics-as-json` (fixes #25393)
[ghc.git] / m4 / fp_find_libdw.m4
blob22f24ab0232f4184685a115c4388cac6ae31c20f
1 # FP_FIND_LIBDW
2 # --------------------------------------------------------------
3 # Should we used libdw? (yes, no, or auto.)
5 # Sets variables:
6 #   - UseLibdw: [YES|NO]
7 #   - LibdwLibDir: optional path
8 #   - LibdwIncludeDir: optional path
9 AC_DEFUN([FP_FIND_LIBDW],
11   AC_ARG_WITH([libdw-libraries],
12     [AS_HELP_STRING([--with-libdw-libraries=ARG],
13       [Find libraries for libdw in ARG [default=system default]])
14     ],
15     [
16       LibdwLibDir="$withval"
17       LIBDW_LDFLAGS="-L$withval"
18     ])
20   AC_ARG_WITH([libdw-includes],
21     [AS_HELP_STRING([--with-libdw-includes=ARG],
22       [Find includes for libdw in ARG [default=system default]])
23     ],
24     [
25       LibdwIncludeDir="$withval"
26       LIBDW_CFLAGS="-I$withval"
27     ])
29   AC_ARG_ENABLE(dwarf-unwind,
30     [AS_HELP_STRING([--enable-dwarf-unwind],
31       [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])],
32     [],
33     [enable_dwarf_unwind=no])
35   UseLibdw=NO
36   if test "$enable_dwarf_unwind" != "no" ; then
37     CFLAGS2="$CFLAGS"
38     CFLAGS="$LIBDW_CFLAGS $CFLAGS"
39     LDFLAGS2="$LDFLAGS"
40     LDFLAGS="$LIBDW_LDFLAGS $LDFLAGS"
42     AC_CHECK_HEADER([elfutils/libdwfl.h],
43       [AC_CHECK_LIB(dw, dwfl_attach_state,
44         [UseLibdw=YES])])
46     if test "x:$enable_dwarf_unwind:$UseLibdw" = "x:yes:NO" ; then
47       AC_MSG_ERROR([Cannot find system libdw (required by --enable-dwarf-unwind)])
48     fi
50     CFLAGS="$CFLAGS2"
51     LDFLAGS="$LDFLAGS2"
52   fi