autogen.sh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. # * SPDX-License-Identifier: GPL-3.0+
  19. # * License-Filename: LICENSE
  20. # *
  21. # *
  22. # */
  23. #
  24. # sparse llvm c compiler CC=sparsec
  25. # llvm-clang compiler CC=clang
  26. #
  27. # If environment variable DRYRUN is set, no configuring will be done -
  28. # (e.g. in bash) DRYRUN=1 ./autogen.sh
  29. # will not do any configuring but will emit the programs that would be run.
  30. #
  31. # This is basically:
  32. # aclocal -I m4
  33. # autoheader
  34. # autoconf
  35. # automake --copy --add-missing --force-missing --include-deps --foreign
  36. #
  37. # or: autoreconf -fvim
  38. #
  39. # libtool version 2.2, 2.4 tested http://ftp.gnu.org/gnu/libtool
  40. #
  41. rm -fr autom4te.cache
  42. rm -f ./configure
  43. rm -f ./Makefile
  44. rm -f ./Makefile.in
  45. rm -fr src/.deps
  46. #
  47. locate_binary() {
  48. for f in $@
  49. do
  50. file=`which $f 2>/dev/null | grep -v '^no '`
  51. if test -n "$file" -a -x "$file"; then
  52. echo $file
  53. return 0
  54. fi
  55. done
  56. echo ""
  57. return 1
  58. }
  59. # user set environment variable are possible this way
  60. if test x$LIBTOOLIZE = x; then
  61. LIBTOOLIZE=`locate_binary libtoolize glibtoolize libtoolize-1.5`
  62. if test x$LIBTOOLIZE = x; then
  63. echo "./autogen.sh: no supported libtoolize"
  64. fi
  65. fi
  66. if test x$ACLOCAL = x; then
  67. ACLOCAL=`locate_binary aclocal aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal19`
  68. if test x$ACLOCAL = x; then
  69. echo "./autogen.sh: no supported aclocal"
  70. fi
  71. fi
  72. if test x$AUTOMAKE = x; then
  73. AUTOMAKE=`locate_binary automake automake-1.11 automake-1.10 automake-1.9 automake19`
  74. if test x$AUTOMAKE = x; then
  75. echo "./autogen.sh: no supported automake"
  76. fi
  77. fi
  78. if test x$AUTOCONF = x; then
  79. AUTOCONF=`locate_binary autoconf autoconf-2.59 autoconf259`
  80. if test x$AUTOCONF = x; then
  81. echo "./autogen.sh: no supported autoconf"
  82. fi
  83. fi
  84. if test x$AUTOHEADER = x; then
  85. AUTOHEADER=`locate_binary autoheader autoheader-2.59 autoheader259`
  86. if test x$AUTOHEADER = x; then
  87. echo "./autogen.sh: no supported autoheader"
  88. fi
  89. fi
  90. echo "./autogen.sh: libtoolize version ... (needs automake package installed)"
  91. libtoolize --version 2>&1 > /dev/null
  92. rc=$?
  93. if test $rc -ne 0 ; then
  94. echo "./autogen.sh: no supported libtool on your machine"
  95. echo "./autogen.sh: libtool --version produced:"
  96. libtool --version
  97. exit 1
  98. fi
  99. #
  100. lt_ver=`libtoolize --version | awk '{print $NF; exit}'`
  101. lt_maj=`echo $lt_ver | sed 's;\..*;;g'`
  102. lt_min=`echo $lt_ver | sed -e 's;^[0-9]*\.;;g' -e 's;\..*$;;g'`
  103. lt_teeny=`echo $lt_ver | sed -e 's;^[0-9]*\.[0-9]*\.;;g'`
  104. echo " $lt_ver"
  105. case $lt_maj in
  106. 0)
  107. echo "./autogen.sh: need libtool >= 1.4.0 but you seem to have $lt_ver"
  108. exit 1
  109. ;;
  110. 1)
  111. if test $lt_min -lt 4 ; then
  112. echo "./autogen.sh: need libtool >= 1.4.0 but you seem to have $lt_ver"
  113. exit 1
  114. fi
  115. ;;
  116. *)
  117. echo "./autogen.sh: newer libtool then version 1.4.0 which is minimum needed."
  118. ;;
  119. esac
  120. #
  121. echo "---"
  122. echo "./autogen.sh: Using the following tools"
  123. echo " * `$LIBTOOLIZE --version | head -1`"
  124. echo " * `$ACLOCAL --version | head -1`"
  125. echo " * `$AUTOHEADER --version | head -1`"
  126. echo " * `$AUTOMAKE --version | head -1`"
  127. echo " * `$AUTOCONF --version | head -1`"
  128. echo "---"
  129. #
  130. echo "./autogen.sh: Running libtoolize"
  131. libtoolize --force --copy --automake
  132. # aclocal
  133. echo "./autogen.sh: Checking aclocal version...(needs automake package installed)"
  134. acl_ver=`aclocal --version | awk '{print $NF; exit}'`
  135. echo " $acl_ver"
  136. #
  137. echo "./autogen.sh: Running aclocal"
  138. aclocal --force -I .
  139. echo "./autogen.sh: done with aclocal"
  140. # autoheader generates config.h.in with a problem when incluced multiple times
  141. echo "./autogen.sh: Checking autoheader version"
  142. ah_ver=`autoheader --version | awk '{print $NF; exit}'`
  143. echo " $ah_ver"
  144. #
  145. echo "./autogen.sh: Running autoheader"
  146. autoheader
  147. echo "./autogen.sh: done with autoheader"
  148. # automake
  149. echo "Checking automake version..."
  150. am_ver=`automake --version | awk '{print $NF; exit}'`
  151. echo " $am_ver"
  152. # http://www.gnu.org/software/womb/gnits/Preface.html
  153. # http://www.gnu.org/software/hello/manual/automake/Gnits.html
  154. # https://secure.wikimedia.org/wikipedia/en/wiki/Gnits_Standards
  155. # --gnu does checks on files like NEWS etc. according to GNU standards
  156. # --gnits does few more GNU standards checks and wants to THANK YOU insiting on a THANKS file.
  157. # --add-missing creates the INSTALL file
  158. echo "./autogen.sh: Running automake"
  159. automake --force --copy --add-missing --gnu
  160. echo "./autogen.sh: done with automake"
  161. # autoconf
  162. echo "./autogen.sh: Checking autoconf version"
  163. ac_ver=`autoconf --version | awk '{print $NF; exit}'`
  164. echo " $ac_ver"
  165. #
  166. echo "./autogen.sh:Running autoconf"
  167. autoconf
  168. echo "./autogen.sh: done with autoconf"
  169. ./configure
  170. # end.