Blame SOURCES/libsodium-1.0.18/m4/ax_check_define.m4

rdobuilder 775784
# ===========================================================================
rdobuilder 775784
#     https://www.gnu.org/software/autoconf-archive/ax_check_define.html
rdobuilder 775784
# ===========================================================================
rdobuilder 775784
#
rdobuilder 775784
# SYNOPSIS
rdobuilder 775784
#
rdobuilder 775784
#   AC_CHECK_DEFINE([symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
rdobuilder 775784
#   AX_CHECK_DEFINE([includes],[symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
rdobuilder 775784
#
rdobuilder 775784
# DESCRIPTION
rdobuilder 775784
#
rdobuilder 775784
#   Complements AC_CHECK_FUNC but it does not check for a function but for a
rdobuilder 775784
#   define to exist. Consider a usage like:
rdobuilder 775784
#
rdobuilder 775784
#    AC_CHECK_DEFINE(__STRICT_ANSI__, CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500")
rdobuilder 775784
#
rdobuilder 775784
# LICENSE
rdobuilder 775784
#
rdobuilder 775784
#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
rdobuilder 775784
#
rdobuilder 775784
#   This program is free software; you can redistribute it and/or modify it
rdobuilder 775784
#   under the terms of the GNU General Public License as published by the
rdobuilder 775784
#   Free Software Foundation; either version 3 of the License, or (at your
rdobuilder 775784
#   option) any later version.
rdobuilder 775784
#
rdobuilder 775784
#   This program is distributed in the hope that it will be useful, but
rdobuilder 775784
#   WITHOUT ANY WARRANTY; without even the implied warranty of
rdobuilder 775784
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
rdobuilder 775784
#   Public License for more details.
rdobuilder 775784
#
rdobuilder 775784
#   You should have received a copy of the GNU General Public License along
rdobuilder 775784
#   with this program. If not, see <https://www.gnu.org/licenses/>.
rdobuilder 775784
#
rdobuilder 775784
#   As a special exception, the respective Autoconf Macro's copyright owner
rdobuilder 775784
#   gives unlimited permission to copy, distribute and modify the configure
rdobuilder 775784
#   scripts that are the output of Autoconf when processing the Macro. You
rdobuilder 775784
#   need not follow the terms of the GNU General Public License when using
rdobuilder 775784
#   or distributing such scripts, even though portions of the text of the
rdobuilder 775784
#   Macro appear in them. The GNU General Public License (GPL) does govern
rdobuilder 775784
#   all other use of the material that constitutes the Autoconf Macro.
rdobuilder 775784
#
rdobuilder 775784
#   This special exception to the GPL applies to versions of the Autoconf
rdobuilder 775784
#   Macro released by the Autoconf Archive. When you make and distribute a
rdobuilder 775784
#   modified version of the Autoconf Macro, you may extend this special
rdobuilder 775784
#   exception to the GPL to apply to your modified version as well.
rdobuilder 775784
rdobuilder 775784
#serial 9
rdobuilder 775784
rdobuilder 775784
AU_ALIAS([AC_CHECK_DEFINED], [AC_CHECK_DEFINE])
rdobuilder 775784
AC_DEFUN([AC_CHECK_DEFINE],[
rdobuilder 775784
AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$1])dnl
rdobuilder 775784
AC_CACHE_CHECK([for $1 defined], ac_var,
rdobuilder 775784
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
rdobuilder 775784
  #ifdef $1
rdobuilder 775784
  int ok;
rdobuilder 775784
  #else
rdobuilder 775784
  choke me
rdobuilder 775784
  #endif
rdobuilder 775784
]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
rdobuilder 775784
AS_IF([test AS_VAR_GET(ac_var) != "no"], [$2], [$3])dnl
rdobuilder 775784
AS_VAR_POPDEF([ac_var])dnl
rdobuilder 775784
])
rdobuilder 775784
rdobuilder 775784
AU_ALIAS([AX_CHECK_DEFINED], [AX_CHECK_DEFINE])
rdobuilder 775784
AC_DEFUN([AX_CHECK_DEFINE],[
rdobuilder 775784
AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$2_$1])dnl
rdobuilder 775784
AC_CACHE_CHECK([for $2 defined in $1], ac_var,
rdobuilder 775784
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$1>]], [[
rdobuilder 775784
  #ifdef $2
rdobuilder 775784
  int ok;
rdobuilder 775784
  #else
rdobuilder 775784
  choke me
rdobuilder 775784
  #endif
rdobuilder 775784
]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
rdobuilder 775784
AS_IF([test AS_VAR_GET(ac_var) != "no"], [$3], [$4])dnl
rdobuilder 775784
AS_VAR_POPDEF([ac_var])dnl
rdobuilder 775784
])
rdobuilder 775784
rdobuilder 775784
AC_DEFUN([AX_CHECK_FUNC],
rdobuilder 775784
[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$2])dnl
rdobuilder 775784
AC_CACHE_CHECK([for $2], ac_var,
rdobuilder 775784
dnl AC_LANG_FUNC_LINK_TRY
rdobuilder 775784
[AC_LINK_IFELSE([AC_LANG_PROGRAM([$1
rdobuilder 775784
                #undef $2
rdobuilder 775784
                char $2 ();],[
rdobuilder 775784
                char (*f) () = $2;
rdobuilder 775784
                return f != $2; ])],
rdobuilder 775784
                [AS_VAR_SET(ac_var, yes)],
rdobuilder 775784
                [AS_VAR_SET(ac_var, no)])])
rdobuilder 775784
AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
rdobuilder 775784
AS_VAR_POPDEF([ac_var])dnl
rdobuilder 775784
])# AC_CHECK_FUNC