comparison m4/relocatable.m4 @ 40193:5fd32d128129

relocatable-prog: Use wrapper-free installation also on Mac OS X. Reported by Paul Smith <psmith@gnu.org>. * build-aux/install-reloc: Accept a 'mode' argument as first argument. (func_relativize): New function, from gnulib-tool. Handle mode 'macosx' through invocations of 'otool' and 'install_name_tool'. * m4/relocatable.m4 (gl_RELOCATABLE_BODY): Determine use_macos_tools. If use_macos_tools is true, set INSTALL_PROGRAM_ENV to an 'install-reloc' invocation with mode 'macosx'.
author Bruno Haible <bruno@clisp.org>
date Sat, 23 Feb 2019 22:42:54 +0100
parents cd38408f509a
children 9734faea5d7b
comparison
equal deleted inserted replaced
40192:cd38408f509a 40193:5fd32d128129
1 # relocatable.m4 serial 21 1 # relocatable.m4 serial 22
2 dnl Copyright (C) 2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. 2 dnl Copyright (C) 2003, 2005-2007, 2009-2019 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation 3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it, 4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved. 5 dnl with or without modifications, as long as this notice is preserved.
6 6
32 AC_REQUIRE([AC_LIB_LIBPATH]) 32 AC_REQUIRE([AC_LIB_LIBPATH])
33 AC_REQUIRE([gl_RELOCATABLE_LIBRARY_BODY]) 33 AC_REQUIRE([gl_RELOCATABLE_LIBRARY_BODY])
34 AC_REQUIRE([AC_CANONICAL_HOST]) 34 AC_REQUIRE([AC_CANONICAL_HOST])
35 is_noop=no 35 is_noop=no
36 use_elf_origin_trick=no 36 use_elf_origin_trick=no
37 use_macos_tools=no
37 use_wrapper=no 38 use_wrapper=no
38 if test $RELOCATABLE = yes; then 39 if test $RELOCATABLE = yes; then
39 # --enable-relocatable implies --disable-rpath 40 # --enable-relocatable implies --disable-rpath
40 enable_rpath=no 41 enable_rpath=no
41 AC_CHECK_HEADERS([mach-o/dyld.h]) 42 AC_CHECK_HEADERS([mach-o/dyld.h])
72 # Solaris >= 10: yes. 73 # Solaris >= 10: yes.
73 solaris | solaris2.[1-9] | solaris2.[1-9].*) ;; 74 solaris | solaris2.[1-9] | solaris2.[1-9].*) ;;
74 solaris*) use_elf_origin_trick=yes ;; 75 solaris*) use_elf_origin_trick=yes ;;
75 # Haiku: yes. 76 # Haiku: yes.
76 haiku*) use_elf_origin_trick=yes ;; 77 haiku*) use_elf_origin_trick=yes ;;
78 # On Mac OS X 10.4 or newer, use Mac OS X tools. See
79 # <https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath>.
80 darwin | darwin[1-8].*) ;;
81 darwin*) use_macos_tools=yes ;;
77 changequote([,])dnl 82 changequote([,])dnl
78 esac 83 esac
79 if test $is_noop = yes; then 84 if test $is_noop = yes; then
80 RELOCATABLE_LDFLAGS=: 85 RELOCATABLE_LDFLAGS=:
81 AC_SUBST([RELOCATABLE_LDFLAGS]) 86 AC_SUBST([RELOCATABLE_LDFLAGS])
87 *) reloc_ldflags="\$(top_builddir)/$ac_aux_dir/reloc-ldflags" ;; 92 *) reloc_ldflags="\$(top_builddir)/$ac_aux_dir/reloc-ldflags" ;;
88 esac 93 esac
89 RELOCATABLE_LDFLAGS="\"$reloc_ldflags\" \"\$(host)\" \"\$(RELOCATABLE_LIBRARY_PATH)\"" 94 RELOCATABLE_LDFLAGS="\"$reloc_ldflags\" \"\$(host)\" \"\$(RELOCATABLE_LIBRARY_PATH)\""
90 AC_SUBST([RELOCATABLE_LDFLAGS]) 95 AC_SUBST([RELOCATABLE_LDFLAGS])
91 else 96 else
92 use_wrapper=yes
93 dnl Unfortunately we cannot define INSTALL_PROGRAM to a command 97 dnl Unfortunately we cannot define INSTALL_PROGRAM to a command
94 dnl consisting of more than one word - libtool doesn't support this. 98 dnl consisting of more than one word - libtool doesn't support this.
95 dnl So we abuse the INSTALL_PROGRAM_ENV hook, originally meant for the 99 dnl So we abuse the INSTALL_PROGRAM_ENV hook, originally meant for the
96 dnl 'install-strip' target. 100 dnl 'install-strip' target.
97 INSTALL_PROGRAM_ENV="RELOC_LIBRARY_PATH_VAR=\"$shlibpath_var\" RELOC_LIBRARY_PATH_VALUE=\"\$(RELOCATABLE_LIBRARY_PATH)\" RELOC_PREFIX=\"\$(prefix)\" RELOC_DESTDIR=\"\$(DESTDIR)\" 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_EXEEXT=\"\$(EXEEXT)\" RELOC_STRIP_PROG=\"\$(RELOCATABLE_STRIP)\" RELOC_INSTALL_PROG=\"$INSTALL_PROGRAM\"" 101 if test $use_macos_tools = yes; then
102 INSTALL_PROGRAM_ENV="RELOC_MODE=macosx RELOC_PREFIX=\"\$(prefix)\" RELOC_DESTDIR=\"\$(DESTDIR)\" RELOC_STRIP_PROG=\"\$(RELOCATABLE_STRIP)\" RELOC_INSTALL_PROG=\"$INSTALL_PROGRAM\""
103 else
104 use_wrapper=yes
105 INSTALL_PROGRAM_ENV="RELOC_MODE=wrapper RELOC_LIBRARY_PATH_VAR=\"$shlibpath_var\" RELOC_LIBRARY_PATH_VALUE=\"\$(RELOCATABLE_LIBRARY_PATH)\" RELOC_PREFIX=\"\$(prefix)\" RELOC_DESTDIR=\"\$(DESTDIR)\" 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_EXEEXT=\"\$(EXEEXT)\" RELOC_STRIP_PROG=\"\$(RELOCATABLE_STRIP)\" RELOC_INSTALL_PROG=\"$INSTALL_PROGRAM\""
106 fi
98 AC_SUBST([INSTALL_PROGRAM_ENV]) 107 AC_SUBST([INSTALL_PROGRAM_ENV])
99 case "$ac_aux_dir" in 108 case "$ac_aux_dir" in
100 /*) INSTALL_PROGRAM="$ac_aux_dir/install-reloc" ;; 109 /*) INSTALL_PROGRAM="$ac_aux_dir/install-reloc" ;;
101 *) INSTALL_PROGRAM="\$(top_builddir)/$ac_aux_dir/install-reloc" ;; 110 *) INSTALL_PROGRAM="\$(top_builddir)/$ac_aux_dir/install-reloc" ;;
102 esac 111 esac