xref: /curl/m4/curl-override.m4 (revision 0aece8f6)
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
12# are also available at https://curl.se/docs/copyright.html.
13#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21# SPDX-License-Identifier: curl
22#
23###########################################################################
24#***************************************************************************
25#***************************************************************************
26
27# File version for 'aclocal' use. Keep it a single number.
28# serial 7
29
30dnl CURL_OVERRIDE_AUTOCONF
31dnl -------------------------------------------------
32dnl Placing a call to this macro in configure.ac after
33dnl the one to AC_INIT will make macros in this file
34dnl visible to the rest of the compilation overriding
35dnl those from Autoconf.
36
37AC_DEFUN([CURL_OVERRIDE_AUTOCONF], [
38AC_BEFORE([$0],[AC_PROG_LIBTOOL])
39# using curl-override.m4
40])
41
42dnl Override Autoconf's AC_LANG_PROGRAM (C)
43dnl -------------------------------------------------
44dnl This is done to prevent compiler warning
45dnl 'function declaration isn't a prototype'
46dnl in function main. This requires at least
47dnl a C89 compiler and does not support K&R.
48
49m4_define([AC_LANG_PROGRAM(C)],
50[$1
51int main(void)
52{
53$2
54 ;
55 return 0;
56}])
57
58dnl Override Autoconf's AC_LANG_CALL (C)
59dnl -------------------------------------------------
60dnl This is a backport of Autoconf's 2.60 with the
61dnl embedded comments that hit the resulting script
62dnl removed. This is done to reduce configure size
63dnl and use fixed macro across Autoconf versions.
64
65m4_define([AC_LANG_CALL(C)],
66[AC_LANG_PROGRAM([$1
67m4_if([$2], [main], ,
68[
69#ifdef __cplusplus
70extern "C"
71#endif
72char $2 ();])], [return $2 ();])])
73
74dnl Override Autoconf's AC_LANG_FUNC_LINK_TRY (C)
75dnl -------------------------------------------------
76dnl This is a backport of Autoconf's 2.60 with the
77dnl embedded comments that hit the resulting script
78dnl removed. This is done to reduce configure size
79dnl and use fixed macro across Autoconf versions.
80
81m4_define([AC_LANG_FUNC_LINK_TRY(C)],
82[AC_LANG_PROGRAM(
83[
84#define $1 innocuous_$1
85#ifdef __STDC__
86# include <limits.h>
87#else
88# include <assert.h>
89#endif
90#undef $1
91#ifdef __cplusplus
92extern "C"
93#endif
94char $1 ();
95#if defined __stub_$1 || defined __stub___$1
96#error force compilation error
97#endif
98], [return $1 ();])])
99