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.
 
 
 
 

125 lines
3.4 KiB

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