[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs (today's cvs) aborts under X [PATCH].
From: |
Lute Kamstra |
Subject: |
Re: Emacs (today's cvs) aborts under X [PATCH]. |
Date: |
Mon, 28 Apr 2003 17:17:14 +0200 |
User-agent: |
Gnus/5.090018 (Oort Gnus v0.18) Emacs/21.3 (gnu/linux) |
Richard Stallman <address@hidden> writes:
> FWIW, we tested Emacs for this bug in some more environments. Here is
> a summary of the results.
>
> Thanks, but that sort of investigation is not really useful in a
> situation like this one (or in most situations). The Bugs chapter
> gives more explanation.
>
> Once you have isolated a specific construct that doesn't produce
> correct results, trying other combinations and cases is basically not
> a useful activity. It is better to spend your time studying the code
> and figuring out why that construct gives the wrong results you see.
We were quite stubborn and tested yet another combination. :-)
We tried to compile Emacs 21.3.50 on a Redhat 8.0 system with only
LessTif (so without Open Motif). This resulted in compile errors in
the lwlib/ directory. It turns out that the lwlib library cannot find
the LessTif header files. Is does find Open Motif files when
installed however. As a result, the following happens on my Redhat
8.0 system:
Open Motif + LessTif installed: lwlib is built with Open Motif, the
rest of emacs is built with LessTif. This mess is most likely the
cause of the abort call.
Only Open Motif installed: everything is built with Open Motif and
Emacs works fine.
Only LessTif installed: lwlib failed to compile.
It is easy to change lwlib/Makefile.in so that it finds the LessTif
headers on a LessTif only system. I tried this and got Emacs to
compile and run fine. This change also lets emacs compile and run
fine when I have only Open Motif installed.
However, I ran into some difficulties when trying to make things
function properly in case both LessTif and Open Motif are installed.
Let me try to explain the problem.
On a Redhat system, the Open Motif libraries and headers are located
in /usr/X11R6/lib/ and /usr/X11R6/include/Xm/. The LessTif libraries
and headers can be found in /usr/X11R6/LessTif/Motif1.2/lib/ and
/usr/X11R6/LessTif/Motif1.2/include/Xm/. So if we want to use LessTif
and not Open Motif on a system with both installed, we must make sure
that "-L/usr/X11R6/LessTif/Motif1.2/lib" precedes "/usr/X11R6/lib/"
and that "-I/usr/X11R6/LessTif/Motif1.2/include" precedes
"-I/usr/X11R6/include" when linking and compiling motif things.
In September 2002 we changed the configure.in script to try and
accomplish this. The lines marked by + were added:
,----[ configure.in; lines 1959 -- 2002 ]
| if test "${USE_X_TOOLKIT}" = "MOTIF"; then
+ AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
+ # We put this in CFLAGS temporarily to precede other -I options
+ # that might be in CFLAGS temporarily.
+ # We put this in CPPFLAGS where it precedes the other -I options.
+ OLD_CPPFLAGS=$CPPFLAGS
+ OLD_CFLAGS=$CFLAGS
+ CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
+ CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
+ [AC_TRY_COMPILE([#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>],
+ [int x = 5;],
+ emacs_cv_lesstif=yes, emacs_cv_lesstif=no)])
+ if test $emacs_cv_lesstif = yes; then
+ # Make sure this -I option remains in CPPFLAGS after it is set
+ # back to REAL_CPPFLAGS.
+ # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
+ # have those other -I options anyway. Ultimately, having this
+ # directory ultimately in CPPFLAGS will be enough.
+ REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
+ LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
+ else
+ CFLAGS=$OLD_CFLAGS
+ CPPFLAGS=$OLD_CPPFLAGS
+ fi
| AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1,
| [AC_TRY_COMPILE([#include <Xm/Xm.h>],
| [#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
| int x = 5;
| #else
| Motif version prior to 2.1.
| #endif],
| emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
| HAVE_MOTIF_2_1=$emacs_cv_motif_version_2_1
| if test $emacs_cv_motif_version_2_1 = yes; then
| HAVE_LIBXP=no
| AC_DEFINE(HAVE_MOTIF_2_1, 1,
| [Define to 1 if you have Motif 2.1 or newer.])
| AC_CHECK_LIB(Xp, XpCreateContext, HAVE_LIBXP=yes)
| if test ${HAVE_LIBXP} = yes; then
| AC_DEFINE(HAVE_LIBXP, 1,
| [Define to 1 if you have the Xp library (-lXp).])
| fi
| fi
| fi
`----
So we basically add "-L/usr/X11R6/LessTif/Motif1.2/lib" to the front
of LDFLAGS and "-I/usr/X11R6/LessTif/Motif1.2/include" to the front of
CPPFLAGS if LessTif is installed there.
This works fine for everything in the src/ directory. Indeed, in
src/Makefile.in it says:
,----[ src/Makefile.in; lines 30 -- 40 ]
| # Here are the things that we expect ../configure to edit.
| # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
| address@hidden@
| address@hidden@
| address@hidden@
| address@hidden@
| address@hidden@
| address@hidden@
| address@hidden@
| address@hidden@
| address@hidden@
`----
and:
,----[ src/Makefile.in; lines 283 -- 285 ]
| ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I.
-I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE
C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS}
| .c.o:
| $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
`----
This results in the following Makefile parts:
,----[ src/Makefile; lines 30 -- 40 ]
| # Here are the things that we expect ../configure to edit.
| # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
| srcdir=/export/scratch1/lute/sources/cvs/emacs/src
| VPATH=/export/scratch1/lute/sources/cvs/emacs/src
| CC=gcc
| CPP=gcc -E
| CFLAGS=-g -O2
| CPPFLAGS=-I/usr/X11R6/LessTif/Motif1.2/include -D_BSD_SOURCE
| LDFLAGS=-L/usr/X11R6/LessTif/Motif1.2/lib -L/usr/X11R6/lib
| LN_S=ln -s
| EXEEXT=
`----
and
,----[ src/Makefile; lines 69 -- 71 ]
| ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I.
-I${srcdir} -D_BSD_SOURCE -I/usr/X11R6/include ${CFLAGS}
| .c.o:
| $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
`----
This works for the library paths in a similar fashion.
However, things fail for the lwlib/ directory. In lwlib/Makefile.in,
there is no "address@hidden@" line.
,----[ lwlib/Makefile.in; lines 5 -- 14 ]
| address@hidden@
| address@hidden@
| address@hidden@
|
| address@hidden@
| address@hidden@
| address@hidden@
| address@hidden@
| address@hidden@
| address@hidden@
`----
As a result, the LessTif header files are never found. Adding such a
"address@hidden@" line repairs the situation where only LessTif is
installed. However, since
,----[ lwlib/Makefile.in; lines 33 -- 39 ]
| # ../src is needed to find config.h.
| ALL_CFLAGS= $(C_SWITCH_SITE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
| $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) $(CPPFLAGS) $(CFLAGS) \
| -DHAVE_CONFIG_H -Demacs -I. -I../src -I${srcdir} -I${srcdir}/../src
|
| .c.o:
| $(CC) -c ${ALL_CFLAGS} $<
`----
and configure sets C_SWITCH_X_SITE to -I/usr/X11R6/include, the Open
Motif headers are found before the LessTif headers on a system with
both toolkits installed.
I changed lwlib/Makefile.in to make it behave like src/Makefile.in and
this solves all the Open Motif vs LessTif problems (see patch below).
However, I don't know why $(CPPFLAGS) was originally placed after
$(C_SWITCH_SITE), $(C_SWITCH_SYSTEM), $(C_SWITCH_X_SITE),
$(C_SWITCH_X_SYSTEM), and $(C_SWITCH_MACHINE). So my naive patch may
cause problems for others. Use with caution.
Regards,
Lute.
*** Makefile.in.~1.26.~ 2002-04-28 15:33:40.000000000 +0200
--- Makefile.in 2003-04-28 16:54:07.000000000 +0200
***************
*** 9,14 ****
--- 9,15 ----
address@hidden@
address@hidden@
address@hidden@
+ address@hidden@
address@hidden@
address@hidden@
# See address@hidden@ is used below.
***************
*** 31,41 ****
# ../src is needed to find config.h.
ALL_CFLAGS= $(C_SWITCH_SITE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
! $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) $(CPPFLAGS) $(CFLAGS) \
-DHAVE_CONFIG_H -Demacs -I. -I../src -I${srcdir} -I${srcdir}/../src
.c.o:
! $(CC) -c ${ALL_CFLAGS} $<
all:: liblw.a
--- 32,42 ----
# ../src is needed to find config.h.
ALL_CFLAGS= $(C_SWITCH_SITE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
! $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) $(CFLAGS) \
-DHAVE_CONFIG_H -Demacs -I. -I../src -I${srcdir} -I${srcdir}/../src
.c.o:
! $(CC) -c $(CPPFLAGS) ${ALL_CFLAGS} $<
all:: liblw.a
--
Lute Kamstra <address@hidden>
CWI department PNA4
Room M233 phone (+31) 20 592 4214
[Echelon material: blackjack CDMA Peking]