broken ac_fn_c_check_type function in configure script
this check has 2 issues: a) it does the check twice if the first test succeeds, wasting precious time b) it uses sizeof(( $2 )) in the second ac_fn_c_try_compile invocation which is invalid C root:/src$ cat test.c typedef unsigned long size_t; int main () { if (sizeof ((size_t))) return 0; return 0; } root:/src$ gcc test.c test.c: In function 'main': test.c:3:22: error: expected expression before ')' token here's the extracted function from version 1.4.6 configure script # --- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-$1} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo $as_me:${as_lineno-$LINENO}: checking for $2 5 $as_echo_n checking for $2... 6; } if eval \${$3+:} false; then : $as_echo_n (cached) 6 else eval $3=no cat confdefs.h - _ACEOF conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile $LINENO; then : cat confdefs.h - _ACEOF conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile $LINENO; then : else eval $3=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo $as_me:${as_lineno-$LINENO}: result: $ac_res 5 $as_echo $ac_res 6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type --JS
Re: broken ac_fn_c_check_type function in configure script
On Wed, 2012-04-25 at 21:38 +0200, John Spencer wrote: a) it does the check twice if the first test succeeds, wasting precious time b) it uses sizeof(( $2 )) in the second ac_fn_c_try_compile invocation which is invalid C From what I can tell, both of these things are the consequence of the code generated by autoconf, not APR code. -- Bojan