automagic 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. die() {
  3. echo "Fatal: "$@
  4. exit 1
  5. }
  6. AUTOHEADER=$(which autoheader)
  7. AUTOCONF=$(which autoconf)
  8. LIBTOOLIZE=$(which libtoolize)
  9. ACLOCAL=$(which aclocal)
  10. AUTOMAKE=$(which automake)
  11. [[ -x ${AUTOHEADER} ]] || die "Could not find autoheader. Install autoconf."
  12. [[ -x ${AUTOCONF} ]] || die "Could not find autoconf."
  13. [[ -x ${LIBTOOLIZE} ]] || die "Could not find libtoolize. Install libtool."
  14. [[ -x ${ACLOCAL} ]] || die "Could not find aclocal. Install automake."
  15. [[ -x ${AUTOMAKE} ]] || die "Could not find automake."
  16. automagic() {
  17. if ! sh platform/unix/gen-makefile; then
  18. echo "You should be doing this from the root directory of the project."
  19. exit 1
  20. fi
  21. ${AUTOHEADER} 2>&1 || return 1 # Gimmie config.h.in
  22. ${LIBTOOLIZE} --force 2>&1 || return 1
  23. ${ACLOCAL} 2>&1 || return 1
  24. ${AUTOCONF} 2>&1 || return 1
  25. ${AUTOMAKE} -a 2>&1 || return 1
  26. }
  27. if [[ $1 == "-d" ]]; then
  28. automagic
  29. else
  30. automagic > /dev/null
  31. fi
  32. if [ $? -eq 1 ]; then
  33. echo "Failed, please contact the developers."
  34. exit 1
  35. else
  36. echo "Success, carry on configuring."
  37. fi