bootstrap 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. unset bs_srcdir
  3. if test X"`dirname / 2>/dev/null`" = X"/"; then
  4. bs_scrdir=`dirname $0`
  5. else
  6. bs_scrdir="${0%/*}"
  7. fi
  8. test -n "$bs_scrdir" && cd "$bs_scrdir" || echo "Warning: cannot get sources directory" 1>&2
  9. # This is more portable than `which' but comes with
  10. # the caveat of not(?) properly working on busybox's ash:
  11. existence()
  12. {
  13. command -v "$1" >/dev/null 2>&1
  14. }
  15. if existence uncrustify; then
  16. echo "Installing uncrustify hook and configuration"
  17. # Install uncrustify format symlink (if possible)
  18. ln -s contrib/uncrustify.cfg uncrustify.cfg 2> /dev/null
  19. # Install pre-commit hook (if possible)
  20. ln -s ../../contrib/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null
  21. else
  22. echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development"
  23. fi
  24. if existence libtool || existence libtoolize || existence glibtoolize || existence slibtool; then
  25. echo "Running autotools..."
  26. aclocal -I m4 --install && \
  27. libtoolize -c -i -v && \
  28. autoconf && \
  29. autoheader && \
  30. automake -a -c --gnu
  31. if test $? -ne 0 || ! test -x configure || ! test -f Makefile.in ; then
  32. echo "Autotools failed, retrying with autoreconf..."
  33. if ! autoreconf -i ${1+"$@"} ; then
  34. echo "Failed to autoreconf, retrying with force install..."
  35. rm m4/po.m4 # Version of po.m4 should match installed po/* files
  36. if ! autoreconf -i -f ${1+"$@"} ; then
  37. echo "*** Failed to create 'configure' and other autotools generated files. ***" >&2
  38. exit 1
  39. fi
  40. fi
  41. fi
  42. echo "The ${bs_scrdir-.}/configure is ready to run."
  43. else
  44. echo "*** No libtoolize (libtool) or libtool found, please install it ***" >&2;
  45. exit 1
  46. fi