autogen.sh 8.6 KB

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