選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

159 行
4.1 KiB

  1. #! /bin/sh
  2. # bootstrap: generic bootstrap/autogen.sh script for autotools projects
  3. #
  4. # Copyright (c) 2002-2011 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. v=5
  35. tries=0
  36. while : ; do
  37. if automake-1.${v} --version >/dev/null 2>&1; then
  38. amvers="-1.${v}"
  39. tries=0
  40. elif automake1.${v} --version >/dev/null 2>&1; then
  41. amvers="1.${v}"
  42. tries=0
  43. fi
  44. if [ "$tries" = 20 ]; then
  45. break
  46. fi
  47. v="$((v + 1))"
  48. tries="$((tries + 1))"
  49. done
  50. if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
  51. amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
  52. if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then
  53. amvers="no"
  54. else
  55. amvers=""
  56. fi
  57. fi
  58. if test "$amvers" = "no"; then
  59. echo "$0: you need automake version 1.5 or later"
  60. exit 1
  61. fi
  62. # Check for autoconf
  63. acvers="no"
  64. for v in "" "259" "253"; do
  65. if autoconf${v} --version >/dev/null 2>&1; then
  66. acvers="${v}"
  67. break
  68. fi
  69. done
  70. if test "$acvers" = "no"; then
  71. echo "$0: you need autoconf"
  72. exit 1
  73. fi
  74. # Check for libtool
  75. if test "$libtool" = "yes"; then
  76. libtoolize="no"
  77. if glibtoolize --version >/dev/null 2>&1; then
  78. libtoolize="glibtoolize"
  79. else
  80. for v in "16" "15" "" "14"; do
  81. if libtoolize${v} --version >/dev/null 2>&1; then
  82. libtoolize="libtoolize${v}"
  83. break
  84. fi
  85. done
  86. fi
  87. if test "$libtoolize" = "no"; then
  88. echo "$0: you need libtool"
  89. exit 1
  90. fi
  91. fi
  92. # Check for pkg-config
  93. if test "$pkgconfig" = "yes"; then
  94. if ! pkg-config --version >/dev/null 2>&1; then
  95. echo "$0: you need pkg-config"
  96. exit 1
  97. fi
  98. fi
  99. # Remove old cruft
  100. 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
  101. rm -Rf autom4te.cache
  102. if test -n "$auxdir"; then
  103. if test ! -d "$auxdir"; then
  104. mkdir "$auxdir"
  105. fi
  106. aclocalflags="${aclocalflags} -I $auxdir -I ."
  107. fi
  108. # Honour M4PATH because sometimes M4 doesn't
  109. save_IFS=$IFS
  110. IFS=:
  111. tmp="$M4PATH"
  112. for x in $tmp; do
  113. if test -n "$x"; then
  114. aclocalflags="${aclocalflags} -I $x"
  115. fi
  116. done
  117. IFS=$save_IFS
  118. # Explain what we are doing from now
  119. set -x
  120. # Bootstrap package
  121. if test "$libtool" = "yes"; then
  122. ${libtoolize} --copy --force
  123. if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
  124. echo "$0: working around a minor libtool issue"
  125. mv ltmain.sh "$auxdir/"
  126. fi
  127. fi
  128. aclocal${amvers} ${aclocalflags}
  129. autoconf${acvers}
  130. if test "$header" = "yes"; then
  131. autoheader${acvers}
  132. fi
  133. if test "$makefile" = "yes"; then
  134. #add --include-deps if you want to bootstrap with any other compiler than gcc
  135. #automake${amvers} --add-missing --copy --include-deps
  136. automake${amvers} --foreign --add-missing --copy
  137. fi
  138. # Remove cruft that we no longer want
  139. rm -Rf autom4te.cache