You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

autogen.sh 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. set -e
  3. case "$(uname)" in
  4. Darwin)
  5. LIBTOOLIZE=${LIBTOOLIZE:-glibtoolize}
  6. ;;
  7. *)
  8. LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
  9. ;;
  10. esac
  11. AUTORECONF=${AUTORECONF:-autoreconf}
  12. ACLOCAL=${ACLOCAL:-aclocal}
  13. AUTOCONF=${AUTOCONF:-autoconf}
  14. AUTOHEADER=${AUTOHEADER:-autoheader}
  15. AUTOMAKE=${AUTOMAKE:-automake}
  16. # Check we have all tools installed
  17. check_command() {
  18. command -v "${1}" > /dev/null 2>&1 || {
  19. >&2 echo "autogen.sh: could not find \`$1'. \`$1' is required to run autogen.sh."
  20. exit 1
  21. }
  22. }
  23. check_command "$LIBTOOLIZE"
  24. check_command "$AUTORECONF"
  25. check_command "$ACLOCAL"
  26. check_command "$AUTOCONF"
  27. check_command "$AUTOHEADER"
  28. check_command "$AUTOMAKE"
  29. # Absence of pkg-config or misconfiguration can make some odd error
  30. # messages, we check if it is installed correctly. See:
  31. # https://blogs.oracle.com/mandy/entry/autoconf_weirdness
  32. #
  33. # We cannot just check for pkg-config command, we need to check for
  34. # PKG_* macros. The pkg-config command can be defined in ./configure,
  35. # we cannot tell anything when not present.
  36. check_pkg_config() {
  37. grep -q '^AC_DEFUN.*PKG_CHECK_MODULES' aclocal.m4 || {
  38. cat <<EOF >&2
  39. autogen.sh: could not find PKG_CHECK_MODULES macro.
  40. Either pkg-config is not installed on your system or
  41. \`pkg.m4' is missing or not found by aclocal.
  42. If \`pkg.m4' is installed at an unusual location, re-run
  43. \`autogen.sh' by setting \`ACLOCAL_FLAGS':
  44. ACLOCAL_FLAGS="-I <prefix>/share/aclocal" ./autogen.sh
  45. EOF
  46. exit 1
  47. }
  48. }
  49. echo "autogen.sh: reconfigure with autoreconf"
  50. ${AUTORECONF} -vif -I m4 || {
  51. echo "autogen.sh: autoreconf has failed ($?), let's do it manually"
  52. [ -f ./configure.ac ] || [ -f ./configure.in ] || continue
  53. echo "autogen.sh: configure `basename $PWD`"
  54. ${ACLOCAL} -I m4 ${ACLOCAL_FLAGS}
  55. check_pkg_config
  56. ${LIBTOOLIZE} --automake --copy --force
  57. ${ACLOCAL} -I m4 ${ACLOCAL_FLAGS}
  58. ${AUTOCONF} --force
  59. ${AUTOHEADER}
  60. ${AUTOMAKE} --add-missing --copy --force-missing
  61. }
  62. bin/configure-help-replace.sh
  63. echo "autogen.sh: for the next step, run './configure' [or './configure --help' to check available options]"
  64. exit 0