add_cflags.m4 405 B

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