Bug 1510073 - Document that config.site is intended for (and only for) /usr prefix, provide doc example for /usr/local/share/config.site
Summary: Document that config.site is intended for (and only for) /usr prefix, provide...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: autoconf
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Patrik Novotný
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-06 16:28 UTC by Jeffrey Walton
Modified: 2020-09-12 07:59 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-09-12 07:59:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jeffrey Walton 2017-11-06 16:28:58 UTC
My config.site is as follows, which I believe is a standard config.site. The one in /usr/local/share was copied from the one in /usr/share. Hard coding `libdir='${exec_prefix}/lib64'` does not change the outcome.

$ cat /usr/local/share/config.site
...

if test -n "$host"; then
    # skip when cross-compiling
    return 0
fi

if test "$prefix" = /usr \
   || { test "$prefix" = NONE && test "$ac_default_prefix" = /usr ; }
then
    test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
    test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
    test "$localstatedir" = '${prefix}/var' && localstatedir=/var

    ARCH=`uname -m`
    for i in x86_64 ppc64 s390x aarch64; do
        if test $ARCH = $i; then
            test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'
            break
        fi
    done
fi



I also have a*.pc.in file:

$ cat libcryptopp.pc.in
...

prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
...



Configuring my library with Autotools:

$ autoreconf --install --force
...
$ ./configure
...



The result is the *.pc file is using the wrong library directory. It is using /usr/local/lib/ rather than /usr/local/lib64/:

$ cat libcryptopp.pc
...

prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
...



This issue is kind of plaguing Fedora. It requires all kind of workarounds for a number of different packages. Sometimes the workaround is as simple as `--libdir=/usr/local/lib64`, other times sources must be patched after unpacking and configuring. Here's an example of patching after unpacking: http://pkgs.fedoraproject.org/cgit/rpms/gnutls.git/tree/gnutls.spec.

**********

I don't have a minimum project setup to demonstrate the issue. However, it is easy to duplicate using Crypto++ or other favorite Autotools-based projects you have:

git clone https://github.com/weidai11/cryptopp.git
cd cryptopp
git submodule add https://github.com/noloader/cryptopp-autotools.git autotools
git submodule update --remote

cp "$PWD/autotools/Makefile.am" "$PWD"
cp "$PWD/autotools/configure.ac" "$PWD"
cp "$PWD/autotools/libcryptopp.pc.in" "$PWD"
mkdir -p "$PWD/m4/"

autoreconf --force --install --warnings=all
./configure

Comment 1 Pavel Raiskup 2017-11-06 16:51:35 UTC
Hi Jeffrey,

(In reply to Jeffrey Walton from comment #0)
> $ cat /usr/local/share/config.site
> ...
> if test "$prefix" = /usr \

This would be the issue, I guess.  Your config.site is sourced if and only if
the '$prefix = /usr/local', so the if-condition never succeeds.

Comment 2 Jeffrey Walton 2017-11-06 17:01:38 UTC
(In reply to Pavel Raiskup from comment #1)
> Hi Jeffrey,
> 
> (In reply to Jeffrey Walton from comment #0)
> > $ cat /usr/local/share/config.site
> > ...
> > if test "$prefix" = /usr \
> 
> This would be the issue, I guess.  Your config.site is sourced if and only if
> the '$prefix = /usr/local', so the if-condition never succeeds.

Thanks Pavel. That leads me to another question. Sorry about asking questions here.

What does a well formed config.site look like? About all I know at this point is it is not the one at /usr/share/config.site; otherwise it would properly handle Fedora installation directories.

Comment 3 Pavel Raiskup 2017-11-06 17:12:27 UTC
> What does a well formed config.site look like?

Since that's your own config.site, you don't have to pay too much attention
to "proper format".  Whatever works for you -- it can simply look like:

$ cat /usr/local/share/config.site
ARCH=`uname -m`
for i in x86_64 ppc64 s390x aarch64; do
  if test $ARCH = $i; then
    test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'
    break
  fi
done

I did not test it, though.  See docs '15.8 Setting Site Defaults', there
are some examples.

For documentation purposes, we could think about adding some docs file
directly into autoconf.rpm if you had a "correct" suggestion :-).  That
would sound like useful addition, we could name it e.g.
/usr/share/doc/autoconf/config.site.usr_local

Comment 4 Jeffrey Walton 2017-11-06 17:22:50 UTC
(In reply to Pavel Raiskup from comment #3)
> > What does a well formed config.site look like?
> 
> Since that's your own config.site, you don't have to pay too much attention
> to "proper format".  Whatever works for you -- it can simply look like:

OK, thanks. Just to be clear (and I hope I don't sound too argumentative), I added one at /usr/local/share/config.site because the one supplied by Fedora at /usr/share/config.site does not work as expected.

> For documentation purposes, we could think about adding some docs file
> directly into autoconf.rpm if you had a "correct" suggestion :-).  That
> would sound like useful addition, we could name it e.g.
> /usr/share/doc/autoconf/config.site.usr_local

Well, I think documentation is a good step. I think another good step would be to fix /usr/share/config.site so folks don't have to RTFM in the first place. There's a lot to be said about "it just works".

Comment 5 Pavel Raiskup 2017-11-07 08:09:44 UTC
(In reply to Jeffrey Walton from comment #4)
> OK, thanks. Just to be clear (and I hope I don't sound too argumentative), I
> added one at /usr/local/share/config.site because the one supplied by Fedora
> at /usr/share/config.site does not work as expected.

I'm glad for this discussion, thanks for it.

The /usr/share/config.site is not intended to be ever sourced for
/usr/local/ prefix;  so it works fine for it's only purpose (/usr prefix).
Indeed, providing your own /usr/local/share/config.site is expected workflow,
since Fedora can not install anything under /usr/local/share directory.

> Well, I think documentation is a good step. I think another good step would
> be to fix /usr/share/config.site so folks don't have to RTFM in the first
> place. There's a lot to be said about "it just works".

Ok, let me reopen then and work better on the documentation.  At least we
should clearly say what the config.site file is for.  Thanks!

Comment 6 Fedora End Of Life 2018-05-03 09:10:43 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 7 Jeffrey Walton 2020-09-12 07:59:49 UTC
I think this is handled or old. Let's just close it.


Note You need to log in before you can comment on or make changes to this bug.