autogen.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #!/bin/sh
  2. # Run this to set up the build system: configure, makefiles, etc.
  3. # (based on the version in enlightenment's cvs)
  4. package="libsndfile"
  5. ACLOCAL_FLAGS="-I M4"
  6. olddir=`pwd`
  7. srcdir=`dirname $0`
  8. test -z "$srcdir" && srcdir=.
  9. cd "$srcdir"
  10. DIE=0
  11. printf "checking for autogen ... "
  12. result="yes"
  13. (autogen --version) < /dev/null > /dev/null 2>&1 || {
  14. echo
  15. echo "You must have GNU autogen installed to compile $package."
  16. echo "Download the appropriate package for your distribution,"
  17. echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
  18. result="no"
  19. DIE=1
  20. }
  21. echo $result
  22. printf "checking for autoconf ... "
  23. result="yes"
  24. (autoconf --version) < /dev/null > /dev/null 2>&1 || {
  25. echo
  26. echo "You must have autoconf installed to compile $package."
  27. echo "Download the appropriate package for your distribution,"
  28. echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
  29. result="no"
  30. DIE=1
  31. }
  32. echo $result
  33. VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/"
  34. VERSIONMKMAJ="sed -e s/\([0-9][0-9]*\)[^0-9].*/\\1/"
  35. VERSIONMKMIN="sed -e s/.*[0-9][0-9]*\.//"
  36. # do we need automake?
  37. if test -r Makefile.am; then
  38. AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
  39. AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
  40. if test x"$AM_NEEDED" = "x$AM_OPTIONS"; then
  41. AM_NEEDED=""
  42. fi
  43. if test -z $AM_NEEDED; then
  44. printf "checking for automake ... "
  45. AUTOMAKE=automake
  46. ACLOCAL=aclocal
  47. if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
  48. echo "yes"
  49. else
  50. echo "no"
  51. AUTOMAKE=
  52. fi
  53. else
  54. printf "checking for automake $AM_NEEDED or later ... "
  55. majneeded=`echo $AM_NEEDED | $VERSIONMKMAJ`
  56. minneeded=`echo $AM_NEEDED | $VERSIONMKMIN`
  57. for am in automake-$AM_NEEDED automake$AM_NEEDED \
  58. automake automake-1.7 automake-1.8 automake-1.9 automake-1.10; do
  59. ($am --version < /dev/null > /dev/null 2>&1) || continue
  60. ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP`
  61. maj=`echo $ver | $VERSIONMKMAJ`
  62. min=`echo $ver | $VERSIONMKMIN`
  63. if test $maj -eq $majneeded -a $min -ge $minneeded; then
  64. AUTOMAKE=$am
  65. echo $AUTOMAKE
  66. break
  67. fi
  68. done
  69. test -z $AUTOMAKE && echo "no"
  70. printf "checking for aclocal $AM_NEEDED or later ... "
  71. for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED \
  72. aclocal aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10; do
  73. ($ac --version < /dev/null > /dev/null 2>&1) || continue
  74. ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP`
  75. maj=`echo $ver | $VERSIONMKMAJ`
  76. min=`echo $ver | $VERSIONMKMIN`
  77. if test $maj -eq $majneeded -a $min -ge $minneeded; then
  78. ACLOCAL=$ac
  79. echo $ACLOCAL
  80. break
  81. fi
  82. done
  83. test -z $ACLOCAL && echo "no"
  84. fi
  85. test -z $AUTOMAKE || test -z $ACLOCAL && {
  86. echo
  87. echo "You must have automake installed to compile $package."
  88. echo "Download the appropriate package for your distribution,"
  89. echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
  90. exit 1
  91. }
  92. fi
  93. printf "checking for libtool ... "
  94. for LIBTOOLIZE in libtoolize glibtoolize nope; do
  95. ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
  96. done
  97. if test x$LIBTOOLIZE = xnope; then
  98. echo "nope."
  99. LIBTOOLIZE=libtoolize
  100. else
  101. echo $LIBTOOLIZE
  102. fi
  103. ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
  104. echo
  105. echo "You must have libtool installed to compile $package."
  106. echo "Download the appropriate package for your system,"
  107. echo "or get the source from one of the GNU ftp sites"
  108. echo "listed in http://www.gnu.org/order/ftp.html"
  109. DIE=1
  110. }
  111. printf "checking for pkg-config ... "
  112. result="yes"
  113. (pkg-config --version) < /dev/null > /dev/null 2>&1 || {
  114. echo
  115. echo "You must have pkg-config installed to compile $package."
  116. echo "Download the appropriate package for your distribution."
  117. result="no"
  118. DIE=1
  119. }
  120. echo $result
  121. printf "checking for python ... "
  122. result="yes"
  123. (python --version) < /dev/null > /dev/null 2>&1 || {
  124. echo
  125. echo "You must have Python installed to compile $package."
  126. echo "Download the appropriate package for your distribution,"
  127. echo "or get the source tarball at http://python.org/"
  128. result="no"
  129. DIE=1
  130. }
  131. echo $result
  132. if test "$DIE" -eq 1; then
  133. exit 1
  134. fi
  135. if test ! -d Cfg ; then
  136. echo "Creating 'Cfg' directory."
  137. mkdir Cfg
  138. fi
  139. echo "Generating configuration files for $package, please wait ... "
  140. echo " $ACLOCAL $ACLOCAL_FLAGS"
  141. $ACLOCAL $ACLOCAL_FLAGS || exit 1
  142. echo " $LIBTOOLIZE --automake --force"
  143. $LIBTOOLIZE --automake --force || exit 1
  144. echo " autoheader"
  145. autoheader || exit 1
  146. echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
  147. $AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
  148. echo " autoconf"
  149. autoconf || exit 1
  150. cd $olddir
  151. fprecommit=.git/hooks/pre-commit
  152. if test ! -f $fprecommit ; then
  153. echo
  154. echo "Installing git pre-commit hook for this project."
  155. cat > $fprecommit << 'foobar'
  156. #!/bin/sh
  157. exec Scripts/git-pre-commit-hook
  158. foobar
  159. chmod u+x $fprecommit
  160. echo
  161. fi