]> git.ipfire.org Git - people/ms/libloc.git/blame - m4/ld-version-script.m4
database: Re-open the file handle in r+ mode
[people/ms/libloc.git] / m4 / ld-version-script.m4
CommitLineData
a76b0b96
MT
1# ld-version-script.m4 serial 4
2dnl Copyright (C) 2008-2015 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Simon Josefsson
8
9# FIXME: The test below returns a false positive for mingw
10# cross-compiles, 'local:' statements does not reduce number of
11# exported symbols in a DLL. Use --disable-ld-version-script to work
12# around the problem.
13
14# gl_LD_VERSION_SCRIPT
15# --------------------
16# Check if LD supports linker scripts, and define automake conditional
17# HAVE_LD_VERSION_SCRIPT if so.
18AC_DEFUN([gl_LD_VERSION_SCRIPT],
19[
20 AC_ARG_ENABLE([ld-version-script],
21 [AS_HELP_STRING([--enable-ld-version-script],
22 [enable linker version script (default is enabled when possible)])],
23 [have_ld_version_script=$enableval],
24 [AC_CACHE_CHECK([if LD -Wl,--version-script works],
25 [gl_cv_sys_ld_version_script],
26 [gl_cv_sys_ld_version_script=no
27 save_LDFLAGS=$LDFLAGS
28 LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
29 echo foo >conftest.map
30 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
31 [],
32 [cat > conftest.map <<EOF
33VERS_1 {
34 global: sym;
35};
36
37VERS_2 {
38 global: sym;
39} VERS_1;
40EOF
41 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
42 [gl_cv_sys_ld_version_script=yes])])
43 rm -f conftest.map
44 LDFLAGS=$save_LDFLAGS])
45 have_ld_version_script=$gl_cv_sys_ld_version_script])
46 AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT],
47 [test "$have_ld_version_script" = yes])
48])