maint: update copyright
[gnulib.git] / m4 / non-recursive-gnulib-prefix-hack.m4
1 dnl Copyright (C) 2012-2014 Free Software Foundation, Inc.
2 dnl This file is free software; the Free Software Foundation
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5
6 dnl gl_NON_RECURSIVE_GNULIB_PREFIX_HACK LIB_DIR
7 dnl Adjust configure-set $gl_LIBOBJS and each AC_SUBST'd *_H variable
8 dnl with a value ending in ".h" to reflect that these files are located
9 dnl in the directory specified by LIB_DIR.
10 AC_DEFUN([gl_NON_RECURSIVE_GNULIB_PREFIX_HACK],
11 [
12   # Tell AC_LIBSOURCES where to find source files like alloca.c.
13   AC_CONFIG_LIBOBJ_DIR([lib])
14
15   # This hack originated in bison.  It is required when using non-recursive
16   # automake rules to build from gnulib-provided lib/ sources.  Hence, LIB_DIR
17   # is usually simply "lib".  Those rules use the list of names like "fchdir.o"
18   # and "strstr.o" in gl_LIBOBJS.  With non-recursive make, we must prefix each
19   # such file name with the "lib/" prefix.  See also build-aux/prefix-gnulib-mk.
20   gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, , $1/,g'`
21
22   # Listing the names of the variables to prefix is error-prone.
23   # Rather, adjust each AC_SUBST'd variable whose name ends in '_H'
24   # and whose value ends in '.h'.
25   for ac_var in $ac_subst_vars
26   do
27     eval "ac_val=\$$ac_var"
28     case $ac_var:$ac_val in
29       (*_H:*.h) eval "$ac_var=$1/\$$ac_var";;
30     esac
31   done
32 ])