1 # relocatable.m4 serial 2 (gettext-0.13)
2 dnl Copyright (C) 2003 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.
9 dnl Support for relocateble programs.
10 AC_DEFUN([AC_RELOCATABLE],
12 AC_REQUIRE([AC_PROG_INSTALL])
13 AC_BEFORE([AC_PROG_INSTALL],[AC_RELOCATABLE])
14 AC_REQUIRE([AC_LIB_LIBPATH])
15 AC_REQUIRE([AC_RELOCATABLE_LIBRARY])
16 use_elf_origin_trick=no
17 if test $RELOCATABLE = yes; then
18 # --enable-relocatable implies --disable-rpath
20 AC_LIBOBJ([relocatable])
21 AC_DEFINE([ENABLE_RELOCATABLE], 1,
22 [Define to 1 if the package shall run at any location in the filesystem.])
24 linux*) use_elf_origin_trick=yes ;;
26 if test $use_elf_origin_trick = yes; then
27 dnl Use the dynamic linker's support for relocatable programs.
29 /*) reloc_ldflags="$ac_aux_dir/reloc-ldflags" ;;
30 *) reloc_ldflags="\$(top_builddir)/$ac_aux_dir/reloc-ldflags" ;;
32 SET_RELOCATABLE="RELOCATABLE_LDFLAGS = \"$reloc_ldflags\" \"\$(host)\" \"\$(RELOCATABLE_LIBRARY_PATH)\""
34 dnl Unfortunately we cannot define INSTALL_PROGRAM to a command
35 dnl consisting of more than one word - libtool doesn't support this.
36 dnl So we abuse the INSTALL_PROGRAM_ENV hook, originally meant for the
37 dnl 'install-strip' target.
38 SET_RELOCATABLE="INSTALL_PROGRAM_ENV = RELOC_LIBRARY_PATH_VAR=\"$shlibpath_var\" RELOC_LIBRARY_PATH_VALUE=\"\$(RELOCATABLE_LIBRARY_PATH)\" RELOC_PREFIX=\"\$(prefix)\" RELOC_COMPILE_COMMAND=\"\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(LDFLAGS)\" RELOC_SRCDIR=\"\$(RELOCATABLE_SRC_DIR)\" RELOC_BUILDDIR=\"\$(RELOCATABLE_BUILD_DIR)\" RELOC_CONFIG_H_DIR=\"\$(RELOCATABLE_CONFIG_H_DIR)\" RELOC_INSTALL_PROG=\"$INSTALL_PROGRAM\""
40 /*) INSTALL_PROGRAM="$ac_aux_dir/install-reloc" ;;
41 *) INSTALL_PROGRAM="\$(top_builddir)/$ac_aux_dir/install-reloc" ;;
47 AC_SUBST([SET_RELOCATABLE])
48 AM_CONDITIONAL([RELOCATABLE_VIA_LD],
49 [test $use_elf_origin_trick = yes])
52 dnl Support for relocatable libraries.
53 AC_DEFUN([AC_RELOCATABLE_LIBRARY],
55 AC_REQUIRE([AC_RELOCATABLE_NOP])
56 dnl Easier to put this here once, instead of into the DEFS of each Makefile.
57 if test "X$prefix" = "XNONE"; then
58 reloc_final_prefix="$ac_default_prefix"
60 reloc_final_prefix="$prefix"
62 AC_DEFINE_UNQUOTED([INSTALLPREFIX], ["${reloc_final_prefix}"],
63 [Define to the value of ${prefix}, as a string.])
66 dnl Support for relocatable packages for which it is a nop.
67 AC_DEFUN([AC_RELOCATABLE_NOP],
69 AC_MSG_CHECKING([whether to activate relocatable installation])
70 AC_ARG_ENABLE(relocatable,
71 [ --enable-relocatable install a package that can be moved in the filesystem],
72 [if test "$enableval" != no; then
79 AC_MSG_RESULT([$RELOCATABLE])
82 dnl Determine the platform dependent parameters needed to use relocatability:
84 AC_DEFUN([AC_LIB_LIBPATH],
86 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD
87 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
88 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
89 AC_CACHE_CHECK([for shared library path variable], acl_cv_libpath, [
91 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.libpath" "$host" > conftest.sh
94 acl_cv_libpath=${acl_cv_shlibpath_var:-none}
96 shlibpath_var="$acl_cv_shlibpath_var"