Fix Android build
[emacs.git] / admin / merge-pkg-config
blob8bceb0ba2ca8e09a514166b7b0547a6ada82ff6e
1 #! /bin/sh
2 # Merge pkg-config macros into Emacs sources.
3 # Typical usage:
5 # admin/merge-pkg-config
7 # Copyright 2014-2024 Free Software Foundation, Inc.
9 # This file is part of GNU Emacs.
11 # GNU Emacs is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # GNU Emacs is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
24 # written by Paul Eggert
27 # Maybe ACLOCAL_PATH is already set-up.
28 oIFS=$IFS
29 IFS=:
30 for dir in $ACLOCAL_PATH ''; do
31 test -n "$dir" && test -r "$dir/pkg.m4" && break
32 done
33 IFS=$oIFS
35 test -n "$dir"
36 } || {
37 # Use the pkg.m4 installed where aclocal knows about it.
38 # Maybe we are running our own aclocal, which doesn't know where
39 # the standard pkg.m4 is installed, so try running all the
40 # aclocal programs in our PATH.
41 oIFS=$IFS
42 IFS=:
43 for dir in $PATH ''; do
44 if test -n "$dir" && test -x "$dir/aclocal"; then
45 dir=$("$dir/aclocal" --print-ac-dir) && test -r "$dir/pkg.m4" && break
47 done
48 IFS=$oIFS
50 test -n "$dir"
51 } || {
52 printf >&2 '%s\n' "$0: cannot find pkg.m4"
53 exit 1
56 test -d m4 || {
57 printf >&2 '%s\n' "$0: please run this command in the main source directory"
58 exit 1
61 printf >&2 '%s\n' "$0: copying $dir/pkg.m4 to m4/pkg.m4"
63 cp "$dir"/pkg.m4 m4