relocatable-lib.m4 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # relocatable-lib.m4 serial 4
  2. dnl Copyright (C) 2003, 2005-2007, 2009 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 Bruno Haible.
  7. dnl Support for relocatable libraries.
  8. AC_DEFUN([gl_RELOCATABLE_LIBRARY],
  9. [
  10. AC_REQUIRE([gl_RELOCATABLE_LIBRARY_BODY])
  11. if test $RELOCATABLE = yes; then
  12. AC_LIBOBJ([relocatable])
  13. fi
  14. ])
  15. AC_DEFUN([gl_RELOCATABLE_LIBRARY_BODY],
  16. [
  17. AC_REQUIRE([gl_RELOCATABLE_NOP])
  18. dnl Easier to put this here once, instead of into the DEFS of each Makefile.
  19. if test "X$prefix" = "XNONE"; then
  20. reloc_final_prefix="$ac_default_prefix"
  21. else
  22. reloc_final_prefix="$prefix"
  23. fi
  24. AC_DEFINE_UNQUOTED([INSTALLPREFIX], ["${reloc_final_prefix}"],
  25. [Define to the value of ${prefix}, as a string.])
  26. if test $RELOCATABLE = yes; then
  27. AC_DEFINE([ENABLE_RELOCATABLE], [1],
  28. [Define to 1 if the package shall run at any location in the filesystem.])
  29. fi
  30. ])
  31. dnl Like gl_RELOCATABLE_LIBRARY, except prepare for separate compilation
  32. dnl (no AC_LIBOBJ).
  33. AC_DEFUN([gl_RELOCATABLE_LIBRARY_SEPARATE],
  34. [
  35. AC_REQUIRE([gl_RELOCATABLE_LIBRARY_BODY])
  36. ])
  37. dnl Support for relocatable packages for which it is a nop.
  38. AC_DEFUN([gl_RELOCATABLE_NOP],
  39. [
  40. AC_MSG_CHECKING([whether to activate relocatable installation])
  41. AC_ARG_ENABLE([relocatable],
  42. [ --enable-relocatable install a package that can be moved in the filesystem],
  43. [if test "$enableval" != no; then
  44. RELOCATABLE=yes
  45. else
  46. RELOCATABLE=no
  47. fi
  48. ], RELOCATABLE=no)
  49. AC_SUBST([RELOCATABLE])
  50. AC_MSG_RESULT([$RELOCATABLE])
  51. ])