Patchwork Check for ffs declaration in gcc/configure.ac

login
register
mail settings
Submitter Joseph S. Myers
Date Aug. 20, 2012, 11:28 a.m.
Message ID <Pine.LNX.4.64.1208201127080.4976@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/178749/
State New
Headers show

Comments

Joseph S. Myers - Aug. 20, 2012, 11:28 a.m.
Building a cross compiler from i686-mingw32 to arm-none-eabi fails
after the move to build as C++ because config/arm/neon.md uses ffs but
no MinGW header declares ffs (and unlike in C, an implicit declaration
of this built-in function can't be used).  This patch fixes this issue
by making the gcc directory configure check for a declaration, so
causing libiberty.h to provide one if needed.

Tested building a cross compiler as described above (fails before the
patch, passes afterwards).  OK to commit?

2012-08-20  Joseph Myers  <joseph@codesourcery.com>

	* configure.ac (ffs): Check for declaration.
	* configure, config.in: Regenerate.
Richard Guenther - Aug. 20, 2012, 11:32 a.m.
On Mon, Aug 20, 2012 at 1:28 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> Building a cross compiler from i686-mingw32 to arm-none-eabi fails
> after the move to build as C++ because config/arm/neon.md uses ffs but
> no MinGW header declares ffs (and unlike in C, an implicit declaration
> of this built-in function can't be used).  This patch fixes this issue
> by making the gcc directory configure check for a declaration, so
> causing libiberty.h to provide one if needed.
>
> Tested building a cross compiler as described above (fails before the
> patch, passes afterwards).  OK to commit?

Ok.

Thanks,
Richard.

> 2012-08-20  Joseph Myers  <joseph@codesourcery.com>
>
>         * configure.ac (ffs): Check for declaration.
>         * configure, config.in: Regenerate.
>
> Index: configure
> ===================================================================
> --- configure   (revision 190529)
> +++ configure   (working copy)
> @@ -10288,7 +10288,7 @@
>  for ac_func in getenv atol asprintf sbrk abort atof getcwd getwd \
>         strsignal strstr stpcpy strverscmp \
>         errno snprintf vsnprintf vasprintf malloc realloc calloc \
> -       free basename getopt clock getpagesize clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked
> +       free basename getopt clock getpagesize ffs clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked
>  do
>    ac_tr_decl=`$as_echo "HAVE_DECL_$ac_func" | $as_tr_cpp`
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func is declared" >&5
> Index: config.in
> ===================================================================
> --- config.in   (revision 190529)
> +++ config.in   (working copy)
> @@ -621,6 +621,12 @@
>  #endif
>
>
> +/* Define to 1 if we found a declaration for 'ffs', otherwise define to 0. */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_DECL_FFS
> +#endif
> +
> +
>  /* Define to 1 if we found a declaration for 'fgetc_unlocked', otherwise
>     define to 0. */
>  #ifndef USED_FOR_TARGET
> Index: configure.ac
> ===================================================================
> --- configure.ac        (revision 190529)
> +++ configure.ac        (working copy)
> @@ -1075,7 +1075,7 @@
>  gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
>         strsignal strstr stpcpy strverscmp \
>         errno snprintf vsnprintf vasprintf malloc realloc calloc \
> -       free basename getopt clock getpagesize gcc_UNLOCKED_FUNCS, , ,[
> +       free basename getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[
>  #include "ansidecl.h"
>  #include "system.h"])
>
>
> --
> Joseph S. Myers
> joseph@codesourcery.com

Patch

Index: configure
===================================================================
--- configure	(revision 190529)
+++ configure	(working copy)
@@ -10288,7 +10288,7 @@ 
 for ac_func in getenv atol asprintf sbrk abort atof getcwd getwd \
 	strsignal strstr stpcpy strverscmp \
 	errno snprintf vsnprintf vasprintf malloc realloc calloc \
-	free basename getopt clock getpagesize clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked
+	free basename getopt clock getpagesize ffs clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked
 do
   ac_tr_decl=`$as_echo "HAVE_DECL_$ac_func" | $as_tr_cpp`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func is declared" >&5
Index: config.in
===================================================================
--- config.in	(revision 190529)
+++ config.in	(working copy)
@@ -621,6 +621,12 @@ 
 #endif
 
 
+/* Define to 1 if we found a declaration for 'ffs', otherwise define to 0. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_DECL_FFS
+#endif
+
+
 /* Define to 1 if we found a declaration for 'fgetc_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
Index: configure.ac
===================================================================
--- configure.ac	(revision 190529)
+++ configure.ac	(working copy)
@@ -1075,7 +1075,7 @@ 
 gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
 	strsignal strstr stpcpy strverscmp \
 	errno snprintf vsnprintf vasprintf malloc realloc calloc \
-	free basename getopt clock getpagesize gcc_UNLOCKED_FUNCS, , ,[
+	free basename getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[
 #include "ansidecl.h"
 #include "system.h"])