| 
									
										
										
										
											2008-10-20 04:59:04 +00:00
										 |  |  | # Helper function to check for gcc attributes. | 
					
						
							| 
									
										
										
										
											2010-07-15 18:44:20 +00:00
										 |  |  | # AST_GCC_ATTRIBUTE([attribute name], [attribute syntax], [attribute scope], [makeopts flag]) | 
					
						
							| 
									
										
										
										
											2008-10-20 04:59:04 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | AC_DEFUN([AST_GCC_ATTRIBUTE], | 
					
						
							|  |  |  | [ | 
					
						
							|  |  |  | AC_MSG_CHECKING(for compiler 'attribute $1' support) | 
					
						
							|  |  |  | saved_CFLAGS="$CFLAGS" | 
					
						
							| 
									
										
										
										
											2009-06-16 01:28:08 +00:00
										 |  |  | CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" | 
					
						
							| 
									
										
										
										
											2010-07-15 18:44:20 +00:00
										 |  |  | m4_ifval([$4],$4=0) | 
					
						
							| 
									
										
										
										
											2008-11-26 21:20:50 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if test "x$2" = "x" | 
					
						
							|  |  |  | then | 
					
						
							| 
									
										
										
										
											2008-10-20 04:59:04 +00:00
										 |  |  | AC_COMPILE_IFELSE( | 
					
						
							| 
									
										
										
										
											2012-01-14 16:40:17 +00:00
										 |  |  | 	[AC_LANG_PROGRAM([$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}], | 
					
						
							|  |  |  | 			[])], | 
					
						
							| 
									
										
										
										
											2008-10-20 04:59:04 +00:00
										 |  |  | 	AC_MSG_RESULT(yes) | 
					
						
							| 
									
										
										
										
											2010-07-15 18:44:20 +00:00
										 |  |  | 	m4_ifval([$4],$4=1) | 
					
						
							| 
									
										
										
										
											2008-10-20 04:59:04 +00:00
										 |  |  | 	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), | 
					
						
							| 
									
										
										
										
											2008-11-26 21:20:50 +00:00
										 |  |  | 	AC_MSG_RESULT(no) | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | AC_COMPILE_IFELSE( | 
					
						
							| 
									
										
										
										
											2012-01-14 16:40:17 +00:00
										 |  |  | 	[AC_LANG_PROGRAM([$3 void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}], | 
					
						
							|  |  |  | 			[])], | 
					
						
							| 
									
										
										
										
											2008-11-26 21:20:50 +00:00
										 |  |  | 	AC_MSG_RESULT(yes) | 
					
						
							| 
									
										
										
										
											2010-07-15 18:44:20 +00:00
										 |  |  | 	m4_ifval([$4],$4=1) | 
					
						
							| 
									
										
										
										
											2008-11-26 21:20:50 +00:00
										 |  |  | 	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), | 
					
						
							|  |  |  | 	AC_MSG_RESULT(no) | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-15 23:25:09 +00:00
										 |  |  | m4_ifval([$4],[AC_SUBST($4)]) | 
					
						
							| 
									
										
										
										
											2008-10-20 04:59:04 +00:00
										 |  |  | CFLAGS="$saved_CFLAGS" | 
					
						
							| 
									
										
										
										
											2008-11-26 21:20:50 +00:00
										 |  |  | ] | 
					
						
							| 
									
										
										
										
											2008-10-20 04:59:04 +00:00
										 |  |  | ) |