1
# linker.m4 - autoconf macros for linker settings
3
# Copyright © 2005 Scott James Remnant <scott@netsplit.com>.
5
# Permission is hereby granted, free of charge, to any person obtaining
6
# a copy of this software and associated documentation files (the
7
# "Software"), to deal in the Software without restriction, including
8
# without limitation the rights to use, copy, modify, merge, publish,
9
# distribute, sublicense, and/or sell copies of the Software, and to
10
# permit persons to whom the Software is furnished to do so, subject to
11
# the following conditions:
13
# The above copyright notice and this permission notice shall be
14
# included in all copies or substantial portions of the Software.
16
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
20
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
# LINKER_OPTIMISATIONS
26
# --------------------
27
# Add configure option to disable linker optimisations.
28
AC_DEFUN([LINKER_OPTIMISATIONS],
29
[AC_ARG_ENABLE(linker-optimisations,
30
AS_HELP_STRING([--disable-linker-optimisations],
31
[Disable linker optimisations]),
32
[if test "x$enable_linker_optimisations" = "xno"; then
33
[LDFLAGS=`echo "$LDFLAGS" | sed -e "s/ -Wl,-O[0-9]*\b//g"`]
35
[LDFLAGS="$LDFLAGS -Wl,-O1"]
36
fi], [LDFLAGS="$LDFLAGS -Wl,-O1"])dnl
37
])# LINKER_OPTIMISATIONS
39
# LINKER_VERSION_SCRIPT
40
# --------------------------
41
# Detect whether the linker supports version scripts
42
AC_DEFUN([LINKER_VERSION_SCRIPT],
43
[AC_MSG_CHECKING([for linker version script argument])
44
for aranha_try_arg in "-Wl,--version-script"; do
45
aranha_old_libs="$LIBS"
46
LIBS="$LIBS $aranha_try_arg=conftest.ver"
48
cat >conftest.ver <<EOF
57
LIBS="$aranha_old_libs"
59
AC_MSG_RESULT([$aranha_try_arg])
60
AC_SUBST(VERSION_SCRIPT_ARG, [$aranha_try_arg])
65
LIBS="$aranha_old_libs"
68
AM_CONDITIONAL(HAVE_VERSION_SCRIPT_ARG, [test -n "$VERSION_SCRIPT_ARG"])
69
if test -z "$VERSION_SCRIPT_ARG"; then
70
AC_MSG_RESULT([unknown])
73
])# LINKER_VERSION_SCRIPT