canon7.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #! /bin/sh
  2. # Copyright (C) 2010-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. # Stress test on canonicalization.
  17. required='cc libtool libtoolize'
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_PROG_CC
  21. AM_PROG_AR
  22. AC_PROG_RANLIB dnl: for static libraries
  23. AC_PROG_LIBTOOL dnl: for libtool libraries
  24. AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
  25. AC_OUTPUT
  26. END
  27. if touch ,foo-bar libb.az+baz lib~zardoz,,; then
  28. rm -f ,foo-bar libb.az+baz lib~zardoz,,
  29. else
  30. skip_ "cannot create regular files with \"tricky\" names"
  31. fi
  32. cat > Makefile.am << 'END'
  33. noinst_PROGRAMS = dummy_static dummy_dynamic ,foo-bar
  34. noinst_LIBRARIES = libb.az+baz.a
  35. noinst_LTLIBRARIES = lib~zardoz,,.la
  36. dummy_static_SOURCES = dummy.c lib.h
  37. dummy_dynamic_SOURCES = $(dummy_static_SOURCES)
  38. dummy_static_LDADD = $(noinst_LIBRARIES)
  39. dummy_dynamic_LDADD = $(noinst_LTLIBRARIES)
  40. _foo_bar_SOURCES = foobar.c
  41. libb_az_baz_a_SOURCES = libs.c
  42. lib_zardoz___la_SOURCES = libd.c
  43. check-local:
  44. ls -l
  45. if CROSS_COMPILING
  46. test -f ./,foo-bar$(EXEEXT)
  47. test -f ./dummy_static$(EXEEXT)
  48. test -f ./dummy_dynamic$(EXEEXT)
  49. else !CROSS_COMPILING
  50. ./,foo-bar
  51. ./dummy_static
  52. ./dummy_dynamic
  53. ./,foo-bar | grep 'Hello, FooBar!'
  54. ./dummy_static | grep 'Hello from Static!'
  55. ./dummy_dynamic | grep 'Hello from Dynamic!'
  56. endif !CROSS_COMPILING
  57. END
  58. cat > foobar.c << 'END'
  59. #include <stdio.h>
  60. int main(void)
  61. {
  62. printf("Hello, FooBar!\n");
  63. return 0;
  64. }
  65. END
  66. cat > dummy.c << 'END'
  67. #include <stdio.h>
  68. #include "lib.h"
  69. int main(void)
  70. {
  71. printf("Hello from %s!\n", dummy_func());
  72. return 0;
  73. }
  74. END
  75. echo 'const char *dummy_func(void);' > lib.h
  76. echo 'const char *dummy_func(void) { return "Dynamic"; }' > libd.c
  77. echo 'const char *dummy_func(void) { return "Static"; }' > libs.c
  78. libtoolize
  79. $ACLOCAL
  80. $AUTOCONF
  81. $AUTOMAKE -a
  82. ./configure
  83. $MAKE check
  84. $MAKE distcheck
  85. :