add_cflags.m4 446 B

123456789101112131415161718
  1. dnl @synopsis MN_ADD_CFLAGS
  2. dnl
  3. dnl Add the given option to CFLAGS, if it doesn't break the compiler
  4. AC_DEFUN([MN_ADD_CFLAGS],
  5. [AC_MSG_CHECKING([if $CC accepts $1])
  6. ac_add_cflags__old_cflags="$CFLAGS"
  7. CFLAGS="$1"
  8. AC_TRY_LINK([
  9. #include <stdio.h>
  10. ],
  11. [puts("Hello, World!"); return 0;],
  12. AC_MSG_RESULT([yes])
  13. CFLAGS="$ac_add_cflags__old_cflags $1",
  14. AC_MSG_RESULT([no])
  15. CFLAGS="$ac_add_cflags__old_cflags"
  16. )
  17. ])# MN_ADD_CFLAGS