From 3878a2a9fb11f13fe84000ec6bcddad2ada11ea1 Mon Sep 17 00:00:00 2001
From: "Kevin P. Fleming" <kpfleming@digium.com>
Date: Sat, 29 Apr 2006 15:31:45 +0000
Subject: [PATCH] and now with the correct filenames add basic support for
 checking for C compiler attribute support

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23380 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 acinclude.m4   | 19 +++++++++++++++++--
 configure.ac   |  3 +++
 utils/Makefile |  2 +-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index ebd8b997f3..9722710692 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -68,7 +68,7 @@ AC_SUBST([PBX_LIB$1])
 
 
 AC_DEFUN(
-[AST_CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make, GNU_MAKE,
+[AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE,
    GNU_MAKE='Not Found' ;
    for a in make gmake gnumake ; do
       if test -z "$a" ; then continue ; fi ;
@@ -83,4 +83,19 @@ if test  "x$GNU_MAKE" = "xNot Found"  ; then
    exit 1
 fi
 AC_SUBST([GNU_MAKE])
-] )
+])
+
+AC_DEFUN(
+[AST_C_ATTRIBUTE],
+[AC_CACHE_CHECK([for $1 attribute support],
+                [ac_cv_attribute_$1],
+                AC_COMPILE_IFELSE(
+                   AC_LANG_PROGRAM(
+                       [[static void foo(void) __attribute__ (($1));xyz]],
+                       []),
+                   have_attribute_$1=1, have_attribute_$1=0)
+               )
+ if test "$have_attribute_$1" = "1"; then
+    AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to indicate the compiler supports __attribute__ (($1))])
+ fi
+])
diff --git a/configure.ac b/configure.ac
index 5bb8678030..6252b23462 100644
--- a/configure.ac
+++ b/configure.ac
@@ -614,6 +614,9 @@ AC_HEADER_TIME
 AC_STRUCT_TM
 AC_C_VOLATILE
 AC_CHECK_TYPES([ptrdiff_t])
+AST_C_ATTRIBUTE([malloc])
+AST_C_ATTRIBUTE([printf])
+AST_C_ATTRIBUTE([mallocx])
 
 # Checks for library functions.
 AC_FUNC_CHOWN
diff --git a/utils/Makefile b/utils/Makefile
index 6fce65e61c..4d59906954 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -57,7 +57,7 @@ astman: astman.o ../md5.o
 stereorize: stereorize.o frame.o
 	$(CC) $(CFLAGS) -o stereorize stereorize.o frame.o -lm
 
-.PHONY: ../ast_expr2.o ../ast_expr2f.o ../pbx/ael/aelflex.o ../pbx/ael/aelbison.o ../pbx/pbx_ael.o
+.PHONY: ../ast_expr2.c ../ast_expr2f.c ../pbx/ael/aelflex.o ../pbx/ael/aelbison.o ../pbx/pbx_ael.o
 
 ast_expr2.o: ../ast_expr2.c
 	gcc  $(CFLAGS) -include ../include/autoconfig.h -c -o $@ $<
-- 
GitLab