1dnl Check whether the linker supports --version-script.
2dnl
3dnl Probes whether the linker supports --version-script with a simple version
4dnl script that only defines a single version.  Sets the Automake conditional
5dnl HAVE_LD_VERSION_SCRIPT based on whether it is supported.
6dnl
7dnl Written by Russ Allbery <rra@stanford.edu>
8dnl Based on the gnulib ld-version-script macro from Simon Josefsson
9dnl Copyright 2010 Board of Trustees, Leland Stanford Jr. University
10dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
11dnl
12dnl This file is free software; the Free Software Foundation gives unlimited
13dnl permission to copy and/or distribute it, with or without modifications, as
14dnl long as this notice is preserved.
15
16AC_DEFUN([RRA_LD_VERSION_SCRIPT],
17[AC_CACHE_CHECK([if -Wl,--version-script works], [rra_cv_ld_version_script],
18    [save_LDFLAGS="$LDFLAGS"
19     LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
20     cat > conftest.map <<EOF
21VERSION_1 {
22    global:
23        sym;
24
25    local:
26        *;
27};
28EOF
29     AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
30        [rra_cv_ld_version_script=yes], [rra_cv_ld_version_script=no])
31     rm -f conftest.map
32     LDFLAGS="$save_LDFLAGS"])
33 AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT],
34    [test x"$rra_cv_ld_version_script" = xyes])])
35