Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

177 rader
4.7 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. echo 'include $(top_srcdir)/build/autotools/common.am' >> "${required}"
  36. fi
  37. done
  38. # Guess whether we are using configure.ac or configure.in
  39. if test -f configure.ac; then
  40. conffile="configure.ac"
  41. elif test -f configure.in; then
  42. conffile="configure.in"
  43. else
  44. echo "$0: could not find configure.ac or configure.in"
  45. exit 1
  46. fi
  47. # Check for needed features
  48. auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *([[ ]*\([^] )]*\).*/\1/p' $conffile`"
  49. pkgconfig="`grep '^[ \t]*PKG_PROG_PKG_CONFIG' $conffile >/dev/null 2>&1 && echo yes || echo no`"
  50. libtool="`grep '^[ \t]*A._PROG_LIBTOOL' $conffile >/dev/null 2>&1 && echo yes || echo no`"
  51. header="`grep '^[ \t]*A._CONFIG_HEADER' $conffile >/dev/null 2>&1 && echo yes || echo no`"
  52. makefile="`[ -f Makefile.am ] && echo yes || echo no`"
  53. aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am 2>/dev/null || :`"
  54. # Check for automake
  55. amvers="no"
  56. v=20; vend=5
  57. while [ "$v" -gt "$vend" ]; do
  58. if automake-1.${v} --version >/dev/null 2>&1; then
  59. amvers="-1.${v}"
  60. break
  61. elif automake1.${v} --version >/dev/null 2>&1; then
  62. amvers="1.${v}"
  63. break
  64. fi
  65. v="`expr "$v" - 1`"
  66. done
  67. if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
  68. amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
  69. if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then
  70. amvers="no"
  71. else
  72. amvers=""
  73. fi
  74. fi
  75. if test "$amvers" = "no"; then
  76. echo "$0: you need automake version 1.5 or later"
  77. exit 1
  78. fi
  79. # Check for autoconf
  80. acvers="no"
  81. for v in "" "259" "253"; do
  82. if autoconf${v} --version >/dev/null 2>&1; then
  83. acvers="${v}"
  84. break
  85. fi
  86. done
  87. if test "$acvers" = "no"; then
  88. echo "$0: you need autoconf"
  89. exit 1
  90. fi
  91. # Check for libtool
  92. if test "$libtool" = "yes"; then
  93. libtoolize="no"
  94. if glibtoolize --version >/dev/null 2>&1; then
  95. libtoolize="glibtoolize"
  96. else
  97. for v in "16" "15" "" "14"; do
  98. if libtoolize${v} --version >/dev/null 2>&1; then
  99. libtoolize="libtoolize${v}"
  100. break
  101. fi
  102. done
  103. fi
  104. if test "$libtoolize" = "no"; then
  105. echo "$0: you need libtool"
  106. exit 1
  107. fi
  108. fi
  109. # Check for pkg-config
  110. if test "$pkgconfig" = "yes"; then
  111. if ! pkg-config --version >/dev/null 2>&1; then
  112. echo "$0: you need pkg-config"
  113. exit 1
  114. fi
  115. fi
  116. # Remove old cruft
  117. 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
  118. rm -Rf autom4te.cache
  119. if test -n "$auxdir"; then
  120. if test ! -d "$auxdir"; then
  121. mkdir "$auxdir"
  122. fi
  123. aclocalflags="-I $auxdir -I . ${aclocalflags}"
  124. fi
  125. # Honour M4PATH because sometimes M4 doesn't
  126. save_IFS=$IFS
  127. IFS=:
  128. tmp="$M4PATH"
  129. for x in $tmp; do
  130. if test -n "$x"; then
  131. aclocalflags="-I $x ${aclocalflags}"
  132. fi
  133. done
  134. IFS=$save_IFS
  135. # Explain what we are doing from now
  136. set -x
  137. # Bootstrap package
  138. if test "$libtool" = "yes"; then
  139. ${libtoolize} --copy --force
  140. if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
  141. echo "$0: working around a minor libtool issue"
  142. mv ltmain.sh "$auxdir/"
  143. fi
  144. fi
  145. aclocal${amvers} ${aclocalflags}
  146. autoconf${acvers}
  147. if test "$header" = "yes"; then
  148. autoheader${acvers}
  149. fi
  150. if test "$makefile" = "yes"; then
  151. #add --include-deps if you want to bootstrap with any other compiler than gcc
  152. #automake${amvers} --add-missing --copy --include-deps
  153. automake${amvers} --foreign --add-missing --copy
  154. fi
  155. # Remove cruft that we no longer want
  156. rm -Rf autom4te.cache