bootstrap 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. aclocal -I m4 --install && \
  53. libtoolize -c -i -v && \
  54. autoconf && \
  55. autoheader && \
  56. automake -a -c --gnu || \
  57. echo "Trying with autoreconf..." &&
  58. autoreconf -vi ${1+"$@"} || \
  59. echo "*** Failed to build autoconf output files ***" >&2