cond31.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. # Copyright (C) 2003-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. # Make sure we define conditional _DEPENDENCIES correctly.
  17. . test-init.sh
  18. cat >>configure.ac <<'EOF'
  19. AC_SUBST([CC], [false])
  20. AC_SUBST([OBJEXT], [o])
  21. AM_CONDITIONAL([C1], [test -z "$two"])
  22. AM_CONDITIONAL([C2], [test -n "$two"])
  23. AC_OUTPUT
  24. EOF
  25. cat > Makefile.am <<'EOF'
  26. bin_PROGRAMS = a
  27. a_LDADD = c0.o -L/some/where
  28. if C1
  29. a_LDADD += c1.o -llibfoo.a
  30. endif
  31. if C2
  32. a_LDADD += c2.o -dlopen c3.la
  33. endif
  34. .PHONY: test1 test2
  35. test1:
  36. is $(a_DEPENDENCIES) == c0.o c1.o
  37. test2:
  38. is $(a_DEPENDENCIES) == c0.o c2.o c3.la
  39. EOF
  40. $ACLOCAL
  41. $AUTOCONF
  42. $AUTOMAKE --ignore-deps
  43. ./configure
  44. $MAKE test1
  45. ./configure two=yes
  46. $MAKE test2
  47. :