1# relocatable-lib.m4 serial 6
2dnl Copyright (C) 2003, 2005-2007, 2009-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible.
8
9dnl Support for relocatable libraries.
10AC_DEFUN([gl_RELOCATABLE_LIBRARY],
11[
12  AC_REQUIRE([gl_RELOCATABLE_LIBRARY_BODY])
13])
14AC_DEFUN([gl_RELOCATABLE_LIBRARY_BODY],
15[
16  AC_REQUIRE([gl_RELOCATABLE_NOP])
17  dnl Easier to put this here once, instead of into the DEFS of each Makefile.
18  if test "X$prefix" = "XNONE"; then
19    reloc_final_prefix="$ac_default_prefix"
20  else
21    reloc_final_prefix="$prefix"
22  fi
23  AC_DEFINE_UNQUOTED([INSTALLPREFIX], ["${reloc_final_prefix}"],
24    [Define to the value of ${prefix}, as a string.])
25  if test $RELOCATABLE = yes; then
26    AC_DEFINE([ENABLE_RELOCATABLE], [1],
27      [Define to 1 if the package shall run at any location in the file
28       system.])
29  fi
30])
31
32dnl Support for relocatable packages for which it is a nop.
33AC_DEFUN([gl_RELOCATABLE_NOP],
34[
35  AC_MSG_CHECKING([whether to activate relocatable installation])
36  AC_ARG_ENABLE([relocatable],
37    [AS_HELP_STRING([--enable-relocatable],
38      [install a package that can be moved in the file system])],
39    [if test "$enableval" != no; then
40       RELOCATABLE=yes
41     else
42       RELOCATABLE=no
43     fi
44    ], RELOCATABLE=no)
45  AC_SUBST([RELOCATABLE])
46  AC_MSG_RESULT([$RELOCATABLE])
47])
48
49