amhello-cflags.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #! /bin/sh
  2. # Copyright (C) 2011-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 an example from the manual about the 'amhello' package:
  17. # using VPATH builds to configure the same package with different
  18. # options.
  19. am_create_testdir=empty
  20. required=gcc
  21. . test-init.sh
  22. cp "$am_docdir"/amhello-1.0.tar.gz . \
  23. || fatal_ "cannot get amhello tarball"
  24. gzip -dc amhello-1.0.tar.gz | tar xf -
  25. cd amhello-1.0
  26. mkdir debug optim
  27. cd debug
  28. ../configure CFLAGS='-g -O0'
  29. $MAKE
  30. ls -l . src # For debugging.
  31. cd ../optim
  32. ../configure CFLAGS='-O3 -fomit-frame-pointer'
  33. $MAKE
  34. ls -l . src # For debugging.
  35. cd ..
  36. # Check that we have really compiled the objects with two different
  37. # configurations.
  38. for exeext in '' .exe :; do
  39. test -f optim/src/hello$exeext && break
  40. test "$exeext" = : && fatal_ "cannot determine extension of executables"
  41. done
  42. cmp optim/src/hello$exeext debug/src/hello$exeext && exit 1
  43. :