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.

172 lines
3.0KB

  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. append "${2}=${A:-$D}"
  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 line;
  47. if [ -f make.conf ]
  48. then
  49. {
  50. while read line
  51. do
  52. [ "$line" = "## options" ] && break
  53. done
  54. while read line
  55. do
  56. if [ "$line" = "## libs" ]
  57. then
  58. break
  59. else
  60. eval "$line"
  61. fi
  62. done
  63. } < make.conf
  64. fi
  65. }
  66. begin ()
  67. {
  68. echo -n "Checking sanity..."
  69. require_command pkg-config pkg-config > /dev/null
  70. ok
  71. }
  72. begin_options ()
  73. {
  74. # get the old values
  75. extract_options
  76. echo > make.conf
  77. append "# This file was automatically generated on `date`. Any changes may be lost!"
  78. append "## options"
  79. echo "--- Configuration required ---"
  80. }
  81. begin_tests ()
  82. {
  83. append "## libs"
  84. extract_options
  85. }
  86. append ()
  87. {
  88. echo "$1" >> make.conf
  89. }
  90. end ()
  91. {
  92. echo "--- Configuration complete ---"
  93. touch make.conf
  94. }
  95. require_command ()
  96. {
  97. echo -n "Checking for ${BOLD}$1${SGR0}..."
  98. if ! [ -x "`which $2`" ]
  99. then
  100. failed
  101. fatal "Command $1 not found."
  102. else
  103. ok
  104. fi
  105. }
  106. require_package ()
  107. {
  108. echo -n "Checking for $BOLD$1$SGR0..."
  109. if ! pkg-config --exists $3
  110. then
  111. failed
  112. fatal "Required package $1 doesn't appear to be installed."
  113. elif ! pkg-config --atleast-version $2 $3
  114. then
  115. failed
  116. fatal "The installed version of $1 (`pkg-config --mod-version $3`) is too old."
  117. fi
  118. append "${1}_LIBS=`pkg-config --libs $3`"
  119. append "${1}_CFLAGS=-DHAVE_${1} `pkg-config --cflags $3`"
  120. ok
  121. return 0
  122. }
  123. require_FLTK ()
  124. {
  125. echo -n "Checking for ${BOLD}FLTK${SGR0}..."
  126. FLTK_VERSION=`fltk-config --version`
  127. FLTK_VERSION_MAJOR=`echo $FLTK_VERSION | cut -d'.' -f1`
  128. FLTK_VERSION_MINOR=`echo $FLTK_VERSION | cut -d'.' -f2`
  129. FLTK_VERSION_MICRO=`echo $FLTK_VERSION | cut -d'.' -f3`
  130. if ! ( [ $FLTK_VERSION_MAJOR -ge $1 ] && [ $FLTK_VERSION_MINOR -ge $2 ] && [ $FLTK_VERSION_MICRO -ge $3 ] )
  131. then
  132. failed
  133. fatal "The installed FLTK version ($FLTK_VERSION) is too old."
  134. else
  135. ok
  136. fi
  137. append "FLTK_LIBS=`fltk-config --use-images --ldflags`"
  138. append "FLTK_CFLAGS=`fltk-config --cflags`"
  139. }