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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #! /bin/sh
  2. # $Id$
  3. # bootstrap: generic bootstrap/autogen.sh script for autotools projects
  4. #
  5. # Copyright (c) 2002-2007 Sam Hocevar <sam@zoy.org>
  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. libtool="`grep -q '^[ \t]*A._PROG_LIBTOOL' $conffile && echo yes || echo no`"
  29. pkgconfig="`grep -q '^[ \t]*PKG_PROG_PKG_CONFIG' $conffile && echo yes || echo no`"
  30. header="`grep -q '^[ \t]*A._CONFIG_HEADER' $conffile && echo yes || echo no`"
  31. aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am`"
  32. # Check for automake
  33. amvers="no"
  34. for v in 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. if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
  44. amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
  45. if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then
  46. amvers="no"
  47. else
  48. amvers=""
  49. fi
  50. fi
  51. if test "$amvers" = "no"; then
  52. echo "$0: you need automake version 1.5 or later"
  53. exit 1
  54. fi
  55. # Check for autoconf
  56. acvers="no"
  57. for v in "" "259" "253"; do
  58. if autoconf${v} --version >/dev/null 2>&1; then
  59. acvers="${v}"
  60. break
  61. fi
  62. done
  63. if test "$acvers" = "no"; then
  64. echo "$0: you need autoconf"
  65. exit 1
  66. fi
  67. # Check for libtool
  68. if test "$libtool" = "yes"; then
  69. libtoolize="no"
  70. if glibtoolize --version >/dev/null 2>&1; then
  71. libtoolize="glibtoolize"
  72. else
  73. for v in "16" "15" "" "14"; do
  74. if libtoolize${v} --version >/dev/null 2>&1; then
  75. libtoolize="libtoolize${v}"
  76. break
  77. fi
  78. done
  79. fi
  80. if test "$libtoolize" = "no"; then
  81. echo "$0: you need libtool"
  82. exit 1
  83. fi
  84. fi
  85. # Check for pkg-config
  86. if test "$pkgconfig" = "yes"; then
  87. if ! pkg-config --version >/dev/null 2>&1; then
  88. echo "$0: you need pkg-config"
  89. exit 1
  90. fi
  91. fi
  92. # Remove old cruft
  93. 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
  94. rm -Rf autom4te.cache
  95. if test -n "$auxdir"; then
  96. if test ! -d "$auxdir"; then
  97. mkdir "$auxdir"
  98. fi
  99. aclocalflags="${aclocalflags} -I $auxdir -I ."
  100. fi
  101. # Explain what we are doing from now
  102. set -x
  103. # Bootstrap package
  104. if test "$libtool" = "yes"; then
  105. ${libtoolize} --copy --force
  106. if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
  107. echo "$0: working around a minor libtool issue"
  108. mv ltmain.sh "$auxdir/"
  109. fi
  110. fi
  111. aclocal${amvers} ${aclocalflags}
  112. autoconf${acvers}
  113. if test "$header" = "yes"; then
  114. autoheader${acvers}
  115. fi
  116. #add --include-deps if you want to bootstrap with any other compiler than gcc
  117. #automake${amvers} --add-missing --copy --include-deps
  118. automake${amvers} --foreign --add-missing --copy
  119. # Remove cruft that we no longer want
  120. rm -Rf autom4te.cache