autogen.sh 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/bin/sh
  2. # set required versions of tools here
  3. # the version is dotted integers like X.Y.Z where
  4. # X, Y, and Z are integers
  5. # comparisons are done using shell -lt, -gt, etc.
  6. # this works if the numbers are zero filled as well
  7. # so 06 == 6
  8. # autoconf version required
  9. # need 2.69 or later
  10. ac_need_maj=2
  11. ac_need_min=69
  12. # automake version required
  13. # need 1.13.4 or later
  14. am_need_maj=1
  15. am_need_min=13
  16. am_need_rev=4
  17. # libtool version required
  18. # need 2.4.2 or later
  19. lt_need_maj=2
  20. lt_need_min=4
  21. lt_need_rev=2
  22. # should never have to touch anything below this line unless there is a bug
  23. ###########################################################################
  24. # input
  25. # arg1 - version string in the form "X.Y[.Z]" - the .Z is optional
  26. # args remaining - the needed X, Y, and Z to match
  27. # output
  28. # return 0 - success - the version string is >= the required X.Y.Z
  29. # return 1 - failure - the version string is < the required X.Y.Z
  30. # NOTE: All input must be integers, otherwise you will see shell errors
  31. checkvers() {
  32. vers="$1"; shift
  33. needmaj="$1"; shift
  34. needmin="$1"; shift
  35. needrev="$1"; shift
  36. verslist=`echo $vers | tr '.' ' '`
  37. set $verslist
  38. maj=$1; shift
  39. min=$1; shift
  40. rev=$1; shift
  41. if [ "$maj" -gt "$needmaj" ] ; then return 0; fi
  42. if [ "$maj" -lt "$needmaj" ] ; then return 1; fi
  43. # if we got here, maj == needmaj
  44. if [ -z "$needmin" ] ; then return 0; fi
  45. if [ "$min" -gt "$needmin" ] ; then return 0; fi
  46. if [ "$min" -lt "$needmin" ] ; then return 1; fi
  47. # if we got here, min == needmin
  48. if [ -z "$needrev" ] ; then return 0; fi
  49. if [ "$rev" -gt "$needrev" ] ; then return 0; fi
  50. if [ "$rev" -lt "$needrev" ] ; then return 1; fi
  51. # if we got here, rev == needrev
  52. return 0
  53. }
  54. # Check autoconf version
  55. AC_VERSION=`autoconf --version | sed '/^autoconf/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`
  56. if checkvers "$AC_VERSION" $ac_need_maj $ac_need_min ; then
  57. echo Found valid autoconf version $AC_VERSION
  58. else
  59. echo "You must have autoconf version $ac_need_maj.$ac_need_min or later installed (found version $AC_VERSION)."
  60. exit 1
  61. fi
  62. # Check automake version
  63. AM_VERSION=`automake --version | sed '/^automake/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`
  64. if checkvers "$AM_VERSION" $am_need_maj $am_need_min $am_need_rev ; then
  65. echo Found valid automake version $AM_VERSION
  66. else
  67. echo "You must have automake version $am_need_maj.$am_need_min.$am_need_rev or later installed (found version $AM_VERSION)."
  68. exit 1
  69. fi
  70. # Check libtool version
  71. # NOTE: some libtool versions report a letter at the end e.g. on RHEL6
  72. # the version is 2.2.6b - for comparison purposes, just strip off the
  73. # letter - note that the shell -lt and -gt comparisons will fail with
  74. # test: 6b: integer expression expected if the number to compare
  75. # contains a non-digit
  76. LT_VERSION=`libtool --version | sed '/GNU libtool/ {s/^.* \([1-9][0-9a-zA-Z.]*\)$/\1/; s/[a-zA-Z]//g; q}'`
  77. if checkvers "$LT_VERSION" $lt_need_maj $lt_need_min $lt_need_rev ; then
  78. echo Found valid libtool version $LT_VERSION
  79. else
  80. echo "You must have libtool version $lt_need_maj.$lt_need_min.$lt_need_rev or later installed (found version $LT_VERSION)."
  81. exit 1
  82. fi
  83. # Run autoreconf
  84. echo "Running autoreconf -fvi"
  85. autoreconf -fvi