autorun.sh 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2006 Jan Kneschke
  4. # Copyright (c) 2009 Sun Microsystems
  5. # All rights reserved.
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. # 2. Redistributions in binary form must reproduce the above copyright
  13. # notice, this list of conditions and the following disclaimer in the
  14. # documentation and/or other materials provided with the distribution.
  15. # 3. The name of the author may not be used to endorse or promote products
  16. # derived from this software without specific prior written permission.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  22. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  23. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  24. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  25. # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  26. # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  27. # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. #
  30. # Run this to generate all the initial makefiles, etc.
  31. die() { echo "$@"; exit 1; }
  32. # --force means overwrite ltmain.sh script if it already exists
  33. LIBTOOLIZE_FLAGS=" --automake --copy --force"
  34. # --add-missing instructs automake to install missing auxiliary files
  35. # and --force to overwrite them if they already exist
  36. AUTOMAKE_FLAGS="--add-missing --copy --force"
  37. ACLOCAL_FLAGS="-I m4"
  38. ARGV0=$0
  39. ARGS="$@"
  40. run() {
  41. echo "$ARGV0: running \`$@' $ARGS"
  42. $@ $ARGS
  43. }
  44. # Try to locate a program by using which, and verify that the file is an
  45. # executable
  46. locate_binary() {
  47. for f in $@
  48. do
  49. file=`which $f 2>/dev/null | grep -v '^no '`
  50. if test -n "$file" -a -x "$file"; then
  51. echo $file
  52. return 0
  53. fi
  54. done
  55. echo ""
  56. return 1
  57. }
  58. if test -f config/pre_hook.sh
  59. then
  60. . config/pre_hook.sh
  61. fi
  62. # Try to detect the supported binaries if the user didn't
  63. # override that by pushing the environment variable
  64. if test x$LIBTOOLIZE = x; then
  65. LIBTOOLIZE=`locate_binary glibtoolize libtoolize-1.5 libtoolize`
  66. if test x$LIBTOOLIZE = x; then
  67. die "Did not find a supported libtoolize"
  68. fi
  69. fi
  70. if test x$ACLOCAL = x; then
  71. ACLOCAL=`locate_binary aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal19 aclocal`
  72. if test x$ACLOCAL = x; then
  73. die "Did not find a supported aclocal"
  74. fi
  75. fi
  76. if test x$AUTOMAKE = x; then
  77. AUTOMAKE=`locate_binary automake-1.11 automake-1.10 automake-1.9 automake19 automake`
  78. if test x$AUTOMAKE = x; then
  79. die "Did not find a supported automake"
  80. fi
  81. fi
  82. if test x$AUTOCONF = x; then
  83. AUTOCONF=`locate_binary autoconf-2.59 autoconf259 autoconf`
  84. if test x$AUTOCONF = x; then
  85. die "Did not find a supported autoconf"
  86. fi
  87. fi
  88. if test x$AUTOHEADER = x; then
  89. AUTOHEADER=`locate_binary autoheader-2.59 autoheader259 autoheader`
  90. if test x$AUTOHEADER = x; then
  91. die "Did not find a supported autoheader"
  92. fi
  93. fi
  94. run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute libtoolize"
  95. run $ACLOCAL $ACLOCAL_FLAGS || die "Can't execute aclocal"
  96. run $AUTOHEADER || die "Can't execute autoheader"
  97. run $AUTOMAKE $AUTOMAKE_FLAGS || die "Can't execute automake"
  98. run $AUTOCONF || die "Can't execute autoconf"
  99. if test -f config/post_hook.sh
  100. then
  101. . config/post_hook.sh
  102. fi
  103. echo "---"
  104. echo "Configured with the following tools:"
  105. echo " * `$LIBTOOLIZE --version | head -1`"
  106. echo " * `$ACLOCAL --version | head -1`"
  107. echo " * `$AUTOHEADER --version | head -1`"
  108. echo " * `$AUTOMAKE --version | head -1`"
  109. echo " * `$AUTOCONF --version | head -1`"
  110. echo "---"