1# See if we need to provide obstacks. 2 3dnl Copyright 1996-2020 Free Software Foundation, Inc. 4dnl This file is free software; the Free Software Foundation 5dnl gives unlimited permission to copy and/or distribute it, 6dnl with or without modifications, as long as this notice is preserved. 7 8dnl This replaces Autoconf's AC_FUNC_OBSTACK. 9dnl The Autoconf version should be marked obsolete at some point. 10 11AC_DEFUN([AC_FUNC_OBSTACK], 12 [AC_LIBSOURCES([obstack.h, obstack.c])dnl 13 AC_CACHE_CHECK([for obstacks that work with any size object], 14 [ac_cv_func_obstack], 15 [AC_LINK_IFELSE( 16 [AC_LANG_PROGRAM( 17 [[#include "obstack.h" 18 void *obstack_chunk_alloc (size_t n) { return 0; } 19 void obstack_chunk_free (void *p) { } 20 /* Check that an internal function returns size_t, not int. */ 21 size_t _obstack_memory_used (struct obstack *); 22 ]], 23 [[struct obstack mem; 24 obstack_init (&mem); 25 obstack_free (&mem, 0); 26 ]])], 27 [ac_cv_func_obstack=yes], 28 [ac_cv_func_obstack=no])]) 29 if test "$ac_cv_func_obstack" = yes; then 30 AC_DEFINE([HAVE_OBSTACK], 1, 31 [Define to 1 if the system has obstacks that work with any size object.]) 32 else 33 AC_LIBOBJ([obstack]) 34 fi 35]) 36