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.
 
 
 
 
 
 

142 regels
3.9 KiB

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