libmicrohttpd2

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

mhd_find_add_cc_cflag_ifelse.m4 (1940B)


      1 # SPDX-License-Identifier: FSFAP
      2 #
      3 # SYNOPSIS
      4 #
      5 #   MHD_FIND_ADD_CC_CFLAG_IFELSE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
      6 #                                [VARIABLE-TO-EXTEND],
      7 #                                [FLAG1-TO-TEST], [FLAG2-TO-TEST], ...)
      8 #
      9 # DESCRIPTION
     10 #
     11 #   This macro checks whether the specific compiler flags are supported.
     12 #   The flags are checked one-by-one. The checking is stopped when the first
     13 #   supported flag found.
     14 #   The checks are performing by appending FLAGx-TO-TEST to the value of
     15 #   VARIABLE-TO-EXTEND (CFLAGS if not specified), then prepending result to
     16 #   CFLAGS (unless VARIABLE-TO-EXTEND is CFLAGS), and then performing compile
     17 #   and link test. If test succeed without warnings, then the flag is added to
     18 #   VARIABLE-TO-EXTEND and next flags are not checked. If compile-link cycle
     19 #   cannot be performed without warning with all tested flags, no flag is
     20 #   added to the VARIABLE-TO-EXTEND.
     21 #   If any suitable flag is found, ACTION-IF-FOUND is executed otherwise
     22 #   ACTION-IF-NOT-FOUND is executed. Found flag (if any) is available as
     23 #   value of shell variable $mhd_cc_found_flag during action execution.
     24 #
     25 #   Example usage:
     26 #
     27 #     MHD_FIND_ADD_CC_CFLAG_IFELSE([AC_MSG_NOTICE([Enabled debug information])],
     28 #                                  [],
     29 #                                  [additional_CFLAGS],
     30 #                                  [-ggdb3], [-g3], [-ggdb], [-g])
     31 #
     32 #   Note: Unlike others MHD_CHECK_*CC_CFLAG* macro, this macro uses another
     33 #   order of parameters.
     34 #
     35 # LICENSE
     36 #
     37 #   Copyright (c) 2022 Karlson2k (Evgeny Grin) <k2k@narod.ru>
     38 #
     39 #   Copying and distribution of this file, with or without modification, are
     40 #   permitted in any medium without royalty provided the copyright notice
     41 #   and this notice are preserved. This file is offered as-is, without any
     42 #   warranty.
     43 
     44 #serial 1
     45 
     46 AC_DEFUN([MHD_FIND_ADD_CC_CFLAG_IFELSE],[dnl
     47 _MHD_FIND_ADD_CC_XFLAG([[CFLAGS]],$@)])