Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

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