From 295806f9c081ea7ed8c325012860fac7547888cc Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 7 Oct 2009 13:46:06 +0200 Subject: [PATCH] configure: Build with -Wstrict-prototypes if supported. --- aclocal.m4 | 3 +- configure | 169 +++++++++++++-------------------------------------- configure.ac | 1 + 3 files changed, 44 insertions(+), 129 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 90e166d3ace..f7beb5db322 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -75,7 +75,8 @@ AC_DEFUN([WINE_TRY_CFLAGS], AC_CACHE_CHECK([whether the compiler supports $1], ac_var, [ac_wine_try_cflags_saved=$CFLAGS CFLAGS="$CFLAGS $1" -AC_LINK_IFELSE(AC_LANG_PROGRAM(), [AS_VAR_SET(ac_var,yes)], [AS_VAR_SET(ac_var,no)]) +AC_LINK_IFELSE(AC_LANG_SOURCE([int main(int argc, char *argv[]) { return 0; }]), + [AS_VAR_SET(ac_var,yes)], [AS_VAR_SET(ac_var,no)]) CFLAGS=$ac_wine_try_cflags_saved]) AS_IF([test AS_VAR_GET(ac_var) = yes], [m4_default([$2], [EXTRACFLAGS="$EXTRACFLAGS $1"])], [$3])dnl diff --git a/configure b/configure index 5a7516d1f23..599d2f3bc2e 100755 --- a/configure +++ b/configure @@ -6608,14 +6608,7 @@ else CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,confest.so.1" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1=yes @@ -6640,14 +6633,7 @@ else CFLAGS="$CFLAGS -fPIC -shared -Wl,-h,confest.so.1" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1=yes @@ -6674,14 +6660,7 @@ else CFLAGS="$CFLAGS -fPIC -shared -Wl,-Bsymbolic,-z,defs" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__fPIC__shared__Wl__Bsymbolic__z_defs=yes @@ -6707,14 +6686,7 @@ else CFLAGS="$CFLAGS -fPIC -shared -Wl,-Bsymbolic,-init,__wine_spec_init,-fini,__wine_spec_fini" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__fPIC__shared__Wl__Bsymbolic__init___wine_spec_init__fini___wine_spec_fini=yes @@ -6741,14 +6713,7 @@ else CFLAGS="$CFLAGS -fPIC -shared -Wl,--version-script=conftest.map" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map=yes @@ -6775,14 +6740,7 @@ else CFLAGS="$CFLAGS -fPIC -Wl,--export-dynamic" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__fPIC__Wl___export_dynamic=yes @@ -6810,14 +6768,7 @@ else CFLAGS="$CFLAGS -fPIC -Wl,--rpath,\$ORIGIN/../lib" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_var=yes" @@ -6845,14 +6796,7 @@ else CFLAGS="$CFLAGS -fPIC -Wl,-R,\$ORIGIN/../lib" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_var=yes" @@ -6881,14 +6825,7 @@ else CFLAGS="$CFLAGS -Wl,--enable-new-dtags" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__Wl___enable_new_dtags=yes @@ -6916,14 +6853,7 @@ else CFLAGS="$CFLAGS -Wl,--section-start,.interp=0x7bf00400" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__Wl___section_start__interp_0x7bf00400=yes @@ -11568,14 +11498,7 @@ else CFLAGS="$CFLAGS -fno-builtin" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__fno_builtin=yes @@ -11601,14 +11524,7 @@ else CFLAGS="$CFLAGS -fno-strict-aliasing" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__fno_strict_aliasing=yes @@ -11633,14 +11549,7 @@ else CFLAGS="$CFLAGS -Wdeclaration-after-statement" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__Wdeclaration_after_statement=yes @@ -11655,6 +11564,31 @@ fi $as_echo "$ac_cv_cflags__Wdeclaration_after_statement" >&6; } if test $ac_cv_cflags__Wdeclaration_after_statement = yes; then : EXTRACFLAGS="$EXTRACFLAGS -Wdeclaration-after-statement" +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wstrict-prototypes" >&5 +$as_echo_n "checking whether the compiler supports -Wstrict-prototypes... " >&6; } +if test "${ac_cv_cflags__Wstrict_prototypes+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_wine_try_cflags_saved=$CFLAGS +CFLAGS="$CFLAGS -Wstrict-prototypes" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(int argc, char *argv) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_cflags__Wstrict_prototypes=yes +else + ac_cv_cflags__Wstrict_prototypes=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +CFLAGS=$ac_wine_try_cflags_saved +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wstrict_prototypes" >&5 +$as_echo "$ac_cv_cflags__Wstrict_prototypes" >&6; } +if test $ac_cv_cflags__Wstrict_prototypes = yes; then : + EXTRACFLAGS="$EXTRACFLAGS -Wstrict-prototypes" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wwrite-strings" >&5 $as_echo_n "checking whether the compiler supports -Wwrite-strings... " >&6; } @@ -11665,14 +11599,7 @@ else CFLAGS="$CFLAGS -Wwrite-strings" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__Wwrite_strings=yes @@ -11697,14 +11624,7 @@ else CFLAGS="$CFLAGS -Wtype-limits" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__Wtype_limits=yes @@ -11765,14 +11685,7 @@ else CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +int main(int argc, char *argv) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_cflags__Werror=yes diff --git a/configure.ac b/configure.ac index 0cc339b2bb9..813b198a743 100644 --- a/configure.ac +++ b/configure.ac @@ -1485,6 +1485,7 @@ then WINE_TRY_CFLAGS([-fno-builtin],[AC_SUBST(BUILTINFLAG,"-fno-builtin")]) WINE_TRY_CFLAGS([-fno-strict-aliasing]) WINE_TRY_CFLAGS([-Wdeclaration-after-statement]) + WINE_TRY_CFLAGS([-Wstrict-prototypes]) WINE_TRY_CFLAGS([-Wwrite-strings]) WINE_TRY_CFLAGS([-Wtype-limits])