Imported Upstream version 3.3.0
[debian/amanda] / config / amanda / as_needed.m4
1 # SYNOPSIS
2 #
3 #   AMANDA_AS_NEEDED
4 #
5 # OVERVIEW
6 #   Add --as-needed ld flag to LD_FLAGS except when using readline. On
7 #   some platforms, readline does not correctly advertise it's requirements,
8 #   causing ld errors.  In Amanda, readline is used by amrecover/amoldrecover.
9 #
10 AC_DEFUN([AMANDA_AS_NEEDED], [
11     AC_ARG_ENABLE([as-needed],
12         AS_HELP_STRING([--enable-as-needed],
13                        [enable use od --as-needed linker flag]),
14         [ WANT_AS_NEEDED=$enableval ], [ WANT_AS_NEEDED=no ])
15
16     AM_CONDITIONAL([WANT_AS_NEEDED], [test x"$WANT_AS_NEEDED" = x"yes"])
17
18     if test x"$WANT_AS_NEEDED" = x"yes"; then
19         AS_NEEDED_FLAGS="-Wl,--as-needed"
20     else
21         AS_NEEDED_FLAGS=""
22     fi
23     AC_SUBST(AS_NEEDED_FLAGS)
24 ])
25