the small playstation sound emulator

autogen.sh 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #! /bin/sh
  2. TOP_DIR=$(dirname $0)
  3. LAST_DIR=$PWD
  4. if test ! -f $TOP_DIR/configure.ac ; then
  5. echo "You must execute this script from the top level directory."
  6. exit 1
  7. fi
  8. AUTOCONF=${AUTOCONF:-autoconf}
  9. ACLOCAL=${ACLOCAL:-aclocal}
  10. AUTOHEADER=${AUTOHEADER:-autoheader}
  11. dump_help_screen ()
  12. {
  13. echo "Usage: gen-auto-scripts.sh [options]"
  14. echo
  15. echo "options:"
  16. echo " -n skip CVS changelog creation"
  17. echo " -h,--help show this help screen"
  18. echo
  19. exit 0
  20. }
  21. parse_options ()
  22. {
  23. while test "$1" != "" ; do
  24. case $1 in
  25. -h|--help)
  26. dump_help_screen
  27. ;;
  28. -n)
  29. SKIP_CVS_CHANGELOG=yes
  30. ;;
  31. *)
  32. echo Invalid argument - $1
  33. dump_help_screen
  34. ;;
  35. esac
  36. shift
  37. done
  38. }
  39. run_or_die ()
  40. {
  41. COMMAND=$1
  42. # check for empty commands
  43. if test -z "$COMMAND" ; then
  44. echo "*warning* no command specified"
  45. return 1
  46. fi
  47. shift;
  48. OPTIONS="$@"
  49. # print a message
  50. echo -n "*info* running $COMMAND"
  51. if test -n "$OPTIONS" ; then
  52. echo " ($OPTIONS)"
  53. else
  54. echo
  55. fi
  56. # run or die
  57. $COMMAND $OPTIONS ; RESULT=$?
  58. if test $RESULT -ne 0 ; then
  59. echo "*error* $COMMAND failed. (exit code = $RESULT)"
  60. exit 1
  61. fi
  62. return 0
  63. }
  64. parse_options "$@"
  65. cd $TOP_DIR
  66. run_or_die $ACLOCAL -I m4
  67. run_or_die $AUTOHEADER
  68. run_or_die $AUTOCONF
  69. cd $LAST_DIR