binreloc.m4 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Check for binary relocation support.
  2. # Written by Hongli Lai
  3. # http://autopackage.org/
  4. AC_DEFUN([AM_BINRELOC],
  5. [
  6. AC_ARG_ENABLE(binreloc,
  7. [ --enable-binreloc compile with binary relocation support
  8. (default=enable when available)],
  9. enable_binreloc=$enableval,enable_binreloc=auto)
  10. AC_ARG_ENABLE(binreloc-threads,
  11. [ --enable-binreloc-threads compile binary relocation with threads support
  12. (default=yes)],
  13. enable_binreloc_threads=$enableval,enable_binreloc_threads=yes)
  14. BINRELOC_CFLAGS=
  15. BINRELOC_LIBS=
  16. if test "x$enable_binreloc" = "xauto"; then
  17. AC_CHECK_FILE([/proc/self/maps])
  18. AC_CACHE_CHECK([whether everything is installed to the same prefix],
  19. [br_cv_valid_prefixes], [
  20. if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
  21. "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
  22. "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
  23. then
  24. br_cv_valid_prefixes=yes
  25. else
  26. br_cv_valid_prefixes=no
  27. fi
  28. ])
  29. fi
  30. AC_CACHE_CHECK([whether binary relocation support should be enabled],
  31. [br_cv_binreloc],
  32. [if test "x$enable_binreloc" = "xyes"; then
  33. br_cv_binreloc=yes
  34. elif test "x$enable_binreloc" = "xauto"; then
  35. if test "x$br_cv_valid_prefixes" = "xyes" -a \
  36. "x$ac_cv_file__proc_self_maps" = "xyes"; then
  37. br_cv_binreloc=yes
  38. else
  39. br_cv_binreloc=no
  40. fi
  41. else
  42. br_cv_binreloc=no
  43. fi])
  44. if test "x$br_cv_binreloc" = "xyes"; then
  45. BINRELOC_CFLAGS="-DENABLE_BINRELOC"
  46. AC_DEFINE(ENABLE_BINRELOC,,[Use binary relocation?])
  47. fi
  48. AC_SUBST(BINRELOC_CFLAGS)
  49. AC_SUBST(BINRELOC_LIBS)
  50. ])