autogen.sh 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. #!/bin/sh
  2. # (or use sh -x to see what is going on)
  3. #
  4. # /*
  5. # * This program is free software: you can redistribute it and/or modify
  6. # * it under the terms of the GNU General Public License as published by
  7. # * the Free Software Foundation, either version 3 of the License, or
  8. # * (at your option) any later version.
  9. # *
  10. # * This program is distributed in the hope that it will be useful,
  11. # * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # * GNU General Public License for more details.
  14. # *
  15. # * You should have received a copy of the GNU General Public License
  16. # * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. # *
  18. # * The four essential freedoms with GNU GPL software:
  19. # * The freedom to run the program, for any purpose
  20. # * The freedom to study how the program works, and change it to make it do what you wish
  21. # * The freedom to redistribute copies so you can help others
  22. # * The freedom to distribute copies of your modified versions to others
  23. # */
  24. #
  25. # GNU / Linux is user-friendly. Linux is just particular who its friends are :)
  26. #
  27. # This is basically:
  28. # aclocal -I m4
  29. # autoheader
  30. # autoconf
  31. # automake --copy --add-missing --force-missing --include-deps --foreign
  32. #
  33. # or: autoreconf -fvim
  34. #
  35. # libtool version 2.2, 2.4 tested http://ftp.gnu.org/gnu/libtool
  36. #
  37. rm -fr autom4te.cache
  38. rm -f ./configure
  39. rm -f ./Makefile
  40. rm -f ./Makefile.in
  41. rm -fr src/.deps
  42. #
  43. locate_binary() {
  44. for f in $@
  45. do
  46. file=`which $f 2>/dev/null | grep -v '^no '`
  47. if test -n "$file" -a -x "$file"; then
  48. echo $file
  49. return 0
  50. fi
  51. done
  52. echo ""
  53. return 1
  54. }
  55. # user set environment variable are possible this way
  56. if test x$LIBTOOLIZE = x; then
  57. LIBTOOLIZE=`locate_binary libtoolize glibtoolize libtoolize-1.5`
  58. if test x$LIBTOOLIZE = x; then
  59. echo "./autogen.sh: no supported libtoolize"
  60. fi
  61. fi
  62. if test x$ACLOCAL = x; then
  63. ACLOCAL=`locate_binary aclocal aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal19`
  64. if test x$ACLOCAL = x; then
  65. echo "./autogen.sh: no supported aclocal"
  66. fi
  67. fi
  68. if test x$AUTOMAKE = x; then
  69. AUTOMAKE=`locate_binary automake automake-1.11 automake-1.10 automake-1.9 automake19`
  70. if test x$AUTOMAKE = x; then
  71. echo "./autogen.sh: no supported automake"
  72. fi
  73. fi
  74. if test x$AUTOCONF = x; then
  75. AUTOCONF=`locate_binary autoconf autoconf-2.59 autoconf259`
  76. if test x$AUTOCONF = x; then
  77. echo "./autogen.sh: no supported autoconf"
  78. fi
  79. fi
  80. if test x$AUTOHEADER = x; then
  81. AUTOHEADER=`locate_binary autoheader autoheader-2.59 autoheader259`
  82. if test x$AUTOHEADER = x; then
  83. echo "./autogen.sh: no supported autoheader"
  84. fi
  85. fi
  86. echo "./autogen.sh: libtoolize version ... (needs automake package installed)"
  87. libtoolize --version 2>&1 > /dev/null
  88. rc=$?
  89. if test $rc -ne 0 ; then
  90. echo "./autogen.sh: no supported libtool on your machine"
  91. echo "./autogen.sh: libtool --version produced:"
  92. libtool --version
  93. exit 1
  94. fi
  95. #
  96. lt_ver=`libtoolize --version | awk '{print $NF; exit}'`
  97. lt_maj=`echo $lt_ver | sed 's;\..*;;g'`
  98. lt_min=`echo $lt_ver | sed -e 's;^[0-9]*\.;;g' -e 's;\..*$;;g'`
  99. lt_teeny=`echo $lt_ver | sed -e 's;^[0-9]*\.[0-9]*\.;;g'`
  100. echo " $lt_ver"
  101. case $lt_maj in
  102. 0)
  103. echo "./autogen.sh: need libtool >= 1.4.0 but you seem to have $lt_ver"
  104. exit 1
  105. ;;
  106. 1)
  107. if test $lt_min -lt 4 ; then
  108. echo "./autogen.sh: need libtool >= 1.4.0 but you seem to have $lt_ver"
  109. exit 1
  110. fi
  111. ;;
  112. *)
  113. echo "./autogen.sh: newer libtool then version 1.4.0 which is minmum needed."
  114. ;;
  115. esac
  116. #
  117. echo "---"
  118. echo "./autogen.sh: Using the following tools"
  119. echo " * `$LIBTOOLIZE --version | head -1`"
  120. echo " * `$ACLOCAL --version | head -1`"
  121. echo " * `$AUTOHEADER --version | head -1`"
  122. echo " * `$AUTOMAKE --version | head -1`"
  123. echo " * `$AUTOCONF --version | head -1`"
  124. echo "---"
  125. #
  126. echo "./autogen.sh: Running libtoolize"
  127. libtoolize --force --copy --automake
  128. # aclocal
  129. echo "./autogen.sh: Checking aclocal version...(needs automake package installed)"
  130. acl_ver=`aclocal --version | awk '{print $NF; exit}'`
  131. echo " $acl_ver"
  132. #
  133. echo "./autogen.sh: Running aclocal"
  134. aclocal --force -I .
  135. echo "./autogen.sh: done with aclocal"
  136. # autoheader generates config.h.in with a problem when incluced multiple times
  137. echo "./autogen.sh: Checking autoheader version"
  138. ah_ver=`autoheader --version | awk '{print $NF; exit}'`
  139. echo " $ah_ver"
  140. #
  141. echo "./autogen.sh: Running autoheader"
  142. autoheader
  143. echo "./autogen.sh: done with autoheader"
  144. # automake
  145. echo "Checking automake version..."
  146. am_ver=`automake --version | awk '{print $NF; exit}'`
  147. echo " $am_ver"
  148. # http://www.gnu.org/software/womb/gnits/Preface.html
  149. # http://www.gnu.org/software/hello/manual/automake/Gnits.html
  150. # https://secure.wikimedia.org/wikipedia/en/wiki/Gnits_Standards
  151. # --gnu does checks on files like NEWS etc. according to GNU standards
  152. # --gnits does few more GNU standards checks and wants to THANK YOU insiting on a THANKS file.
  153. # -- add-missing creates the INSTALL file
  154. echo "./autogen.sh: Running automake"
  155. automake --force --copy --add-missing --gnu --gnits
  156. echo "./autogen.sh: done with automake"
  157. # autoconf
  158. echo "./autogen.sh: Checking autoconf version"
  159. ac_ver=`autoconf --version | awk '{print $NF; exit}'`
  160. echo " $ac_ver"
  161. #
  162. echo "./autogen.sh:Running autoconf"
  163. autoconf
  164. echo "./autogen.sh: done with autoconf"
  165. # optional
  166. ./configure
  167. # end.