autogen.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #!/bin/sh
  2. # Run this to generate all the initial makefiles, etc.
  3. testProgram()
  4. {
  5. cmd=$1
  6. if [ -z "$cmd" ]; then
  7. return 1;
  8. fi
  9. arch=`uname -s`
  10. # Make sure the which is in an if-block... on some platforms it throws exceptions
  11. #
  12. # The ERR trap is not executed if the failed command is part
  13. # of an until or while loop, part of an if statement, part of a &&
  14. # or || list.
  15. if
  16. which $cmd </dev/null >/dev/null 2>&1
  17. then
  18. :
  19. else
  20. return 1
  21. fi
  22. # The GNU standard is --version
  23. if
  24. $cmd --version </dev/null >/dev/null 2>&1
  25. then
  26. return 0
  27. fi
  28. # Maybe it suppports -V instead
  29. if
  30. $cmd -V </dev/null >/dev/null 2>&1
  31. then
  32. return 0
  33. fi
  34. # Nope, the program seems broken
  35. return 1
  36. }
  37. arch=`uname -s`
  38. # Disable the errors on FreeBSD until a fix can be found.
  39. if [ ! "$arch" = "FreeBSD" ]; then
  40. set -e
  41. #
  42. # All errors are fatal from here on out...
  43. # The shell will complain and exit on any "uncaught" error code.
  44. #
  45. #
  46. # And the trap will ensure sure some kind of error message comes out.
  47. #
  48. trap 'echo ""; echo "$0 exiting due to error (sorry!)." >&2' 0
  49. fi
  50. RC=0
  51. gnu="ftp://ftp.gnu.org/pub/gnu"
  52. # Check for Autoconf
  53. for command in autoconf autoconf213 autoconf253 autoconf259
  54. do
  55. if
  56. testProgram $command == 1
  57. then
  58. autoconf=$command
  59. autoheader=`echo "$autoconf" | sed -e 's/autoconf/autoheader/'`
  60. autom4te=`echo "$autoconf" | sed -e 's/autoconf/autmo4te/'`
  61. autoreconf=`echo "$autoconf" | sed -e 's/autoconf/autoreconf/'`
  62. autoscan=`echo "$autoconf" | sed -e 's/autoconf/autoscan/'`
  63. autoupdate=`echo "$autoconf" | sed -e 's/autoconf/autoupdate/'`
  64. ifnames=`echo "$autoconf" | sed -e 's/autoconf/ifnames/'`
  65. fi
  66. done
  67. # Check for automake
  68. for command in automake19 automake-1.9 automake
  69. do
  70. if
  71. testProgram $command
  72. then
  73. automake=$command
  74. aclocal=`echo "$automake" | sed -e 's/automake/aclocal/'`
  75. fi
  76. done
  77. if [ -z $autoconf ]; then
  78. echo You must have autoconf installed to compile the corosync package.
  79. echo Download the appropriate package for your system,
  80. echo or get the source tarball at: $gnu/autoconf/
  81. exit 1
  82. elif [ -z $automake ]; then
  83. echo You must have automake installed to compile the corosync package.
  84. echo Download the appropriate package for your system,
  85. echo or get the source tarball at: $gnu/automake/
  86. exit 1
  87. fi
  88. # Create local copies so that the incremental updates will work.
  89. rm -f ./autoconf ./automake ./autoheader
  90. ln -s `which $autoconf` ./autoconf
  91. ln -s `which $automake` ./automake
  92. ln -s `which $autoheader` ./autoheader
  93. printf "$autoconf:\t"
  94. $autoconf --version | head -n 1
  95. printf "$automake:\t"
  96. $automake --version | head -n 1
  97. echo $aclocal $ACLOCAL_FLAGS
  98. $aclocal $ACLOCAL_FLAGS
  99. echo $autoheader
  100. $autoheader
  101. echo $automake --add-missing --include-deps --copy
  102. $automake --add-missing --include-deps --copy
  103. echo $autoconf
  104. $autoconf
  105. echo Now run ./configure
  106. trap '' 0