選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

lol-misc.m4 2.0 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. dnl
  2. dnl Lol Engine
  3. dnl
  4. dnl Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net>
  5. dnl
  6. dnl Lol Engine is free software. It comes without any warranty, to
  7. dnl the extent permitted by applicable law. You can redistribute it
  8. dnl and/or modify it under the terms of the Do What the Fuck You Want
  9. dnl to Public License, Version 2, as published by the WTFPL Task Force.
  10. dnl See http://www.wtfpl.net/ for more details.
  11. dnl
  12. dnl LOL_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
  13. dnl check if $CC supports a given set of cflags
  14. AC_DEFUN([LOL_TRY_CFLAGS],
  15. [AC_MSG_CHECKING([if $CC supports $1 flags])
  16. save_CFLAGS="$CFLAGS"
  17. CFLAGS="$1 -Werror"
  18. AC_TRY_COMPILE([],[],[ac_cv_try_cflags_ok=yes],[ac_cv_try_cflags_ok=no])
  19. CFLAGS="$save_CFLAGS"
  20. AC_MSG_RESULT([$ac_cv_try_cflags_ok])
  21. if test x"$ac_cv_try_cflags_ok" = x"yes"; then
  22. ifelse([$2],[],[:],[$2])
  23. else
  24. ifelse([$3],[],[:],[$3])
  25. fi])
  26. dnl LOL_TRY_CXXFLAGS (CXXFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
  27. dnl check if $CXX supports a given set of cxxflags
  28. AC_DEFUN([LOL_TRY_CXXFLAGS],
  29. [AC_MSG_CHECKING([if $CXX supports $1 flags])
  30. AC_LANG_PUSH(C++)
  31. save_CXXFLAGS="$CXXFLAGS"
  32. CXXFLAGS="$1 -Werror"
  33. AC_TRY_COMPILE([],[],[ac_cv_try_cxxflags_ok=yes],[ac_cv_try_cxxflags_ok=no])
  34. CXXFLAGS="$save_CXXFLAGS"
  35. AC_MSG_RESULT([$ac_cv_try_cxxflags_ok])
  36. if test x"$ac_cv_try_cxxflags_ok" = x"yes"; then
  37. ifelse([$2],[],[:],[$2])
  38. else
  39. ifelse([$3],[],[:],[$3])
  40. fi
  41. AC_LANG_POP(C++)])
  42. dnl LOL_TRY_LDFLAGS (LDFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
  43. dnl check if $CC supports a given set of ldflags
  44. AC_DEFUN([LOL_TRY_LDFLAGS],
  45. [AC_MSG_CHECKING([if $CC supports $1 flags])
  46. save_LDFLAGS="$LDFLAGS"
  47. LDFLAGS="$1 -Werror"
  48. AC_TRY_LINK([],[],[ac_cv_try_ldflags_ok=yes],[ac_cv_try_ldflags_ok=no])
  49. LDFLAGS="$save_LDFLAGS"
  50. AC_MSG_RESULT([$ac_cv_try_ldflags_ok])
  51. if test x"$ac_cv_try_ldflags_ok" = x"yes"; then
  52. ifelse([$2],[],[:],[$2])
  53. else
  54. ifelse([$3],[],[:],[$3])
  55. fi])