objcxx-minidemo.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #! /bin/sh
  2. # Copyright (C) 2012-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. # Dummy demo package using Objective C++ and doing distcheck.
  17. # See also sister test 'objc-minidemo.sh'.
  18. required=native
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_PROG_OBJCXX
  22. AC_CONFIG_HEADERS([config.h])
  23. AC_OUTPUT
  24. END
  25. cat > Makefile.am << 'END'
  26. AM_DEFAULT_SOURCE_EXT = .mm
  27. bin_PROGRAMS = ok
  28. noinst_PROGRAMS = ko
  29. TESTS = $(bin_PROGRAMS) $(XFAIL_TESTS)
  30. XFAIL_TESTS = $(noinst_PROGRAMS)
  31. END
  32. cat > ok.mm << 'END'
  33. /* The use of #import makes this valid Object C++ but invalid C++. */
  34. #import <iostream>
  35. #import <config.h>
  36. int main (void)
  37. {
  38. std::cout << "Success (" << PACKAGE_STRING << ")\n";
  39. return 0;
  40. }
  41. END
  42. cat > ko.mm << 'END'
  43. /* The use of #import makes this valid Object C++ but invalid C++. */
  44. #import <cstdio>
  45. int main (void)
  46. {
  47. printf("Failure\n");
  48. return 1;
  49. }
  50. END
  51. $ACLOCAL
  52. $AUTOCONF
  53. $AUTOHEADER
  54. $AUTOMAKE --add-missing
  55. ./configure
  56. $MAKE
  57. $MAKE check
  58. $MAKE distcheck
  59. :