merge-pkg-config 1.7 KB

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