Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
There is a new process in can
[simgrid.git] / acmacro / print_null.m4
1 dnl AC_CHECK_PRINTF_NULL: Check whether printf("%s",NULL) works or segfault
2
3 dnl it uses AC_RUN and assume the worse while cross-compiling
4
5 dnl Then, you can:
6 dnl #ifndef PRINTF_NULL_WORKING
7 dnl #  define PRINTF_STR(a) (a)?:"(null)" 
8 dnl #else
9 dnl #  define PRINTF_STR(a) (a)
10 dnl #endif
11
12 AC_DEFUN([AC_CHECK_PRINTF_NULL],
13  [
14 AC_MSG_CHECKING([whether printf("%s",NULL) works...])
15 AC_RUN_IFELSE(AC_LANG_PROGRAM([#include <stdio.h>],
16                               [printf("%s",NULL);]),
17               AC_DEFINE(PRINTF_NULL_WORKING,
18                         1,
19                         [Indicates whether printf("%s",NULL) works])
20               AC_MSG_RESULT(yes),
21               AC_MSG_RESULT(no),
22               AC_MSG_RESULT(assuming the worse in cross-compilation))
23 ])