2
0

vala-configure.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #! /bin/sh
  2. # Copyright (C) 2008-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Test AM_PROG_VALAC.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AC_PROG_CC
  20. AM_PROG_VALAC([1.2.3])
  21. AC_OUTPUT
  22. END
  23. cat > Makefile.am << 'END'
  24. has-valac:
  25. case '$(VALAC)' in */bin/valac) exit 0;; *) exit 1;; esac
  26. no-valac:
  27. test x'$(VALAC)' = x'valac'
  28. END
  29. mkdir bin
  30. cat > bin/valac << 'END'
  31. #! /bin/sh
  32. if test "x$1" = x--version; then
  33. echo "${vala_version-1.2.3}"
  34. fi
  35. exit 0
  36. END
  37. chmod +x bin/valac
  38. cat > bin/valac.old << 'END'
  39. #! /bin/sh
  40. if test "x$1" = x--version; then
  41. echo 0.1
  42. fi
  43. exit 0
  44. END
  45. chmod +x bin/valac.old
  46. PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
  47. # Avoid interferences from the environment.
  48. unset VALAC vala_version
  49. $ACLOCAL
  50. $AUTOMAKE -a
  51. $AUTOCONF
  52. st=0; ./configure 2>stderr || st=$?
  53. cat stderr >&2
  54. grep 'WARNING.*vala' stderr && exit 1
  55. test $st -eq 0
  56. $MAKE has-valac
  57. st=0; vala_version=99.9 ./configure 2>stderr || st=$?
  58. cat stderr >&2
  59. grep 'WARNING.*vala' stderr && exit 1
  60. test $st -eq 0
  61. $MAKE has-valac
  62. st=0; vala_version=0.1.2 ./configure 2>stderr || st=$?
  63. cat stderr >&2
  64. test $st -eq 0
  65. grep '^configure: WARNING: no proper vala compiler found' stderr
  66. $MAKE no-valac
  67. st=0; ./configure VALAC="$(pwd)/bin/valac.old" 2>stderr || st=$?
  68. cat stderr >&2
  69. test $st -eq 0 || exit 1
  70. grep '^configure: WARNING: no proper vala compiler found' stderr
  71. $MAKE no-valac
  72. sed 's/^\(AM_PROG_VALAC\).*/\1([1], [: > ok], [: > ko])/' <configure.ac >t
  73. mv -f t configure.ac
  74. rm -rf autom4te*.cache
  75. $ACLOCAL
  76. $AUTOCONF
  77. st=0; ./configure 2>stderr || st=$?
  78. cat stderr >&2
  79. grep 'WARNING.*vala' stderr && exit 1
  80. test -f ok
  81. test ! -e ko
  82. $MAKE has-valac
  83. rm -f ok ko
  84. st=0; vala_version=0.1.2 ./configure 2>stderr || st=$?
  85. cat stderr >&2
  86. grep 'WARNING.*vala' stderr && exit 1
  87. test $st -eq 0
  88. test ! -e ok
  89. test -f ko
  90. $MAKE no-valac
  91. rm -f ok ko
  92. st=0; ./configure VALAC="$(pwd)/bin/valac.old" 2>stderr || st=$?
  93. cat stderr >&2
  94. grep 'WARNING.*vala' stderr && exit 1
  95. test $st -eq 0
  96. test ! -e ok
  97. test -f ko
  98. $MAKE no-valac
  99. rm -f ok ko
  100. :