1*0ac341f1SConrad Meyer# =========================================================================== 2*0ac341f1SConrad Meyer# https://www.gnu.org/software/autoconf-archive/ax_check_define.html 3*0ac341f1SConrad Meyer# =========================================================================== 4*0ac341f1SConrad Meyer# 5*0ac341f1SConrad Meyer# SYNOPSIS 6*0ac341f1SConrad Meyer# 7*0ac341f1SConrad Meyer# AC_CHECK_DEFINE([symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT]) 8*0ac341f1SConrad Meyer# AX_CHECK_DEFINE([includes],[symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT]) 9*0ac341f1SConrad Meyer# 10*0ac341f1SConrad Meyer# DESCRIPTION 11*0ac341f1SConrad Meyer# 12*0ac341f1SConrad Meyer# Complements AC_CHECK_FUNC but it does not check for a function but for a 13*0ac341f1SConrad Meyer# define to exist. Consider a usage like: 14*0ac341f1SConrad Meyer# 15*0ac341f1SConrad Meyer# AC_CHECK_DEFINE(__STRICT_ANSI__, CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500") 16*0ac341f1SConrad Meyer# 17*0ac341f1SConrad Meyer# LICENSE 18*0ac341f1SConrad Meyer# 19*0ac341f1SConrad Meyer# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> 20*0ac341f1SConrad Meyer# 21*0ac341f1SConrad Meyer# This program is free software; you can redistribute it and/or modify it 22*0ac341f1SConrad Meyer# under the terms of the GNU General Public License as published by the 23*0ac341f1SConrad Meyer# Free Software Foundation; either version 3 of the License, or (at your 24*0ac341f1SConrad Meyer# option) any later version. 25*0ac341f1SConrad Meyer# 26*0ac341f1SConrad Meyer# This program is distributed in the hope that it will be useful, but 27*0ac341f1SConrad Meyer# WITHOUT ANY WARRANTY; without even the implied warranty of 28*0ac341f1SConrad Meyer# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 29*0ac341f1SConrad Meyer# Public License for more details. 30*0ac341f1SConrad Meyer# 31*0ac341f1SConrad Meyer# You should have received a copy of the GNU General Public License along 32*0ac341f1SConrad Meyer# with this program. If not, see <https://www.gnu.org/licenses/>. 33*0ac341f1SConrad Meyer# 34*0ac341f1SConrad Meyer# As a special exception, the respective Autoconf Macro's copyright owner 35*0ac341f1SConrad Meyer# gives unlimited permission to copy, distribute and modify the configure 36*0ac341f1SConrad Meyer# scripts that are the output of Autoconf when processing the Macro. You 37*0ac341f1SConrad Meyer# need not follow the terms of the GNU General Public License when using 38*0ac341f1SConrad Meyer# or distributing such scripts, even though portions of the text of the 39*0ac341f1SConrad Meyer# Macro appear in them. The GNU General Public License (GPL) does govern 40*0ac341f1SConrad Meyer# all other use of the material that constitutes the Autoconf Macro. 41*0ac341f1SConrad Meyer# 42*0ac341f1SConrad Meyer# This special exception to the GPL applies to versions of the Autoconf 43*0ac341f1SConrad Meyer# Macro released by the Autoconf Archive. When you make and distribute a 44*0ac341f1SConrad Meyer# modified version of the Autoconf Macro, you may extend this special 45*0ac341f1SConrad Meyer# exception to the GPL to apply to your modified version as well. 46*0ac341f1SConrad Meyer 47*0ac341f1SConrad Meyer#serial 9 48*0ac341f1SConrad Meyer 49*0ac341f1SConrad MeyerAU_ALIAS([AC_CHECK_DEFINED], [AC_CHECK_DEFINE]) 50*0ac341f1SConrad MeyerAC_DEFUN([AC_CHECK_DEFINE],[ 51*0ac341f1SConrad MeyerAS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$1])dnl 52*0ac341f1SConrad MeyerAC_CACHE_CHECK([for $1 defined], ac_var, 53*0ac341f1SConrad MeyerAC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ 54*0ac341f1SConrad Meyer #ifdef $1 55*0ac341f1SConrad Meyer int ok; 56*0ac341f1SConrad Meyer #else 57*0ac341f1SConrad Meyer choke me 58*0ac341f1SConrad Meyer #endif 59*0ac341f1SConrad Meyer]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)])) 60*0ac341f1SConrad MeyerAS_IF([test AS_VAR_GET(ac_var) != "no"], [$2], [$3])dnl 61*0ac341f1SConrad MeyerAS_VAR_POPDEF([ac_var])dnl 62*0ac341f1SConrad Meyer]) 63*0ac341f1SConrad Meyer 64*0ac341f1SConrad MeyerAU_ALIAS([AX_CHECK_DEFINED], [AX_CHECK_DEFINE]) 65*0ac341f1SConrad MeyerAC_DEFUN([AX_CHECK_DEFINE],[ 66*0ac341f1SConrad MeyerAS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$2_$1])dnl 67*0ac341f1SConrad MeyerAC_CACHE_CHECK([for $2 defined in $1], ac_var, 68*0ac341f1SConrad MeyerAC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$1>]], [[ 69*0ac341f1SConrad Meyer #ifdef $2 70*0ac341f1SConrad Meyer int ok; 71*0ac341f1SConrad Meyer #else 72*0ac341f1SConrad Meyer choke me 73*0ac341f1SConrad Meyer #endif 74*0ac341f1SConrad Meyer]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)])) 75*0ac341f1SConrad MeyerAS_IF([test AS_VAR_GET(ac_var) != "no"], [$3], [$4])dnl 76*0ac341f1SConrad MeyerAS_VAR_POPDEF([ac_var])dnl 77*0ac341f1SConrad Meyer]) 78*0ac341f1SConrad Meyer 79*0ac341f1SConrad MeyerAC_DEFUN([AX_CHECK_FUNC], 80*0ac341f1SConrad Meyer[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$2])dnl 81*0ac341f1SConrad MeyerAC_CACHE_CHECK([for $2], ac_var, 82*0ac341f1SConrad Meyerdnl AC_LANG_FUNC_LINK_TRY 83*0ac341f1SConrad Meyer[AC_LINK_IFELSE([AC_LANG_PROGRAM([$1 84*0ac341f1SConrad Meyer #undef $2 85*0ac341f1SConrad Meyer char $2 ();],[ 86*0ac341f1SConrad Meyer char (*f) () = $2; 87*0ac341f1SConrad Meyer return f != $2; ])], 88*0ac341f1SConrad Meyer [AS_VAR_SET(ac_var, yes)], 89*0ac341f1SConrad Meyer [AS_VAR_SET(ac_var, no)])]) 90*0ac341f1SConrad MeyerAS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl 91*0ac341f1SConrad MeyerAS_VAR_POPDEF([ac_var])dnl 92*0ac341f1SConrad Meyer])# AC_CHECK_FUNC 93