2
0

autogen.sh 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #!/usr/bin/env sh
  2. #
  3. # broadvoice - a library for the BroadVoice 16 and 32 codecs
  4. #
  5. # autogen script
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License version 2, as
  9. # published by the Free Software Foundation.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. UNAME=`uname`
  20. if [ "x$UNAME" = "xFreeBSD" ]; then
  21. echo ""
  22. echo ""
  23. echo "******************************************"
  24. echo "*** NOTICE ***"
  25. echo "******************************************"
  26. echo " "
  27. echo "FreeBSD is buggy. Please use this "
  28. echo "workaround if you want to bootstrap "
  29. echo "on FreeBSD. "
  30. echo " "
  31. echo "cd /usr/local/share/aclocal19 "
  32. echo "ln -s ../aclocal/libtool15.m4 . "
  33. echo "ln -s ../aclocal/ltdl15.m4 . "
  34. echo " "
  35. echo "******************************************"
  36. echo ""
  37. fi
  38. debug ()
  39. {
  40. # Outputs debug statments if DEBUG var is set
  41. if [ ! -z "$DEBUG" ]; then
  42. echo "DEBUG: $1"
  43. fi
  44. }
  45. version_compare()
  46. {
  47. # Checks a command is found and the version is high enough
  48. PROGRAM=$1
  49. MAJOR=$2
  50. MINOR=$3
  51. MICRO=$4
  52. test -z "$MAJOR" && MAJOR=0
  53. test -z "$MINOR" && MINOR=0
  54. test -z "$MICRO" && MICRO=0
  55. debug "Checking $PROGRAM >= $MAJOR.$MINOR.$MICRO"
  56. WHICH_PATH=`whereis which | cut -f2 -d' '`
  57. COMMAND=`$WHICH_PATH $PROGRAM`
  58. if [ -z $COMMAND ]; then
  59. echo "$PROGRAM-$MAJOR.$MINOR.$MICRO is required and was not found."
  60. return 1
  61. else
  62. debug "Found $COMMAND"
  63. fi
  64. INS_VER=`$COMMAND --version | head -1 | sed 's/[^0-9]*//' | cut -d' ' -f1`
  65. INS_MAJOR=`echo $INS_VER | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
  66. INS_MINOR=`echo $INS_VER | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
  67. INS_MICRO=`echo $INS_VER | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
  68. test -z "$INS_MAJOR" && INS_MAJOR=0
  69. test -z "$INS_MINOR" && INS_MINOR=0
  70. test -z "$INS_MICRO" && INS_MICRO=0
  71. debug "Installed version: $INS_VER"
  72. if [ "$INS_MAJOR" -gt "$MAJOR" ]; then
  73. debug "MAJOR: $INS_MAJOR > $MAJOR"
  74. return 0
  75. elif [ "$INS_MAJOR" -eq "$MAJOR" ]; then
  76. debug "MAJOR: $INS_MAJOR = $MAJOR"
  77. if [ "$INS_MINOR" -gt "$MINOR" ]; then
  78. debug "MINOR: $INS_MINOR > $MINOR"
  79. return 0
  80. elif [ "$INS_MINOR" -eq "$MINOR" ]; then
  81. if [ "$INS_MICRO" -ge "$MICRO" ]; then
  82. debug "MICRO: $INS_MICRO >= $MICRO"
  83. return 0
  84. else
  85. debug "MICRO: $INS_MICRO < $MICRO"
  86. fi
  87. else
  88. debug "MINOR: $INS_MINOR < $MINOR"
  89. fi
  90. else
  91. debug "MAJOR: $INS_MAJOR < $MAJOR"
  92. fi
  93. echo "You have the wrong version of $PROGRAM. The minimum required version is $MAJOR.$MINOR.$MICRO"
  94. echo " and the version installed is $INS_MAJOR.$INS_MINOR.$INS_MICRO ($COMMAND)."
  95. return 1
  96. }
  97. # Check for required version and die if unhappy
  98. if [ "x$UNAME" = "xFreeBSD" ]; then
  99. version_compare libtoolize 1 5 16 || exit 1
  100. version_compare automake19 1 9 5 || exit 1
  101. version_compare autoconf259 2 59 || exit 1
  102. ACLOCAL=aclocal19
  103. AUTOHEADER=autoheader259
  104. AUTOMAKE=automake19
  105. AUTOCONF=autoconf259
  106. else
  107. version_compare libtoolize 1 5 16 || exit 1
  108. version_compare automake 1 9 5 || exit 1
  109. version_compare autoconf 2 59 || exit 1
  110. ACLOCAL=aclocal
  111. AUTOHEADER=autoheader
  112. AUTOMAKE=automake
  113. AUTOCONF=autoconf
  114. fi
  115. libtoolize --copy --force --ltdl
  116. #NetBSD seems to need this file writable
  117. chmod u+w libltdl/configure
  118. $ACLOCAL
  119. $AUTOHEADER --force
  120. $AUTOMAKE --copy --add-missing
  121. $AUTOCONF --force
  122. #chmod ug+x debian/rules
  123. if [ "x$UNAME" = "xNetBSD" ]; then
  124. echo ""
  125. echo "Please remember to run gmake instead of make on NetBSD"
  126. echo ""
  127. fi