Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
typo
[simgrid.git] / acmacro / print_null.m4
1 dnl AC_CHECK_PRINTF_NULL: Check whether printf("%s",NULL) works or segfault
2 dnl it uses AC_RUN and assume the worse while cross-compiling
3
4 dnl Then, you can:
5 dnl #ifndef PRINTF_NULL_WORKING
6 dnl #  define PRINTF_STR(a) (a)?:"(null)" 
7 dnl #else
8 dnl #  define PRINTF_STR(a) (a)
9 dnl #endif
10
11 dnl Copyright (C) 2005. Martin Quinson. All rights reserved.
12
13 dnl This file is part of the SimGrid project. This is free software: You can
14 dnl redistribute and/or modify it under the terms of GNU LGPL (v2.1) licence.
15
16
17
18
19 AC_DEFUN([AC_CHECK_PRINTF_NULL],
20  [
21 AC_MSG_CHECKING([whether printf("%s",NULL) works...])
22 AC_RUN_IFELSE(AC_LANG_PROGRAM([#include <stdio.h>],
23                               [printf("%s",NULL);]),
24               AC_DEFINE(PRINTF_NULL_WORKING,
25                         1,
26                         [Indicates whether printf("%s",NULL) works])
27               AC_MSG_RESULT(yes),
28               AC_MSG_RESULT(no),
29               AC_MSG_RESULT(assuming the worse in cross-compilation))
30 ])