libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

mhd_check_decls.m4 (1733B)


      1 # SPDX-License-Identifier: FSFAP
      2 #
      3 # SYNOPSIS
      4 #
      5 #   MHD_CHECK_DECLS([SYMBOLS-TO-TEST], [INCLUDES])
      6 #
      7 # DESCRIPTION
      8 #
      9 #   This macro checks whether specific symbols is defined in the headers.
     10 #   SYMBOLS-TO-TEST is s space-separated list of symbols to check.
     11 #   The symbol could be a macro, a variable, a constant, a enum value,
     12 #   a function name or other kind of symbols recognisable by compiler (or
     13 #   preprocessor).
     14 #   For every found symbol a relevant preprocessor macro is defined.
     15 #   Unlike AC_CHECK_DECLS this m4 macro does not define preprocossor macro if
     16 #   symbol is NOT found.
     17 #
     18 #   Example usage:
     19 #
     20 #     MHD_CHECK_DECLS([SSIZE_MAX OFF_T_MAX], [[#include <limits.h>]])
     21 #
     22 #
     23 # LICENSE
     24 #
     25 #   Copyright (c) 2025 Karlson2k (Evgeny Grin) <k2k@drgrin.dev>
     26 #
     27 #   Copying and distribution of this file, with or without modification, are
     28 #   permitted in any medium without royalty provided the copyright notice
     29 #   and this notice are preserved. This file is offered as-is, without any
     30 #   warranty.
     31 
     32 #serial 1
     33 
     34 AC_DEFUN([MHD_CHECK_DECLS],[dnl
     35 m4_newline([[# Expansion of $0 macro starts here]])
     36 m4_if(m4_index([$1], [(]),[-1],[],[dnl
     37 m4_fatal([SYMBOLS-TO-TEST parameter (first macro argument) contains '('])])dnl m4_if
     38 m4_if(m4_index([$1], [)]),[-1],[],[dnl
     39 m4_fatal([SYMBOLS-TO-TEST parameter (first macro argument) contains ')'])])dnl m4_if
     40 m4_if(m4_index([$1], [,]),[-1],[],[dnl
     41 m4_fatal([SYMBOLS-TO-TEST parameter (first macro argument) contains ','])])dnl m4_if
     42 m4_foreach_w([check_Symbol],[$1],
     43 [AC_CHECK_DECL(check_Symbol,[dnl
     44 AC_DEFINE([HAVE_DCLR_]m4_toupper(check_Symbol),[1],[Define to '1' if you have the declaration of ']check_Symbol['])dnl
     45 ],[],[$2])
     46 ])dnl
     47 m4_newline([[# Expansion of $0 macro ends here]])
     48 ])