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.

142 lines
2.6KB

  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 answer default
  15. default="`eval echo \\$$2`"
  16. default=${default:-$3}
  17. echo -n "$BLACK$BOLD::$SGR0 $1 [$BOLD$3$SGR0] "
  18. read answer
  19. echo "${2}=${answer:-$default}" >> make.conf
  20. }
  21. ok ()
  22. {
  23. echo "$BOLD${GREEN}ok${SGR0}."
  24. }
  25. failed ()
  26. {
  27. echo "$BOLD${RED}failed!${SGR0}" > /dev/stderr
  28. rm -f make.conf
  29. }
  30. extract_options ()
  31. {
  32. local OIFS
  33. if [ -f make.conf ]
  34. then
  35. OIFS="$IFS"
  36. IFS=''
  37. eval "`sed -n '/^## options/{ : i; /^## libs/{ q }; p; n; b i }' make.conf`"
  38. IFS="$OIFS"
  39. fi
  40. }
  41. begin ()
  42. {
  43. echo -n "Checking sanity..."
  44. require_command pkg-config pkg-config > /dev/null
  45. require_command sed sed > /dev/null
  46. ok
  47. }
  48. begin_options ()
  49. {
  50. # get the old values
  51. extract_options
  52. echo "# This is a generated file. Any changes may be lost!" > make.conf
  53. echo "## options" >> make.conf
  54. echo "--- Configuration required ---"
  55. }
  56. begin_tests ()
  57. {
  58. echo "## libs/flags" >> make.conf
  59. extract_options
  60. }
  61. append ()
  62. {
  63. echo "$1" >> make.conf
  64. }
  65. end ()
  66. {
  67. echo "--- Configuration complete ---"
  68. }
  69. require_command ()
  70. {
  71. echo -n "Checking for ${BOLD}$1${SGR0}..."
  72. if ! [ -x "`which $2`" ]
  73. then
  74. failed
  75. fatal "Command $1 not found."
  76. else
  77. ok
  78. fi
  79. }
  80. require_package ()
  81. {
  82. echo -n "Checking for $BOLD$1$SGR0..."
  83. if ! pkg-config --exists $3
  84. then
  85. failed
  86. fatal "Required package $1 doesn't appear to be installed."
  87. elif ! pkg-config --atleast-version $2 $3
  88. then
  89. failed
  90. fatal "The installed version of $1 (`pkg-config --mod-version $3`) is too old."
  91. fi
  92. append "${1}_LIBS=`pkg-config --libs $3`"
  93. append "${1}_CFLAGS=-DHAVE_${1} `pkg-config --cflags $3`"
  94. ok
  95. return 0
  96. }
  97. require_FLTK ()
  98. {
  99. echo -n "Checking for ${BOLD}FLTK${SGR0}..."
  100. FLTK_VERSION=`fltk-config --version`
  101. FLTK_VERSION_MAJOR=`echo $FLTK_VERSION | cut -d'.' -f1`
  102. FLTK_VERSION_MINOR=`echo $FLTK_VERSION | cut -d'.' -f2`
  103. FLTK_VERSION_PATCH=`echo $FLTK_VERSION | cut -d'.' -f3`
  104. if ! ( [ $FLTK_VERSION_MAJOR -ge $1 ] && [ $FLTK_VERSION_MINOR -ge $2 ] && [ $FLTK_VERSION_PATCH -ge $3 ] )
  105. then
  106. failed
  107. fatal "The installed FLTK version ($FLTK_VERSION) is too old."
  108. else
  109. ok
  110. fi
  111. append "FLTK_LIBS=`fltk-config --use-images --ldflags`"
  112. append "FLTK_CFLAGS=`fltk-config --cflags`"
  113. }