You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

174 lines
4.6 KiB

  1. #! /bin/sh
  2. # bootstrap: generic bootstrap/autogen.sh script for autotools projects
  3. #
  4. # Copyright (c) 2002-2010 Sam Hocevar <sam@hocevar.net>
  5. #
  6. # This program is free software. It comes without any warranty, to
  7. # the extent permitted by applicable law. You can redistribute it
  8. # and/or modify it under the terms of the Do What The Fuck You Want
  9. # To Public License, Version 2, as published by Sam Hocevar. See
  10. # http://www.wtfpl.net/ for more details.
  11. #
  12. # The latest version of this script can be found at the following place:
  13. # http://caca.zoy.org/wiki/build
  14. # Die if an error occurs
  15. set -e
  16. # LolEngine specific:
  17. sed -ne '/AC_CONFIG_FILES/,$p' configure.ac \
  18. | sed -ne 's@[^a-z]*\(.*/.*\)[^a-z]*@\1@p' | while read p; do
  19. case "$p" in
  20. *Makefile)
  21. required="${p}.am"
  22. ;;
  23. *)
  24. required="${p}.in"
  25. ;;
  26. esac
  27. if [ ! -f "${required}" ]; then
  28. echo "bootstrap: ${required} does not exist -- creating stub"
  29. case "$p" in
  30. */*)
  31. mkdir -p "${p%/*}"
  32. ;;
  33. esac
  34. echo "# Stub created by bootstrap" > "${required}"
  35. fi
  36. done
  37. # Guess whether we are using configure.ac or configure.in
  38. if test -f configure.ac; then
  39. conffile="configure.ac"
  40. elif test -f configure.in; then
  41. conffile="configure.in"
  42. else
  43. echo "$0: could not find configure.ac or configure.in"
  44. exit 1
  45. fi
  46. # Check for needed features
  47. auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *([[ ]*\([^] )]*\).*/\1/p' $conffile`"
  48. pkgconfig="`grep '^[ \t]*PKG_PROG_PKG_CONFIG' $conffile >/dev/null 2>&1 && echo yes || echo no`"
  49. libtool="`grep '^[ \t]*A._PROG_LIBTOOL' $conffile >/dev/null 2>&1 && echo yes || echo no`"
  50. header="`grep '^[ \t]*A._CONFIG_HEADER' $conffile >/dev/null 2>&1 && echo yes || echo no`"
  51. makefile="`[ -f Makefile.am ] && echo yes || echo no`"
  52. aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am 2>/dev/null || :`"
  53. # Check for automake
  54. amvers="no"
  55. for v in 13 12 11 10 9 8 7 6 5; do
  56. if automake-1.${v} --version >/dev/null 2>&1; then
  57. amvers="-1.${v}"
  58. break
  59. elif automake1.${v} --version >/dev/null 2>&1; then
  60. amvers="1.${v}"
  61. break
  62. fi
  63. done
  64. if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
  65. amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
  66. if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then
  67. amvers="no"
  68. else
  69. amvers=""
  70. fi
  71. fi
  72. if test "$amvers" = "no"; then
  73. echo "$0: you need automake version 1.5 or later"
  74. exit 1
  75. fi
  76. # Check for autoconf
  77. acvers="no"
  78. for v in "" "259" "253"; do
  79. if autoconf${v} --version >/dev/null 2>&1; then
  80. acvers="${v}"
  81. break
  82. fi
  83. done
  84. if test "$acvers" = "no"; then
  85. echo "$0: you need autoconf"
  86. exit 1
  87. fi
  88. # Check for libtool
  89. if test "$libtool" = "yes"; then
  90. libtoolize="no"
  91. if glibtoolize --version >/dev/null 2>&1; then
  92. libtoolize="glibtoolize"
  93. else
  94. for v in "16" "15" "" "14"; do
  95. if libtoolize${v} --version >/dev/null 2>&1; then
  96. libtoolize="libtoolize${v}"
  97. break
  98. fi
  99. done
  100. fi
  101. if test "$libtoolize" = "no"; then
  102. echo "$0: you need libtool"
  103. exit 1
  104. fi
  105. fi
  106. # Check for pkg-config
  107. if test "$pkgconfig" = "yes"; then
  108. if ! pkg-config --version >/dev/null 2>&1; then
  109. echo "$0: you need pkg-config"
  110. exit 1
  111. fi
  112. fi
  113. # Remove old cruft
  114. for x in aclocal.m4 configure config.guess config.log config.sub config.cache config.h.in config.h compile libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh; do rm -f $x autotools/$x; if test -n "$auxdir"; then rm -f "$auxdir/$x"; fi; done
  115. rm -Rf autom4te.cache
  116. if test -n "$auxdir"; then
  117. if test ! -d "$auxdir"; then
  118. mkdir "$auxdir"
  119. fi
  120. aclocalflags="-I $auxdir -I . ${aclocalflags}"
  121. fi
  122. # Honour M4PATH because sometimes M4 doesn't
  123. save_IFS=$IFS
  124. IFS=:
  125. tmp="$M4PATH"
  126. for x in $tmp; do
  127. if test -n "$x"; then
  128. aclocalflags="-I $x ${aclocalflags}"
  129. fi
  130. done
  131. IFS=$save_IFS
  132. # Explain what we are doing from now
  133. set -x
  134. # Bootstrap package
  135. if test "$libtool" = "yes"; then
  136. ${libtoolize} --copy --force
  137. if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
  138. echo "$0: working around a minor libtool issue"
  139. mv ltmain.sh "$auxdir/"
  140. fi
  141. fi
  142. aclocal${amvers} ${aclocalflags}
  143. autoconf${acvers}
  144. if test "$header" = "yes"; then
  145. autoheader${acvers}
  146. fi
  147. if test "$makefile" = "yes"; then
  148. #add --include-deps if you want to bootstrap with any other compiler than gcc
  149. #automake${amvers} --add-missing --copy --include-deps
  150. automake${amvers} --foreign --add-missing --copy
  151. fi
  152. # Remove cruft that we no longer want
  153. rm -Rf autom4te.cache