extract-interface: link in libclangSupport when available
[isl.git] / m4 / ax_gcc_warn_unused_result.m4
blob9a190e218c23d32e1156f9e67822f391f46c3f2f
1 # ==============================================================================
2 #  https://www.gnu.org/software/autoconf-archive/ax_gcc_warn_unused_result.html
3 # ==============================================================================
5 # SYNOPSIS
7 #   AX_GCC_WARN_UNUSED_RESULT
9 # DESCRIPTION
11 #   The macro will compile a test program to see whether the compiler does
12 #   understand the per-function postfix pragma.
14 # LICENSE
16 #   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
18 #   Copying and distribution of this file, with or without modification, are
19 #   permitted in any medium without royalty provided the copyright notice
20 #   and this notice are preserved.  This file is offered as-is, without any
21 #   warranty.
23 #serial 10
25 AC_DEFUN([AX_GCC_WARN_UNUSED_RESULT],[dnl
26 AC_CACHE_CHECK(
27  [whether the compiler supports function __attribute__((__warn_unused_result__))],
28  ax_cv_gcc_warn_unused_result,[
29  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[__attribute__((__warn_unused_result__))
30  int f(int i) { return i; }]],
31  [])],
32  [ax_cv_gcc_warn_unused_result=yes], [ax_cv_gcc_warn_unused_result=no])])
33  if test "$ax_cv_gcc_warn_unused_result" = yes; then
34    AC_DEFINE([GCC_WARN_UNUSED_RESULT],[__attribute__((__warn_unused_result__))],
35     [most gcc compilers know a function __attribute__((__warn_unused_result__))])
36  fi