ld-version-script.m4 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # ld-version-script.m4 serial 4
  2. dnl Copyright (C) 2008-2017 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. [AC_CACHE_CHECK([if LD -Wl,--version-script works],
  22. [gl_cv_sys_ld_version_script],
  23. [gl_cv_sys_ld_version_script=no
  24. save_LDFLAGS=$LDFLAGS
  25. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  26. echo foo >conftest.map
  27. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  28. [],
  29. [cat > conftest.map <<EOF
  30. VERS_1 {
  31. global: sym;
  32. };
  33. VERS_2 {
  34. global: sym;
  35. } VERS_1;
  36. EOF
  37. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  38. [gl_cv_sys_ld_version_script=yes])])
  39. rm -f conftest.map
  40. LDFLAGS=$save_LDFLAGS])
  41. have_ld_version_script=$gl_cv_sys_ld_version_script])
  42. AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT],
  43. [test "$have_ld_version_script" = yes])
  44. ])