#21 Wrong test order for x libs in configure

open-duplicate
nobody
None
5
2009-09-30
2006-08-14
Jens Seidel
No

Hi,

according to
http://sourceware.org/ml/cygwin/2000-12/msg00174.html
and also your FAQ
http://www.lesstif.org/FAQ.html#TOPIC5
the link order of X libs should be:
-lXm -lXt -lXmu -lXp -lXext -lX11 -lSM -lICE

This is currently not correct in acinclude.m4 and I
ask me why, since you seem to know about it?!

OK, let me explain:

Your code uses
LIBS="-lXm $X_LIBS -lXt $X_PRE_LIBS -lX11
$X_EXTRA_LIBS $LIBS"

where X_PRE_LIBS expands to " -lSM -lICE".
You see that -lX11 is specified *after* it which is
(according to e.g. your FAQ) wrong.
Please note that I'm not sure where I have to insert
X_EXTRA_LIBS. Since it is empty on my systems I can
only assume that it belongs between -lXt and -lX11
since you specified a few possible libs (-lXmu -lXp
-lXext) between both.

I attached a patch which fixes this. There are also
a few other items:

* Once you set CPPFLAGS (preprocessor flags) you do
not need to set the same flags to CFLAGS (compiler
flags). Compiling always depends on preprocessing.

* X_LIBS expands on all my systems to -Lpath, so it
belongs to LDFLAGS and comes in front of all
libraries.

* I added also a FIXME where I think that there is a
problem with conflicting variables (called in an
outer and inner macro to save variables).

Determining the link order of X is a big mess since
it is not documented. I hope this bugreport if found
by others via google helps other people which are
(also) unsure about it.

Jens

Discussion

  • Jens Seidel
    Jens Seidel
    2006-08-14

    acinclude patch

     
    Attachments
  • Paul Gevers
    Paul Gevers
    2009-09-30

    • status: open --> open-duplicate