autogen.sh 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #!/usr/bin/env sh
  2. #
  3. # g722_1 - a library for the ITU G.722.1 and Annex C 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. if [ "x$UNAME" = "xFreeBSD" ]; then
  20. echo ""
  21. echo ""
  22. echo "******************************************"
  23. echo "*** NOTICE ***"
  24. echo "******************************************"
  25. echo " "
  26. echo "FreeBSD is buggy. Please use this "
  27. echo "workaround if you want to bootstrap "
  28. echo "on FreeBSD. "
  29. echo " "
  30. echo "cd /usr/local/share/aclocal19 "
  31. echo "ln -s ../aclocal/libtool15.m4 . "
  32. echo "ln -s ../aclocal/ltdl15.m4 . "
  33. echo " "
  34. echo "******************************************"
  35. echo ""
  36. fi
  37. debug ()
  38. {
  39. # Outputs debug statments if DEBUG var is set
  40. if [ ! -z "$DEBUG" ]; then
  41. echo "DEBUG: $1"
  42. fi
  43. }
  44. version_compare()
  45. {
  46. # Checks a command is found and the version is high enough
  47. PROGRAM=$1
  48. MAJOR=$2
  49. MINOR=$3
  50. MICRO=$4
  51. test -z "$MAJOR" && MAJOR=0
  52. test -z "$MINOR" && MINOR=0
  53. test -z "$MICRO" && MICRO=0
  54. debug "Checking $PROGRAM >= $MAJOR.$MINOR.$MICRO"
  55. WHICH_PATH=`whereis which | cut -f2 -d' '`
  56. COMMAND=`$WHICH_PATH $PROGRAM`
  57. if [ -z $COMMAND ]; then
  58. echo "$PROGRAM-$MAJOR.$MINOR.$MICRO is required and was not found."
  59. return 1
  60. else
  61. debug "Found $COMMAND"
  62. fi
  63. INS_VER=`$COMMAND --version | head -1 | sed 's/[^0-9]*//' | cut -d' ' -f1`
  64. INS_MAJOR=`echo $INS_VER | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
  65. INS_MINOR=`echo $INS_VER | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
  66. INS_MICRO=`echo $INS_VER | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
  67. test -z "$INS_MAJOR" && INS_MAJOR=0
  68. test -z "$INS_MINOR" && INS_MINOR=0
  69. test -z "$INS_MICRO" && INS_MICRO=0
  70. debug "Installed version: $INS_VER"
  71. if [ "$INS_MAJOR" -gt "$MAJOR" ]; then
  72. debug "MAJOR: $INS_MAJOR > $MAJOR"
  73. return 0
  74. elif [ "$INS_MAJOR" -eq "$MAJOR" ]; then
  75. debug "MAJOR: $INS_MAJOR = $MAJOR"
  76. if [ "$INS_MINOR" -gt "$MINOR" ]; then
  77. debug "MINOR: $INS_MINOR > $MINOR"
  78. return 0
  79. elif [ "$INS_MINOR" -eq "$MINOR" ]; then
  80. if [ "$INS_MICRO" -ge "$MICRO" ]; then
  81. debug "MICRO: $INS_MICRO >= $MICRO"
  82. return 0
  83. else
  84. debug "MICRO: $INS_MICRO < $MICRO"
  85. fi
  86. else
  87. debug "MINOR: $INS_MINOR < $MINOR"
  88. fi
  89. else
  90. debug "MAJOR: $INS_MAJOR < $MAJOR"
  91. fi
  92. echo "You have the wrong version of $PROGRAM. The minimum required version is $MAJOR.$MINOR.$MICRO"
  93. echo " and the version installed is $INS_MAJOR.$INS_MINOR.$INS_MICRO ($COMMAND)."
  94. return 1
  95. }
  96. # Check for required version and die if unhappy
  97. if [ "x$UNAME" = "xFreeBSD" ]; then
  98. version_compare libtoolize 1 5 16 || exit 1
  99. version_compare automake19 1 9 5 || exit 1
  100. version_compare autoconf259 2 59 || exit 1
  101. ACLOCAL=aclocal19
  102. AUTOHEADER=autoheader259
  103. AUTOMAKE=automake19
  104. AUTOCONF=autoconf259
  105. else
  106. version_compare libtoolize 1 5 16 || exit 1
  107. version_compare automake 1 9 5 || exit 1
  108. version_compare autoconf 2 59 || exit 1
  109. ACLOCAL=aclocal
  110. AUTOHEADER=autoheader
  111. AUTOMAKE=automake
  112. AUTOCONF=autoconf
  113. fi
  114. libtoolize --copy --force --ltdl
  115. #NetBSD seems to need this file writable
  116. chmod u+w libltdl/configure
  117. $ACLOCAL
  118. $AUTOHEADER --force
  119. $AUTOMAKE --copy --add-missing
  120. $AUTOCONF --force
  121. #chmod ug+x debian/rules
  122. if [ "x$UNAME" = "xNetBSD" ]; then
  123. echo ""
  124. echo "Please remember to run gmake instead of make on NetBSD"
  125. echo ""
  126. fi