您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

137 行
3.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. # 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. makefile="`[ -f Makefile.am ] && echo yes || echo no`"
  30. aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am 2>/dev/null || :`"
  31. # Check for automake
  32. amvers="no"
  33. for v in "" "-1.15" "-1.14" "-1.13" "-1.12" "-1.11"; do
  34. if automake${v} --version > /dev/null 2>&1; then
  35. amvers=${v}
  36. break
  37. fi
  38. done
  39. if test "$amvers" = "no"; then
  40. echo "$0: automake not found"
  41. exit 1
  42. fi
  43. # Check for autoconf
  44. acvers="no"
  45. for v in "" "259" "253"; do
  46. if autoconf${v} --version >/dev/null 2>&1; then
  47. acvers="${v}"
  48. break
  49. fi
  50. done
  51. if test "$acvers" = "no"; then
  52. echo "$0: autoconf not found"
  53. exit 1
  54. fi
  55. # Check for libtool
  56. if test "$libtool" = "yes"; then
  57. libtoolize="no"
  58. if glibtoolize --version >/dev/null 2>&1; then
  59. libtoolize="glibtoolize"
  60. else
  61. for v in "16" "15" "" "14"; do
  62. if libtoolize${v} --version >/dev/null 2>&1; then
  63. libtoolize="libtoolize${v}"
  64. break
  65. fi
  66. done
  67. fi
  68. if test "$libtoolize" = "no"; then
  69. echo "$0: libtool not found"
  70. exit 1
  71. fi
  72. fi
  73. # Check for pkg-config
  74. if test "$pkgconfig" = "yes"; then
  75. if ! pkg-config --version >/dev/null 2>&1; then
  76. echo "$0: pkg-config not found"
  77. exit 1
  78. fi
  79. fi
  80. # Remove old cruft
  81. 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
  82. rm -Rf autom4te.cache
  83. if test -n "$auxdir"; then
  84. if test ! -d "$auxdir"; then
  85. mkdir "$auxdir"
  86. fi
  87. aclocalflags="-I $auxdir -I . ${aclocalflags}"
  88. fi
  89. # Honour M4PATH because sometimes M4 doesn't
  90. save_IFS=$IFS
  91. IFS=:
  92. tmp="$M4PATH"
  93. for x in $tmp; do
  94. if test -n "$x"; then
  95. aclocalflags="-I $x ${aclocalflags}"
  96. fi
  97. done
  98. IFS=$save_IFS
  99. # Explain what we are doing from now
  100. set -x
  101. # Bootstrap package
  102. if test "$libtool" = "yes"; then
  103. ${libtoolize} --copy --force
  104. if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
  105. echo "$0: working around a minor libtool issue"
  106. mv ltmain.sh "$auxdir/"
  107. fi
  108. fi
  109. aclocal${amvers} ${aclocalflags}
  110. autoconf${acvers}
  111. autoheader${acvers}
  112. if test "$makefile" = "yes"; then
  113. #add --include-deps if you want to bootstrap with any other compiler than gcc
  114. #automake${amvers} --add-missing --copy --include-deps
  115. automake${amvers} --foreign --add-missing --copy
  116. fi
  117. # Remove cruft that we no longer want
  118. rm -Rf autom4te.cache