This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add --with-nonshared-cflags option to configure
- From: Carlos O'Donell <carlos at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>, libc-alpha at sourceware dot org
- Date: Thu, 16 Aug 2018 13:19:55 -0400
- Subject: Re: [PATCH] Add --with-nonshared-cflags option to configure
- References: <20180704093557.3723F43994575@oldenburg.str.redhat.com>
On 07/04/2018 05:35 AM, Florian Weimer wrote:
> 2018-07-04 Florian Weimer <fweimer@redhat.com>
>
> * configure.ac: Add --with-nonshared-cflags option.
> * config.make.in (extra-nonshared-cflags): Set variable.
> * Makeconfig (CFLAGS-.oS): Use it.
> * manual/install.texi (Configuring and compiling): Document
> --with-nonshared-cflags.
> * configure: Regenerate.
> * INSTALL: Likewise.
>
OK for master if you add an example to --with-nonshared-cflags install.texi
text showing what it might be used for.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> diff --git a/Makeconfig b/Makeconfig
> index 608ffe648c..b0b27f0113 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -1038,7 +1038,7 @@ object-suffixes-for-libc += .oS
> # Must build the routines as PIC, though, because they can end up in (users')
> # shared objects. We don't want to use CFLAGS-os because users may, for
> # example, make that processor-specific.
> -CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag)
> +CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) $(extra-nonshared-cflags)
OK.
> CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
> libtype.oS = lib%_nonshared.a
> endif
> diff --git a/config.make.in b/config.make.in
> index d9891b2cd8..a6fe48d31f 100644
> --- a/config.make.in
> +++ b/config.make.in
> @@ -110,6 +110,7 @@ BUILD_CC = @BUILD_CC@
> CFLAGS = @CFLAGS@
> CPPFLAGS-config = @CPPFLAGS@
> CPPUNDEFS = @CPPUNDEFS@
> +extra-nonshared-cflags = @extra_nonshared_cflags@
OK.
> ASFLAGS-config = @ASFLAGS_config@
> AR = @AR@
> NM = @NM@
> diff --git a/configure.ac b/configure.ac
> index dc517017f5..154185d70d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -154,6 +154,14 @@ AC_ARG_WITH([default-link],
> [use_default_link=$withval],
> [use_default_link=default])
>
> +dnl Additional build flags injection.
> +AC_ARG_WITH([nonshared-cflags],
> + AC_HELP_STRING([--with-nonshared-cflags=FLAGS],
> + [build nonshared libraries with additional FLAGS]),
s/FLAGS/CFLAGS/g
> + [extra_nonshared_cflags=$withval],
> + [extra_nonshared_cflags=])
> +AC_SUBST(extra_nonshared_cflags)
OK.
> +
> AC_ARG_ENABLE([sanity-checks],
> AC_HELP_STRING([--disable-sanity-checks],
> [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
> diff --git a/manual/install.texi b/manual/install.texi
> index 422da1447e..eaf0cd09e7 100644
> --- a/manual/install.texi
> +++ b/manual/install.texi
> @@ -117,6 +117,15 @@ problem and suppress these constructs, so that the library will still be
> usable, but functionality may be lost---for example, you can't build a
> shared libc with old binutils.
>
> +@item --with-nonshared-cflags=@var{cflags}
> +Use additional compiler flags @var{cflags} to build the parts of the
> +library which are always statically linked into applications and
> +libraries even with shared linking (that is, the object files contained
> +in @file{lib*_nonshared.a} libraries). The build process will
> +automatically use the appropriate flags, but this option can be used to
> +set additional flags required for building applications and libraries,
> +to match local policy.
> +
I'd like to see an example added to this to show what the flag is used for.
Suggest:
... to match local policy e.g. <Reason why with flag>
> @c disable static doesn't work currently
> @c @item --disable-static
> @c Don't build static libraries. Static libraries aren't that useful these
>
--
Cheers,
Carlos.
P.S. Is there any way I can convince you to fix bug 17248 given that you're
looking at CFLAGS? :-)