libtool-link.m4 923 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. dnl file : m4/libtool-link.m4
  2. dnl copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
  3. dnl license : MIT; see accompanying LICENSE file
  4. dnl
  5. dnl
  6. dnl CXX_LIBTOOL_LINK_IFELSE (input, [action-if-true], [action-if-false])
  7. dnl
  8. dnl Similar to AC_LINK_IFELSE except it uses libtool to perform the
  9. dnl linking and it does this using the C++ compiler.
  10. dnl
  11. AC_DEFUN([CXX_LIBTOOL_LINK_IFELSE],[
  12. AC_LANG_SAVE
  13. AC_LANG(C++)
  14. if test -d .libs; then
  15. delete_libs_dir=no
  16. else
  17. delete_libs_dir=yes
  18. fi
  19. AC_COMPILE_IFELSE([$1],
  20. [
  21. ac_try='./libtool --tag=CXX --mode=link $CXX -no-install $CXXFLAGS $LDFLAGS -o conftest conftest.$OBJEXT $LIBS >&AS_MESSAGE_LOG_FD'
  22. if _AC_DO_VAR(ac_try); then
  23. libtool_link_ok=yes
  24. else
  25. libtool_link_ok=no
  26. fi
  27. ],
  28. [
  29. libtool_link_ok=no
  30. ])
  31. if test x"$delete_libs_dir" = xyes; then
  32. rm -rf .libs
  33. fi
  34. if test x"$libtool_link_ok" = xyes; then
  35. [$2]
  36. :
  37. else
  38. [$3]
  39. :
  40. fi
  41. AC_LANG_RESTORE])dnl