autogen.sh 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. rm -fr m4
  47. #
  48. locate_binary() {
  49. for f in $@
  50. do
  51. file=`which $f 2>/dev/null | grep -v '^no '`
  52. if test -n "$file" -a -x "$file"; then
  53. echo $file
  54. return 0
  55. fi
  56. done
  57. echo ""
  58. return 1
  59. }
  60. # user set environment variable are possible this way
  61. if test x$LIBTOOLIZE = x; then
  62. LIBTOOLIZE=`locate_binary libtoolize glibtoolize libtoolize-1.5`
  63. if test x$LIBTOOLIZE = x; then
  64. echo "./autogen.sh: no supported libtoolize"
  65. fi
  66. fi
  67. if test x$ACLOCAL = x; then
  68. ACLOCAL=`locate_binary aclocal aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal19`
  69. if test x$ACLOCAL = x; then
  70. echo "./autogen.sh: no supported aclocal"
  71. fi
  72. fi
  73. if test x$AUTOMAKE = x; then
  74. AUTOMAKE=`locate_binary automake automake-1.11 automake-1.10 automake-1.9 automake19`
  75. if test x$AUTOMAKE = x; then
  76. echo "./autogen.sh: no supported automake"
  77. fi
  78. fi
  79. if test x$AUTOCONF = x; then
  80. AUTOCONF=`locate_binary autoconf autoconf-2.59 autoconf259`
  81. if test x$AUTOCONF = x; then
  82. echo "./autogen.sh: no supported autoconf"
  83. fi
  84. fi
  85. if test x$AUTOHEADER = x; then
  86. AUTOHEADER=`locate_binary autoheader autoheader-2.59 autoheader259`
  87. if test x$AUTOHEADER = x; then
  88. echo "./autogen.sh: no supported autoheader"
  89. fi
  90. fi
  91. echo "./autogen.sh: libtoolize version ... (needs automake package installed)"
  92. libtoolize --version 2>&1 > /dev/null
  93. rc=$?
  94. if test $rc -ne 0 ; then
  95. echo "./autogen.sh: no supported libtool on your machine"
  96. echo "./autogen.sh: libtool --version produced:"
  97. libtool --version
  98. exit 1
  99. fi
  100. #
  101. lt_ver=`libtoolize --version | awk '{print $NF; exit}'`
  102. lt_maj=`echo $lt_ver | sed 's;\..*;;g'`
  103. lt_min=`echo $lt_ver | sed -e 's;^[0-9]*\.;;g' -e 's;\..*$;;g'`
  104. lt_teeny=`echo $lt_ver | sed -e 's;^[0-9]*\.[0-9]*\.;;g'`
  105. echo " $lt_ver"
  106. case $lt_maj in
  107. 0)
  108. echo "./autogen.sh: need libtool >= 1.4.0 but you seem to have $lt_ver"
  109. exit 1
  110. ;;
  111. 1)
  112. if test $lt_min -lt 4 ; then
  113. echo "./autogen.sh: need libtool >= 1.4.0 but you seem to have $lt_ver"
  114. exit 1
  115. fi
  116. ;;
  117. *)
  118. echo "./autogen.sh: newer libtool then version 1.4.0 which is minimum needed."
  119. ;;
  120. esac
  121. #
  122. echo "---"
  123. echo "./autogen.sh: Using the following tools"
  124. echo " * `$LIBTOOLIZE --version | head -1`"
  125. echo " * `$ACLOCAL --version | head -1`"
  126. echo " * `$AUTOHEADER --version | head -1`"
  127. echo " * `$AUTOMAKE --version | head -1`"
  128. echo " * `$AUTOCONF --version | head -1`"
  129. echo "---"
  130. #
  131. echo "./autogen.sh: Running libtoolize"
  132. libtoolize --force --copy --automake
  133. # aclocal
  134. echo "./autogen.sh: Checking aclocal version...(needs automake package installed)"
  135. acl_ver=`aclocal --version | awk '{print $NF; exit}'`
  136. echo " $acl_ver"
  137. #
  138. echo "./autogen.sh: Running aclocal"
  139. aclocal --force -I .
  140. echo "./autogen.sh: done with aclocal"
  141. # autoheader generates config.h.in with a problem when incluced multiple times
  142. echo "./autogen.sh: Checking autoheader version"
  143. ah_ver=`autoheader --version | awk '{print $NF; exit}'`
  144. echo " $ah_ver"
  145. #
  146. echo "./autogen.sh: Running autoheader"
  147. autoheader
  148. echo "./autogen.sh: done with autoheader"
  149. # automake
  150. echo "Checking automake version..."
  151. am_ver=`automake --version | awk '{print $NF; exit}'`
  152. echo " $am_ver"
  153. # http://www.gnu.org/software/womb/gnits/Preface.html
  154. # http://www.gnu.org/software/hello/manual/automake/Gnits.html
  155. # https://secure.wikimedia.org/wikipedia/en/wiki/Gnits_Standards
  156. # --gnu does checks on files like NEWS etc. according to GNU standards
  157. # --gnits does few more GNU standards checks and wants to THANK YOU insiting on a THANKS file.
  158. # --add-missing creates the INSTALL file
  159. echo "./autogen.sh: Running automake"
  160. automake --force --copy --add-missing --gnu
  161. echo "./autogen.sh: done with automake"
  162. # autoconf
  163. echo "./autogen.sh: Checking autoconf version"
  164. ac_ver=`autoconf --version | awk '{print $NF; exit}'`
  165. echo " $ac_ver"
  166. #
  167. echo "./autogen.sh:Running autoconf"
  168. autoconf
  169. echo "./autogen.sh: done with autoconf"
  170. # optional llvm clang
  171. #scan-build make
  172. #./configure --enable-gcc-warnings CC=gcc
  173. #./configure --enable-gcc-warnings CC=clang
  174. # ./configure --with-gtk=2.0
  175. # ./dmake clean
  176. # ./dmake
  177. # end.