Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
2.8KB

  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2008 Jonathan Moore Liles
  4. # This file is licensed under version 2 of the GPL.
  5. . scripts/colors
  6. # support functions for 'configure' scripts.
  7. fatal ()
  8. {
  9. echo "$BOLD$RED$*$SGR0" > /dev/stderr
  10. exit 255
  11. }
  12. ask ()
  13. {
  14. local A D
  15. D="`eval echo \\$$2`"
  16. D=${D:-$3}
  17. echo -n "$BLACK$BOLD::$SGR0 $1 [$BOLD${D}$SGR0] "
  18. read A
  19. A=${A:-$D}
  20. if [ "$3" = yes ] || [ "$3" = no ]
  21. then
  22. case "$A" in
  23. no | n | N) A=no ;;
  24. yes | y | Y) A=yes ;;
  25. * ) fatal "Invalid response. Must be 'yes' or 'no'" ;;
  26. esac
  27. fi
  28. echo "${2}=${A:-$D}" >> make.conf
  29. }
  30. ok ()
  31. {
  32. echo "$BOLD${GREEN}ok${SGR0}"
  33. }
  34. failed ()
  35. {
  36. echo "$BOLD${RED}failed!${SGR0}" > /dev/stderr
  37. rm -f make.conf
  38. }
  39. using ()
  40. {
  41. [ "`eval echo \\$USE_$1`" = yes ]
  42. return $?
  43. }
  44. extract_options ()
  45. {
  46. local OIFS
  47. if [ -f make.conf ]
  48. then
  49. OIFS="$IFS"
  50. IFS=''
  51. eval "`sed -n '/^## options/{ : i; /^## libs/{ q }; p; n; b i }' make.conf`"
  52. IFS="$OIFS"
  53. fi
  54. }
  55. begin ()
  56. {
  57. echo -n "Checking sanity..."
  58. require_command pkg-config pkg-config > /dev/null
  59. require_command sed sed > /dev/null
  60. ok
  61. }
  62. begin_options ()
  63. {
  64. # get the old values
  65. extract_options
  66. echo "# This file was automatically generated on `date`. Any changes may be lost!" > make.conf
  67. echo "## options" >> make.conf
  68. echo "--- Configuration required ---"
  69. }
  70. begin_tests ()
  71. {
  72. echo "## libs" >> make.conf
  73. extract_options
  74. }
  75. append ()
  76. {
  77. echo "$1" >> make.conf
  78. }
  79. end ()
  80. {
  81. echo "--- Configuration complete ---"
  82. }
  83. require_command ()
  84. {
  85. echo -n "Checking for ${BOLD}$1${SGR0}..."
  86. if ! [ -x "`which $2`" ]
  87. then
  88. failed
  89. fatal "Command $1 not found."
  90. else
  91. ok
  92. fi
  93. }
  94. require_package ()
  95. {
  96. echo -n "Checking for $BOLD$1$SGR0..."
  97. if ! pkg-config --exists $3
  98. then
  99. failed
  100. fatal "Required package $1 doesn't appear to be installed."
  101. elif ! pkg-config --atleast-version $2 $3
  102. then
  103. failed
  104. fatal "The installed version of $1 (`pkg-config --mod-version $3`) is too old."
  105. fi
  106. append "${1}_LIBS=`pkg-config --libs $3`"
  107. append "${1}_CFLAGS=-DHAVE_${1} `pkg-config --cflags $3`"
  108. ok
  109. return 0
  110. }
  111. require_FLTK ()
  112. {
  113. echo -n "Checking for ${BOLD}FLTK${SGR0}..."
  114. FLTK_VERSION=`fltk-config --version`
  115. FLTK_VERSION_MAJOR=`echo $FLTK_VERSION | cut -d'.' -f1`
  116. FLTK_VERSION_MINOR=`echo $FLTK_VERSION | cut -d'.' -f2`
  117. FLTK_VERSION_MICRO=`echo $FLTK_VERSION | cut -d'.' -f3`
  118. if ! ( [ $FLTK_VERSION_MAJOR -ge $1 ] && [ $FLTK_VERSION_MINOR -ge $2 ] && [ $FLTK_VERSION_MICRO -ge $3 ] )
  119. then
  120. failed
  121. fatal "The installed FLTK version ($FLTK_VERSION) is too old."
  122. else
  123. ok
  124. fi
  125. append "FLTK_LIBS=`fltk-config --use-images --ldflags`"
  126. append "FLTK_CFLAGS=`fltk-config --cflags`"
  127. }