autogen.sh 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #!/bin/sh
  2. # Copyright (c) 2010-2011 Jean-Marc Valin
  3. #
  4. # This file is extracted from RFC6716. Please see that RFC for additional
  5. # information.
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions
  9. # are met:
  10. #
  11. # - Redistributions of source code must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. #
  14. # - Redistributions in binary form must reproduce the above copyright
  15. # notice, this list of conditions and the following disclaimer in the
  16. # documentation and/or other materials provided with the distribution.
  17. #
  18. # - Neither the name of Internet Society, IETF or IETF Trust, nor the
  19. # names of specific contributors, may be used to endorse or promote
  20. # products derived from this software without specific prior written
  21. # permission.
  22. #
  23. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  26. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  27. # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  28. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  29. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  30. # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  31. # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  32. # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  33. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. # Run this to set up the build system: configure, makefiles, etc.
  35. # (based on the version in enlightenment's cvs)
  36. package="opus"
  37. olddir=`pwd`
  38. srcdir=`dirname $0`
  39. test -z "$srcdir" && srcdir=.
  40. cd "$srcdir"
  41. DIE=0
  42. echo "checking for autoconf... "
  43. (autoconf --version) < /dev/null > /dev/null 2>&1 || {
  44. echo
  45. echo "You must have autoconf installed to compile $package."
  46. echo "Download the appropriate package for your distribution,"
  47. echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
  48. DIE=1
  49. }
  50. VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]*\).*/\1/"
  51. VERSIONMKINT="sed -e s/[^0-9]//"
  52. # do we need automake?
  53. if test -r Makefile.am; then
  54. AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
  55. AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
  56. if test "$AM_NEEDED" = "$AM_OPTIONS"; then
  57. AM_NEEDED=""
  58. fi
  59. if test -z $AM_NEEDED; then
  60. echo -n "checking for automake... "
  61. AUTOMAKE=automake
  62. ACLOCAL=aclocal
  63. if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
  64. echo "yes"
  65. else
  66. echo "no"
  67. AUTOMAKE=
  68. fi
  69. else
  70. echo -n "checking for automake $AM_NEEDED or later... "
  71. for am in automake-$AM_NEEDED automake$AM_NEEDED automake; do
  72. ($am --version < /dev/null > /dev/null 2>&1) || continue
  73. ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
  74. verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
  75. if test $ver -ge $verneeded; then
  76. AUTOMAKE=$am
  77. echo $AUTOMAKE
  78. break
  79. fi
  80. done
  81. test -z $AUTOMAKE && echo "no"
  82. echo -n "checking for aclocal $AM_NEEDED or later... "
  83. for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal; do
  84. ($ac --version < /dev/null > /dev/null 2>&1) || continue
  85. ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
  86. verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
  87. if test $ver -ge $verneeded; then
  88. ACLOCAL=$ac
  89. echo $ACLOCAL
  90. break
  91. fi
  92. done
  93. test -z $ACLOCAL && echo "no"
  94. fi
  95. test -z $AUTOMAKE || test -z $ACLOCAL && {
  96. echo
  97. echo "You must have automake installed to compile $package."
  98. echo "Download the appropriate package for your distribution,"
  99. echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
  100. exit 1
  101. }
  102. fi
  103. echo -n "checking for libtool... "
  104. for LIBTOOLIZE in libtoolize glibtoolize nope; do
  105. ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
  106. done
  107. if test x$LIBTOOLIZE = xnope; then
  108. echo "nope."
  109. LIBTOOLIZE=libtoolize
  110. else
  111. echo $LIBTOOLIZE
  112. fi
  113. ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
  114. echo
  115. echo "You must have libtool installed to compile $package."
  116. echo "Download the appropriate package for your system,"
  117. echo "or get the source from one of the GNU ftp sites"
  118. echo "listed in http://www.gnu.org/order/ftp.html"
  119. DIE=1
  120. }
  121. if test "$DIE" -eq 1; then
  122. exit 1
  123. fi
  124. echo "Generating configuration files for $package, please wait...."
  125. echo " $ACLOCAL $ACLOCAL_FLAGS"
  126. $ACLOCAL $ACLOCAL_FLAGS || exit 1
  127. echo " autoheader"
  128. autoheader || exit 1
  129. echo " $LIBTOOLIZE --automake"
  130. $LIBTOOLIZE --automake || exit 1
  131. echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
  132. $AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
  133. echo " autoconf"
  134. autoconf || exit 1
  135. cd $olddir
  136. #$srcdir/configure "$@" && echo