1 # ld-version-script.m4 serial 1
2 dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 dnl From Simon Josefsson
10 # --------------------
11 # Check if LD supports linker scripts, and define automake conditional
12 # HAVE_LD_VERSION_SCRIPT if so.
13 AC_DEFUN([gl_LD_VERSION_SCRIPT],
15 AC_ARG_ENABLE([ld-version-script],
16 AS_HELP_STRING([--enable-ld-version-script],
17 [enable linker version script (default is enabled when possible)]),
18 [have_ld_version_script=$enableval], [])
19 if test -z "$have_ld_version_script"; then
20 AC_MSG_CHECKING([if LD -Wl,--version-script works])
21 save_LDFLAGS="$LDFLAGS"
22 LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
23 cat > conftest.map <<EOF
32 AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
33 [have_ld_version_script=yes], [have_ld_version_script=no])
35 LDFLAGS="$save_LDFLAGS"
36 AC_MSG_RESULT($have_ld_version_script)
38 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")