xref: /aosp_15_r20/external/libxml2/m4/ax_append_link_flags.m4 (revision 7c5688314b92172186c154356a6374bf7684c3ca)
1*7c568831SAndroid Build Coastguard Worker# ===========================================================================
2*7c568831SAndroid Build Coastguard Worker#   https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
3*7c568831SAndroid Build Coastguard Worker# ===========================================================================
4*7c568831SAndroid Build Coastguard Worker#
5*7c568831SAndroid Build Coastguard Worker# SYNOPSIS
6*7c568831SAndroid Build Coastguard Worker#
7*7c568831SAndroid Build Coastguard Worker#   AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
8*7c568831SAndroid Build Coastguard Worker#
9*7c568831SAndroid Build Coastguard Worker# DESCRIPTION
10*7c568831SAndroid Build Coastguard Worker#
11*7c568831SAndroid Build Coastguard Worker#   For every FLAG1, FLAG2 it is checked whether the linker works with the
12*7c568831SAndroid Build Coastguard Worker#   flag.  If it does, the flag is added FLAGS-VARIABLE
13*7c568831SAndroid Build Coastguard Worker#
14*7c568831SAndroid Build Coastguard Worker#   If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
15*7c568831SAndroid Build Coastguard Worker#   used. During the check the flag is always added to the linker's flags.
16*7c568831SAndroid Build Coastguard Worker#
17*7c568831SAndroid Build Coastguard Worker#   If EXTRA-FLAGS is defined, it is added to the linker's default flags
18*7c568831SAndroid Build Coastguard Worker#   when the check is done.  The check is thus made with the flags: "LDFLAGS
19*7c568831SAndroid Build Coastguard Worker#   EXTRA-FLAGS FLAG".  This can for example be used to force the linker to
20*7c568831SAndroid Build Coastguard Worker#   issue an error when a bad flag is given.
21*7c568831SAndroid Build Coastguard Worker#
22*7c568831SAndroid Build Coastguard Worker#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
23*7c568831SAndroid Build Coastguard Worker#
24*7c568831SAndroid Build Coastguard Worker#   NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
25*7c568831SAndroid Build Coastguard Worker#   Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
26*7c568831SAndroid Build Coastguard Worker#
27*7c568831SAndroid Build Coastguard Worker# LICENSE
28*7c568831SAndroid Build Coastguard Worker#
29*7c568831SAndroid Build Coastguard Worker#   Copyright (c) 2011 Maarten Bosmans <[email protected]>
30*7c568831SAndroid Build Coastguard Worker#
31*7c568831SAndroid Build Coastguard Worker#   Copying and distribution of this file, with or without modification, are
32*7c568831SAndroid Build Coastguard Worker#   permitted in any medium without royalty provided the copyright notice
33*7c568831SAndroid Build Coastguard Worker#   and this notice are preserved.  This file is offered as-is, without any
34*7c568831SAndroid Build Coastguard Worker#   warranty.
35*7c568831SAndroid Build Coastguard Worker
36*7c568831SAndroid Build Coastguard Worker#serial 7
37*7c568831SAndroid Build Coastguard Worker
38*7c568831SAndroid Build Coastguard WorkerAC_DEFUN([AX_APPEND_LINK_FLAGS],
39*7c568831SAndroid Build Coastguard Worker[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
40*7c568831SAndroid Build Coastguard WorkerAX_REQUIRE_DEFINED([AX_APPEND_FLAG])
41*7c568831SAndroid Build Coastguard Workerfor flag in $1; do
42*7c568831SAndroid Build Coastguard Worker  AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
43*7c568831SAndroid Build Coastguard Workerdone
44*7c568831SAndroid Build Coastguard Worker])dnl AX_APPEND_LINK_FLAGS
45