ax_isc_rpath.m4 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. dnl @synopsis AX_ISC_RPATH
  2. dnl
  3. dnl @summary figure out whether and which "rpath" linker option is available
  4. dnl
  5. dnl This macro checks if the linker supports an option to embed a path
  6. dnl to a runtime library (often installed in an uncommon place), such as
  7. dnl gcc's -rpath option. If found, it sets the ISC_RPATH_FLAG variable to
  8. dnl the found option flag. The main configure.ac can use it as follows:
  9. dnl if test "x$ISC_RPATH_FLAG" != "x"; then
  10. dnl LDFLAGS="$LDFLAGS ${ISC_RPATH_FLAG}/usr/local/lib/some_library"
  11. dnl fi
  12. AC_DEFUN([AX_ISC_RPATH], [
  13. # check -R and -Wl,-R rather than gcc specific -rpath to be as portable
  14. # as possible.
  15. AC_MSG_CHECKING([whether -R flag is available in linker])
  16. LDFLAGS_SAVED="$LDFLAGS"
  17. LDFLAGS="$LDFLAGS -R/usr/lib"
  18. AC_TRY_LINK([],[],
  19. [ AC_MSG_RESULT(yes)
  20. ISC_RPATH_FLAG=-R
  21. ],[ AC_MSG_RESULT(no)
  22. AC_MSG_CHECKING([whether -Wl,-R flag is available in linker])
  23. LDFLAGS="$LDFLAGS_SAVED -Wl,-R"
  24. AC_TRY_LINK([], [],
  25. [ AC_MSG_RESULT(yes)
  26. ISC_RPATH_FLAG=-Wl,-R
  27. ],[ AC_MSG_RESULT(no) ])
  28. ])
  29. LDFLAGS=$LDFLAGS_SAVED
  30. ])dnl AX_ISC_RPATH