#21 Wrong test order for x libs in configure

Jens Seidel


according to
and also your FAQ
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

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

* 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 Seidel

    Jens Seidel - 2006-08-14

    acinclude patch

  • Paul Gevers

    Paul Gevers - 2009-09-30
    • status: open --> open-duplicate

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks