build-requirements.sh 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #!/bin/sh
  2. ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
  3. check_ac_ver() {
  4. # autoconf 2.59 or newer
  5. ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;s/[- ].*//g;q'`
  6. if test -z "$ac_version"; then
  7. echo "build-requirements: autoconf not found."
  8. echo " You need autoconf version 2.59 or newer installed"
  9. echo " to build FreeSWITCH from source."
  10. exit 1
  11. fi
  12. if test `uname -s` = "OpenBSD" && test "$ac_version" = "2.62"; then
  13. echo "Autoconf 2.62 is broken on OpenBSD, please try another version"
  14. exit 1
  15. fi
  16. IFS=_; set $ac_version; IFS=' '
  17. ac_version=$1
  18. IFS=.; set $ac_version; IFS=' '
  19. if test "$1" = "2" -a "$2" -lt "59" || test "$1" -lt "2"; then
  20. echo "build-requirements: autoconf version $ac_version found."
  21. echo " You need autoconf version 2.59 or newer installed"
  22. echo " to build FreeSWITCH from source."
  23. exit 1
  24. else
  25. echo "build-requirements: autoconf version $ac_version (ok)"
  26. fi
  27. }
  28. check_am_ver() {
  29. # automake 1.7 or newer
  30. am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;s/[- ].*//g;q'`
  31. if test -z "$am_version"; then
  32. echo "build-requirements: automake not found."
  33. echo " You need automake version 1.7 or newer installed"
  34. echo " to build FreeSWITCH from source."
  35. exit 1
  36. fi
  37. IFS=_; set $am_version; IFS=' '
  38. am_version=$1
  39. IFS=.; set $am_version; IFS=' '
  40. if test "$1" = "1" -a "$2" -lt "7"; then
  41. echo "build-requirements: automake version $am_version found."
  42. echo " You need automake version 1.7 or newer installed"
  43. echo " to build FreeSWITCH from source."
  44. exit 1
  45. else
  46. echo "build-requirements: automake version $am_version (ok)"
  47. fi
  48. }
  49. check_acl_ver() {
  50. # aclocal 1.7 or newer
  51. acl_version=`${ACLOCAL:-aclocal} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;s/[- ].*//g;q'`
  52. if test -z "$acl_version"; then
  53. echo "build-requirements: aclocal not found."
  54. echo " You need aclocal version 1.7 or newer installed"
  55. echo " to build FreeSWITCH from source."
  56. exit 1
  57. fi
  58. IFS=_; set $acl_version; IFS=' '
  59. acl_version=$1
  60. IFS=.; set $acl_version; IFS=' '
  61. if test "$1" = "1" -a "$2" -lt "7"; then
  62. echo "build-requirements: aclocal version $acl_version found."
  63. echo " You need aclocal version 1.7 or newer installed"
  64. echo " to build FreeSWITCH from source."
  65. exit 1
  66. else
  67. echo "build-requirements: aclocal version $acl_version (ok)"
  68. fi
  69. }
  70. check_lt_ver() {
  71. # Sample libtool --version outputs:
  72. # ltmain.sh (GNU libtool) 1.3.3 (1.385.2.181 1999/07/02 15:49:11)
  73. # ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a
  74. # output is multiline from 1.5 onwards
  75. # find APR PrintPath binary path
  76. for el in "${LIBDIR}/apr/build/PrintPath" \
  77. "libs/apr/build/PrintPath" \
  78. "../libs/apr/build/PrintPath" \
  79. "../../libs/apr/build/PrintPath"; do
  80. if test -f "$el"; then
  81. PrintPathBin="$el"
  82. break
  83. fi
  84. done
  85. # Require libtool 1.4 or newer
  86. libtool=${LIBTOOL:-`${PrintPathBin} glibtool libtool libtool22 libtool15 libtool14`}
  87. lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
  88. if test -z "$lt_pversion"; then
  89. echo "build-requirements: libtool not found."
  90. echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from source."
  91. exit 1
  92. fi
  93. lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
  94. IFS=.; set $lt_version; IFS=' '
  95. lt_status="good"
  96. if test -z "$1"; then a=0 ; else a=$1;fi
  97. if test -z "$2"; then b=0 ; else b=$2;fi
  98. if test -z "$3"; then c=0 ; else c=$3;fi
  99. lt_major=$a
  100. if test "$a" -eq "2"; then
  101. lt_status="good"
  102. elif test "$a" -lt "2"; then
  103. if test "$b" -lt "5" -o "$b" = "5" -a "$c" -lt "14" ; then
  104. lt_status="bad"
  105. fi
  106. else
  107. lt_status="bad"
  108. fi
  109. if test $lt_status = "good"; then
  110. echo "build-requirements: libtool version $lt_pversion (ok)"
  111. else
  112. echo "build-requirements: libtool version $lt_pversion found."
  113. echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from source."
  114. exit 1
  115. fi
  116. }
  117. check_libtoolize() {
  118. # find APR PrintPath binary path
  119. for el in "${LIBDIR}/apr/build/PrintPath" \
  120. "libs/apr/build/PrintPath" \
  121. "../libs/apr/build/PrintPath" \
  122. "../../libs/apr/build/PrintPath"; do
  123. if test -f "$el"; then
  124. PrintPathBin="$el"
  125. break
  126. fi
  127. done
  128. # check libtoolize availability
  129. if [ -n "${LIBTOOL}" ]; then
  130. libtoolize=${LIBTOOLIZE:-`dirname "${LIBTOOL}"`/libtoolize}
  131. else
  132. libtoolize=${LIBTOOLIZE:-`${PrintPathBin} glibtoolize libtoolize libtoolize22 libtoolize15 libtoolize14`}
  133. fi
  134. if [ "x$libtoolize" = "x" ]; then
  135. echo "libtoolize not found in path"
  136. exit 1
  137. fi
  138. if [ ! -x "$libtoolize" ]; then
  139. echo "$libtoolize does not exist or is not executable"
  140. exit 1
  141. fi
  142. # compare libtool and libtoolize version
  143. ltl_pversion=`$libtoolize --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
  144. ltl_version=`echo $ltl_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
  145. IFS=.; set $ltl_version; IFS=' '
  146. if [ "x${lt_version}" != "x${ltl_version}" ]; then
  147. echo "$libtool and $libtoolize have different versions"
  148. exit 1
  149. fi
  150. }
  151. check_make() {
  152. #
  153. # Check to make sure we have GNU Make installed
  154. #
  155. make=`which make`
  156. if [ -x "$make" ]; then
  157. make_version=`$make --version || true | grep GNU`
  158. if [ $? -ne 0 ]; then
  159. make=`which gmake`
  160. if [ -x "$make" ]; then
  161. make_version=`$make --version | grep GNU`
  162. if [ $? -ne 0 ]; then
  163. echo "GNU Make does not exist or is not executable"
  164. exit 1;
  165. fi
  166. fi
  167. fi
  168. fi
  169. }
  170. check_awk() {
  171. # TODO: Building with mawk on at least Debian squeeze is know to
  172. # work, but mawk is believed to fail on some systems. If we can
  173. # replicate this, we need a particular behavior that we can test
  174. # here to verify whether we have an acceptable awk.
  175. :
  176. }