autogen.sh 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. #!/bin/sh
  2. # This script does all the magic calls to automake/autoconf and
  3. # friends that are needed to configure a git clone. As described in
  4. # the file HACKING you need a couple of extra tools to run this script
  5. # successfully.
  6. #
  7. # If you are compiling from a released tarball you don't need these
  8. # tools and you shouldn't use this script. Just call ./configure
  9. # directly.
  10. ACLOCAL=${ACLOCAL-aclocal-1.11}
  11. AUTOCONF=${AUTOCONF-autoconf}
  12. AUTOHEADER=${AUTOHEADER-autoheader}
  13. AUTOMAKE=${AUTOMAKE-automake-1.11}
  14. LIBTOOLIZE=${LIBTOOLIZE-libtoolize}
  15. AUTOCONF_REQUIRED_VERSION=2.54
  16. AUTOMAKE_REQUIRED_VERSION=1.10.0
  17. INTLTOOL_REQUIRED_VERSION=0.40.1
  18. LIBTOOL_REQUIRED_VERSION=1.5
  19. LIBTOOL_WIN32_REQUIRED_VERSION=2.2
  20. PROJECT="GNU Image Manipulation Program"
  21. TEST_TYPE=-d
  22. FILE=plug-ins
  23. srcdir=`dirname $0`
  24. test -z "$srcdir" && srcdir=.
  25. ORIGDIR=`pwd`
  26. cd $srcdir
  27. check_version ()
  28. {
  29. VERSION_A=$1
  30. VERSION_B=$2
  31. save_ifs="$IFS"
  32. IFS=.
  33. set dummy $VERSION_A 0 0 0
  34. MAJOR_A=$2
  35. MINOR_A=$3
  36. MICRO_A=$4
  37. set dummy $VERSION_B 0 0 0
  38. MAJOR_B=$2
  39. MINOR_B=$3
  40. MICRO_B=$4
  41. IFS="$save_ifs"
  42. if expr "$MAJOR_A" = "$MAJOR_B" > /dev/null; then
  43. if expr "$MINOR_A" \> "$MINOR_B" > /dev/null; then
  44. echo "yes (version $VERSION_A)"
  45. elif expr "$MINOR_A" = "$MINOR_B" > /dev/null; then
  46. if expr "$MICRO_A" \>= "$MICRO_B" > /dev/null; then
  47. echo "yes (version $VERSION_A)"
  48. else
  49. echo "Too old (version $VERSION_A)"
  50. DIE=1
  51. fi
  52. else
  53. echo "Too old (version $VERSION_A)"
  54. DIE=1
  55. fi
  56. elif expr "$MAJOR_A" \> "$MAJOR_B" > /dev/null; then
  57. echo "Major version might be too new ($VERSION_A)"
  58. else
  59. echo "Too old (version $VERSION_A)"
  60. DIE=1
  61. fi
  62. }
  63. echo
  64. echo "I am testing that you have the tools required to build the"
  65. echo "$PROJECT from git. This test is not foolproof,"
  66. echo "so if anything goes wrong, see the file HACKING for more information..."
  67. echo
  68. DIE=0
  69. OS=`uname -s`
  70. case $OS in
  71. *YGWIN* | *INGW*)
  72. echo "Looks like Win32, you will need libtool $LIBTOOL_WIN32_REQUIRED_VERSION or newer."
  73. echo
  74. LIBTOOL_REQUIRED_VERSION=$LIBTOOL_WIN32_REQUIRED_VERSION
  75. ;;
  76. esac
  77. echo -n "checking for libtool >= $LIBTOOL_REQUIRED_VERSION ... "
  78. if ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1; then
  79. LIBTOOLIZE=$LIBTOOLIZE
  80. elif (glibtoolize --version) < /dev/null > /dev/null 2>&1; then
  81. LIBTOOLIZE=glibtoolize
  82. else
  83. echo
  84. echo " You must have libtool installed to compile $PROJECT."
  85. echo " Install the appropriate package for your distribution,"
  86. echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
  87. echo
  88. DIE=1
  89. fi
  90. if test x$LIBTOOLIZE != x; then
  91. VER=`$LIBTOOLIZE --version \
  92. | grep libtool | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
  93. check_version $VER $LIBTOOL_REQUIRED_VERSION
  94. fi
  95. # check if gtk-doc is explicitely disabled
  96. for ag_option in $AUTOGEN_CONFIGURE_ARGS $@
  97. do
  98. case $ag_option in
  99. -disable-gtk-doc | --disable-gtk-doc)
  100. enable_gtk_doc=no
  101. ;;
  102. esac
  103. done
  104. if test x$enable_gtk_doc = xno; then
  105. echo "skipping test for gtkdocize"
  106. else
  107. echo -n "checking for gtkdocize ... "
  108. if (gtkdocize --version) < /dev/null > /dev/null 2>&1; then
  109. echo "yes"
  110. else
  111. echo
  112. echo " You must have gtk-doc installed to compile $PROJECT."
  113. echo " Install the appropriate package for your distribution,"
  114. echo " or get the source tarball at"
  115. echo " http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/"
  116. echo " You can also use the option --disable-gtk-doc to skip"
  117. echo " this test but then you will not be able to generate a"
  118. echo " configure script that can build the API documentation."
  119. DIE=1
  120. fi
  121. fi
  122. echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... "
  123. if ($AUTOCONF --version) < /dev/null > /dev/null 2>&1; then
  124. VER=`$AUTOCONF --version | head -n 1 \
  125. | grep -iw autoconf | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
  126. check_version $VER $AUTOCONF_REQUIRED_VERSION
  127. else
  128. echo
  129. echo " You must have autoconf installed to compile $PROJECT."
  130. echo " Download the appropriate package for your distribution,"
  131. echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/"
  132. echo
  133. DIE=1;
  134. fi
  135. echo -n "checking for automake >= $AUTOMAKE_REQUIRED_VERSION ... "
  136. if ($AUTOMAKE --version) < /dev/null > /dev/null 2>&1; then
  137. AUTOMAKE=$AUTOMAKE
  138. ACLOCAL=$ACLOCAL
  139. elif (automake-1.12 --version) < /dev/null > /dev/null 2>&1; then
  140. AUTOMAKE=automake-1.12
  141. ACLOCAL=aclocal-1.12
  142. elif (automake-1.11 --version) < /dev/null > /dev/null 2>&1; then
  143. AUTOMAKE=automake-1.11
  144. ACLOCAL=aclocal-1.11
  145. elif (automake-1.10 --version) < /dev/null > /dev/null 2>&1; then
  146. AUTOMAKE=automake-1.10
  147. ACLOCAL=aclocal-1.10
  148. else
  149. echo
  150. echo " You must have automake $AUTOMAKE_REQUIRED_VERSION or newer installed to compile $PROJECT."
  151. echo " Download the appropriate package for your distribution,"
  152. echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/"
  153. echo
  154. DIE=1
  155. fi
  156. if test x$AUTOMAKE != x; then
  157. VER=`$AUTOMAKE --version \
  158. | grep automake | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
  159. check_version $VER $AUTOMAKE_REQUIRED_VERSION
  160. fi
  161. echo -n "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... "
  162. if (intltoolize --version) < /dev/null > /dev/null 2>&1; then
  163. VER=`intltoolize --version \
  164. | grep intltoolize | sed "s/.* \([0-9.]*\)/\1/"`
  165. check_version $VER $INTLTOOL_REQUIRED_VERSION
  166. else
  167. echo
  168. echo " You must have intltool installed to compile $PROJECT."
  169. echo " Get the latest version from"
  170. echo " ftp://ftp.gnome.org/pub/GNOME/sources/intltool/"
  171. echo
  172. DIE=1
  173. fi
  174. echo -n "checking for xsltproc ... "
  175. if (xsltproc --version) < /dev/null > /dev/null 2>&1; then
  176. echo "yes"
  177. else
  178. echo
  179. echo " You must have xsltproc installed to compile $PROJECT."
  180. echo " Get the latest version from"
  181. echo " ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/"
  182. echo
  183. DIE=1
  184. fi
  185. if test "$DIE" -eq 1; then
  186. echo
  187. echo "Please install/upgrade the missing tools and call me again."
  188. echo
  189. exit 1
  190. fi
  191. test $TEST_TYPE $FILE || {
  192. echo
  193. echo "You must run this script in the top-level $PROJECT directory."
  194. echo
  195. exit 1
  196. }
  197. echo
  198. echo "I am going to run ./configure with the following arguments:"
  199. echo
  200. echo " $AUTOGEN_CONFIGURE_ARGS $@"
  201. echo
  202. if test -z "$*"; then
  203. echo "If you wish to pass additional arguments, please specify them "
  204. echo "on the $0 command line or set the AUTOGEN_CONFIGURE_ARGS "
  205. echo "environment variable."
  206. echo
  207. fi
  208. if test -z "$ACLOCAL_FLAGS"; then
  209. acdir=`$ACLOCAL --print-ac-dir`
  210. m4list="glib-2.0.m4 glib-gettext.m4 gtk-2.0.m4 intltool.m4 pkg.m4"
  211. for file in $m4list
  212. do
  213. if [ ! -f "$acdir/$file" ]; then
  214. echo
  215. echo "WARNING: aclocal's directory is $acdir, but..."
  216. echo " no file $acdir/$file"
  217. echo " You may see fatal macro warnings below."
  218. echo " If these files are installed in /some/dir, set the "
  219. echo " ACLOCAL_FLAGS environment variable to \"-I /some/dir\""
  220. echo " or install $acdir/$file."
  221. echo
  222. fi
  223. done
  224. fi
  225. rm -rf autom4te.cache
  226. $ACLOCAL $ACLOCAL_FLAGS
  227. RC=$?
  228. if test $RC -ne 0; then
  229. echo "$ACLOCAL gave errors. Please fix the error conditions and try again."
  230. exit $RC
  231. fi
  232. $LIBTOOLIZE --force || exit $?
  233. if test x$enable_gtk_doc = xno; then
  234. if test -f gtk-doc.make; then :; else
  235. echo "EXTRA_DIST = missing-gtk-doc" > gtk-doc.make
  236. fi
  237. echo "WARNING: You have disabled gtk-doc."
  238. echo " As a result, you will not be able to generate the API"
  239. echo " documentation and 'make dist' will not work."
  240. echo
  241. else
  242. gtkdocize || exit $?
  243. fi
  244. # optionally feature autoheader
  245. ($AUTOHEADER --version) < /dev/null > /dev/null 2>&1 && $AUTOHEADER || exit 1
  246. $AUTOMAKE --add-missing || exit $?
  247. $AUTOCONF || exit $?
  248. intltoolize --automake || exit $?
  249. cd $ORIGDIR
  250. $srcdir/configure $AUTOGEN_CONFIGURE_ARGS "$@"
  251. RC=$?
  252. if test $RC -ne 0; then
  253. echo
  254. echo "Configure failed or did not finish!"
  255. exit $RC
  256. fi
  257. echo
  258. echo "Now type 'make' to compile the $PROJECT."