This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix binutils/gold build on NetBSD


Hello Arnaud,

* Arnaud Lacombe wrote on Sat, Dec 04, 2010 at 05:47:04AM CET:
> --- a/gold/configure.ac
> +++ b/gold/configure.ac
> @@ -395,6 +395,17 @@ AC_SUBST(LFS_CFLAGS)
>  AC_CHECK_FUNCS(chsize)
>  AC_REPLACE_FUNCS(pread ftruncate mremap ffsll)
>  
> +AC_COMPILE_IFELSE([
> +AC_LANG_PROGRAM([[
> +#include <sys/mman.h>
> +#ifndef MREMAP_MAYMOVE
> +#error "MREMAP_MAYMOVE not defined."

It's actually more portable to write
  choke me

or
  MREMAP_MAYMOVE not defined.

as some compilers only warn over #error, see 'info Autoconf "C
Compiler"'.

> +#endif
> +]])],

If you wrap the whole testing part above in AC_CACHE_CHECK
with a suitable cache variable, and do the actions below:

> +[AC_DEFINE(HAVE_MREMAP_MAYMOVE, 1,
> +[Define to 1 if mremap(2) support the MREMAP_MAYMOVE flag.])],
> +[AC_LIBOBJ(mremap)])

only if that variable has the desired result, then both reruns of
configure are faster, and users can override the result of your test on
systems where it might fail (due to, e.g., portability issues like
above).

Cheers,
Ralf



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]