You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.0 KiB

  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])