ld-version-script.m4 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # ld-version-script.m4 serial 2
  2. dnl Copyright (C) 2008-2011 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.
  6. dnl From Simon Josefsson
  7. # FIXME: The test below returns a false positive for mingw
  8. # cross-compiles, 'local:' statements does not reduce number of
  9. # exported symbols in a DLL. Use --disable-ld-version-script to work
  10. # around the problem.
  11. # gl_LD_VERSION_SCRIPT
  12. # --------------------
  13. # Check if LD supports linker scripts, and define automake conditional
  14. # HAVE_LD_VERSION_SCRIPT if so.
  15. AC_DEFUN([gl_LD_VERSION_SCRIPT],
  16. [
  17. AC_ARG_ENABLE([ld-version-script],
  18. AS_HELP_STRING([--enable-ld-version-script],
  19. [enable linker version script (default is enabled when possible)]),
  20. [have_ld_version_script=$enableval], [])
  21. if test -z "$have_ld_version_script"; then
  22. AC_MSG_CHECKING([if LD -Wl,--version-script works])
  23. save_LDFLAGS="$LDFLAGS"
  24. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  25. cat > conftest.map <<EOF
  26. VERS_1 {
  27. global: sym;
  28. };
  29. VERS_2 {
  30. global: sym;
  31. } VERS_1;
  32. EOF
  33. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  34. [have_ld_version_script=yes], [have_ld_version_script=no])
  35. rm -f conftest.map
  36. LDFLAGS="$save_LDFLAGS"
  37. AC_MSG_RESULT($have_ld_version_script)
  38. fi
  39. AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
  40. ])