Annotation of embedaddon/libiconv/srcm4/relocatable.m4, revision 1.1.1.1

1.1       misho       1: # relocatable.m4 serial 14
                      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: 
                      7: dnl From Bruno Haible.
                      8: 
                      9: dnl gl_RELOCATABLE([RELOCWRAPPER-DIR])
                     10: dnl ----------------------------------------------------------
                     11: dnl Support for relocatable programs.
                     12: dnl Supply RELOCWRAPPER-DIR as the directory where relocwrapper.c may be found.
                     13: AC_DEFUN([gl_RELOCATABLE],
                     14: [
                     15:   AC_REQUIRE([gl_RELOCATABLE_BODY])
                     16:   gl_RELOCATABLE_LIBRARY
                     17:   if test $RELOCATABLE = yes; then
                     18:     AC_LIBOBJ([progreloc])
                     19:   fi
                     20:   : ${RELOCATABLE_CONFIG_H_DIR='$(top_builddir)'}
                     21:   RELOCATABLE_SRC_DIR="\$(top_srcdir)/$gl_source_base"
                     22:   RELOCATABLE_BUILD_DIR="\$(top_builddir)/$gl_source_base"
                     23: ])
                     24: dnl The guts of gl_RELOCATABLE. Needs to be expanded only once.
                     25: AC_DEFUN([gl_RELOCATABLE_BODY],
                     26: [
                     27:   AC_REQUIRE([AC_PROG_INSTALL])
                     28:   dnl This AC_BEFORE invocation leads to unjustified autoconf warnings
                     29:   dnl when gl_RELOCATABLE_BODY is invoked more than once.
                     30:   dnl We need this AC_BEFORE because AC_PROG_INSTALL is documented to
                     31:   dnl overwrite earlier settings of INSTALL and INSTALL_PROGRAM (even
                     32:   dnl though in autoconf-2.52..2.60 it doesn't do so), but we want this
                     33:   dnl macro's setting of INSTALL_PROGRAM to persist.
                     34:   AC_BEFORE([AC_PROG_INSTALL],[gl_RELOCATABLE_BODY])
                     35:   AC_REQUIRE([AC_LIB_LIBPATH])
                     36:   AC_REQUIRE([gl_RELOCATABLE_LIBRARY_BODY])
                     37:   is_noop=no
                     38:   use_elf_origin_trick=no
                     39:   if test $RELOCATABLE = yes; then
                     40:     # --enable-relocatable implies --disable-rpath
                     41:     enable_rpath=no
                     42:     AC_CHECK_HEADERS([mach-o/dyld.h])
                     43:     AC_CHECK_FUNCS([_NSGetExecutablePath])
                     44:     case "$host_os" in
                     45:       mingw*) is_noop=yes ;;
                     46:       linux*) use_elf_origin_trick=yes ;;
                     47:     esac
                     48:     if test $is_noop = yes; then
                     49:       RELOCATABLE_LDFLAGS=:
                     50:       AC_SUBST([RELOCATABLE_LDFLAGS])
                     51:     else
                     52:       if test $use_elf_origin_trick = yes; then
                     53:         dnl Use the dynamic linker's support for relocatable programs.
                     54:         case "$ac_aux_dir" in
                     55:           /*) reloc_ldflags="$ac_aux_dir/reloc-ldflags" ;;
                     56:           *) reloc_ldflags="\$(top_builddir)/$ac_aux_dir/reloc-ldflags" ;;
                     57:         esac
                     58:         RELOCATABLE_LDFLAGS="\"$reloc_ldflags\" \"\$(host)\" \"\$(RELOCATABLE_LIBRARY_PATH)\""
                     59:         AC_SUBST([RELOCATABLE_LDFLAGS])
                     60:       else
                     61:         dnl Unfortunately we cannot define INSTALL_PROGRAM to a command
                     62:         dnl consisting of more than one word - libtool doesn't support this.
                     63:         dnl So we abuse the INSTALL_PROGRAM_ENV hook, originally meant for the
                     64:         dnl 'install-strip' target.
                     65:         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\""
                     66:         AC_SUBST([INSTALL_PROGRAM_ENV])
                     67:         case "$ac_aux_dir" in
                     68:           /*) INSTALL_PROGRAM="$ac_aux_dir/install-reloc" ;;
                     69:           *) INSTALL_PROGRAM="\$(top_builddir)/$ac_aux_dir/install-reloc" ;;
                     70:         esac
                     71:       fi
                     72:     fi
                     73:   fi
                     74:   AM_CONDITIONAL([RELOCATABLE_VIA_LD],
                     75:     [test $is_noop = yes || test $use_elf_origin_trick = yes])
                     76: 
                     77:   dnl RELOCATABLE_LIBRARY_PATH can be set in configure.ac. Default is empty.
                     78:   AC_SUBST([RELOCATABLE_LIBRARY_PATH])
                     79:   AC_SUBST([RELOCATABLE_CONFIG_H_DIR])
                     80:   AC_SUBST([RELOCATABLE_SRC_DIR])
                     81:   AC_SUBST([RELOCATABLE_BUILD_DIR])
                     82: ])
                     83: 
                     84: dnl Determine the platform dependent parameters needed to use relocatability:
                     85: dnl shlibpath_var.
                     86: AC_DEFUN([AC_LIB_LIBPATH],
                     87: [
                     88:   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD
                     89:   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
                     90:   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
                     91:   AC_CACHE_CHECK([for shared library path variable], [acl_cv_libpath], [
                     92:     LD="$LD" \
                     93:     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.libpath" "$host" > conftest.sh
                     94:     . ./conftest.sh
                     95:     rm -f ./conftest.sh
                     96:     acl_cv_libpath=${acl_cv_shlibpath_var:-none}
                     97:   ])
                     98:   shlibpath_var="$acl_cv_shlibpath_var"
                     99: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>