1# Determine whether printf supports %p for printing pointers. 2 3# Copyright (c) 2003 Free Software Foundation, Inc. 4 5# This program is free software; you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation; either version 2, or (at your option) 8# any later version. 9 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14 15# You should have received a copy of the GNU General Public License 16# along with this program; if not, write to the Free Software 17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18# 02111-1307, USA. 19 20# CVS_FUNC_PRINTF_PTR 21# ------------------- 22# Determine whether printf supports %p for printing pointers. 23AC_DEFUN([CVS_FUNC_PRINTF_PTR], 24[AC_CACHE_CHECK(whether printf supports %p, 25 cvs_cv_func_printf_ptr, 26[AC_TRY_RUN([#include <stdio.h> 27/* If printf supports %p, exit 0. */ 28int 29main () 30{ 31 void *p1, *p2; 32 char buf[256]; 33 p1 = &p1; p2 = &p2; 34 sprintf(buf, "%p", p1); 35 exit(sscanf(buf, "%p", &p2) != 1 || p2 != p1); 36}], cvs_cv_func_printf_ptr=yes, cvs_cv_func_printf_ptr=no) 37rm -f core core.* *.core]) 38if test $cvs_cv_func_printf_ptr = yes; then 39 AC_DEFINE(HAVE_PRINTF_PTR, 1, 40 [Define to 1 if the `printf' function supports the %p format 41 for printing pointers.]) 42fi 43])# CVS_FUNC_PRINTF_PTR 44