zc++ 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #! /bin/sh
  2. # Wrapper around IBM C++ compiler to add "-+" to preprocessor calls
  3. # and thus work with C++ in files other than *.C. Also add -Wc,lang(longlong)
  4. # with appropriate quoting to avoid shell confusion -- this is difficult
  5. # to get through both ./configure arguments _and_ Makefile/shell expansion
  6. # safely so more easily added in this wrapper.
  7. #
  8. # Finally, by default will enable xplink for C++ compatibilty and performance
  9. # (c++ standard library requires xplink enabled).
  10. #
  11. # Additional compile/link flags can be passed in as ZCXXFLAGS, eg:
  12. #
  13. # For debug: ZXCCFLAGS=-g ...
  14. #
  15. # Written by Ewen McNeill <ewen@imatix.com>, 2014-07-18
  16. # Updated by Ewen McNeill <ewen@imatix.com>, 2014-07-21
  17. #---------------------------------------------------------------------------
  18. CPPFLAGS="-+"
  19. LONGLONG="-Wc,lang(longlong)"
  20. XPLINK="${XPLINK:--Wc,xplink -Wl,xplink}"
  21. CXX="/bin/c++"
  22. ZCXXFLAGS="${ZCXXFLAGS:-}" # Extra compile/link arguments, eg "-g"
  23. # For debugging calling conventions issues
  24. #echo "Called with: $0 $@" >>/tmp/zc++.log 2>&1
  25. #exec >>/tmp/zc++.log 2>&1
  26. #set -x
  27. case "$1" in
  28. -E) exec "${CXX}" "${CPPFLAGS}" "$@"
  29. ;;
  30. -o) exec "${CXX}" ${ZCXXFLAGS} "${LONGLONG}" "${CPPFLAGS}" ${XPLINK} "$@"
  31. ;;
  32. -c) exec "${CXX}" ${ZCXXFLAGS} "${LONGLONG}" "${CPPFLAGS}" ${XPLINK} "$@"
  33. ;;
  34. -L) # Special case for linking via C++, called from linkall
  35. exec "${CXX}" ${ZCXXFLAGS} ${XPLINK} "$@"
  36. ;;
  37. *) exec "${CXX}" ${ZCXXFLAGS} "${LONGLONG}" ${XPLINK} "$@"
  38. ;;
  39. esac