[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AC_GNU_SOURCE and cross compiling
From: |
Tobias C. Rittweiler |
Subject: |
AC_GNU_SOURCE and cross compiling |
Date: |
Fri, 18 Apr 2003 00:01:01 +0200 |
Hello asdfas,
the following is a small conversation between me and Paolo Bonzini
about a bug in the configuration system of sed. It might be autoconf
related, so I'll list here the important parts.
=== April 17, 9:03:19 PM, Me to Paolo:
> Excerpt of a response (by me) to a compilation problem in the ROCK Linux
> mailing list:
>
> Sed makes use of getline(3) which is a GNU extension, and to to stay
> portable it has its own version. To test whether to use its own
> imlementation, there's an m4 macro, AM_FUNC_GETLINE, defined
> (config/getline.m4) -- within that definition there's an
> AC_TRY_RUN([...], ..getline=yes.., ..getline=no..,
> ..getline=no..).
> Or IOW it _always_ uses its own version when cross-compiling.
>
> The actual problem is elsewhere, namely that in configure.ac
> AC_GNU_SOURCE is used which _seems_ to set _GNU_SOURCE _always_!
> This means, that all GNU extensions, and so glibc's getline(), are
> used, and hence the error message of a "previous declaration
> declaration of `getline'", because the above macro automatically
> assumes to use sed's own getline().
>
> --snip-
> --- configure.ac.orig 2003-04-16 10:18:42.000000000 +0200
> +++ configure.ac 2003-04-16 10:17:54.000000000 +0200
> @@ -13,7 +13,9 @@
>
> AC_PROG_CC
> AC_PROG_RANLIB
> -AC_GNU_SOURCE
> +if test "x$cross_compiling" = xno; then
> + AC_GNU_SOURCE
> +fi
> AC_AIX
> AC_MINIX
> AC_ISC_POSIX
> --snap--
>
> This should fix the problem [...]
=== April 17, 11:01:46 PM, Paolo to me:
> An interesting problem. You should report it to the Autoconf mailing list to
> get a
> satisfying solution.
=== April 17, 11:32:09 PM, Me to Paolo:
> Well, I thought of that myself, but I'd except an answer like: 'This
> isn't a bug, the programm foobar must work around it'.
>
> Hmm, documentation says:
> Macro: AC_GNU_SOURCE
> If using the GNU C library, define _GNU_SOURCE. Allows the use of
> some GNU functions. Should be called before any macros that run the
> C compiler.
>
> The problem that it let's the question open whether 'using the GNU C
> library' depends on the host or on the target machine. It apparantly
> does on the host.
Hope it's conceivable. I won't be able to respond for the next week,
since I'll drive in holiday tomorrow, just FYI.
--
cheers,
Tobias <address@hidden>
http://freebits.org - ``Free Life, free Opinion, free Software.''
http://rocklinux.org - ``I'm a hacker, and I'm using ROCK Linux.''
May you live your life as if the maxim of your actions were to become universal
law.
-- Immanuel Kant
- AC_GNU_SOURCE and cross compiling,
Tobias C. Rittweiler <=