bootstrap 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/sh
  2. # This is more portable than `which' but comes with
  3. # the caveat of not(?) properly working on busybox's ash:
  4. have_command()
  5. {
  6. command -v "$1" >/dev/null 2>&1
  7. }
  8. unset bs_srcdir
  9. if test X"`dirname / 2>/dev/null`" = X"/"; then
  10. bs_scrdir=`dirname $0`
  11. else
  12. case $0 in
  13. */*) bs_scrdir=`echo $0 | ${SED-sed} -n -e 's|/[^/]*$||p'` ;;
  14. *) bs_scrdir='.' ;;
  15. esac
  16. fi
  17. test -n "$bs_scrdir" && cd "$bs_scrdir" || echo "Warning: cannot detect sources directory" 1>&2
  18. if test ! -f './configure.ac'; then
  19. echo "Error: no 'configure.ac' found. Wrong sources directory?" 1>&2
  20. exit 2
  21. fi
  22. if test ! -f './src/include/microhttpd.h'; then
  23. echo "Error: src/include/libmicrohttpd.h not found. Wrong sources directory?" 1>&2
  24. exit 2
  25. fi
  26. if have_command uncrustify; then
  27. if test -f uncrustify.cfg; then
  28. echo "Uncrustify configuration already exists, skipping installation from the upstream file."
  29. else
  30. echo "Installing libmicrohttpd uncrustify configuration"
  31. ln -s contrib/uncrustify.cfg uncrustify.cfg || \
  32. cp contrib/uncrustify.cfg uncrustify.cfg || \
  33. echo "Failed to install uncrustify configuration file" 1>&2
  34. fi
  35. if test -f uncrustify.cfg; then
  36. if test -d '.git'; then
  37. if test -f .git/hooks/pre-commit; then
  38. echo "Pre-commit git hook already exists, skipping installation from the upstream file."
  39. else
  40. echo "Installing uncrustify pre-commit git hook"
  41. ln -s ../../contrib/uncrustify_precommit .git/hooks/pre-commit || \
  42. cp ../../contrib/uncrustify_precommit .git/hooks/pre-commit || \
  43. echo "Failed to install pre-commit git hook" 1>&2
  44. fi
  45. else
  46. echo "No '.git' directory found, skipping installation of pre-commit git hook."
  47. fi
  48. fi
  49. else
  50. echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development."
  51. fi
  52. WANT_AUTOCONF=latest
  53. WANT_AUTOMAKE=latest
  54. export WANT_AUTOCONF
  55. export WANT_AUTOMAKE
  56. aclocal -I m4 --install && \
  57. libtoolize -c -i -v && \
  58. autoconf && \
  59. autoheader && \
  60. automake -a -c --gnu || \
  61. echo "Trying with autoreconf..." &&
  62. autoreconf -vi ${1+"$@"} || \
  63. echo "*** Failed to build autoconf output files ***" >&2