[Xlibs] Please review my autotool'd libXt

Jeremy C. Reed reed@reedmedia.net
Thu, 27 Nov 2003 05:58:47 -0800 (PST)


I began making libXt portable. It is at:

http://www.reedmedia.net/misc/X/libXt-6.0-jcr1.tar.gz (524086 bytes)

 e29f3fc1593596abf89a7b2049a7715d  libXt-6.0-jcr1.tar.gz

Please share your feedback and advice. Thank you.

This is what I did:

1) Started with xc/lib/Xt from X430src-1. (Later, I will update to CVS
version.)

2) mkdir -p include/X11 and moved various headers there. (I hope that is
okay to move some file structure; I based this on a libX11 idea.)

3) created Makefile.am and include/Makefile.am (using some ideas from
   original Imakefile which I removed).

4) used autotools:

  vi Makefile.am
  vi configure.ac
  libtoolize --force --copy # this made ltconfig -- hope that is okay
  aclocal
  autoconf
  touch NEWS README AUTHORS ChangeLog
  vi xt.pc.in
  automake --add-missing --copy --force
  autoheader

5) It needs Xalloca.h. I don't know which of your projects provides it.
   My workaround was to copy it into place:
 sudo cp -i \
/scratch/pkgsrc/wip/XFree86-libs/work.puget/xc/include/Xalloca.h \
/usr/include/X11/.

Should I just add my own Xalloca.h to this portable libXt?

6) The StringDefs.h and Shell.h are generated using makestrs(1).

The original XFree86 way is:

STRINGS_FILES = StringDefs.c StringDefs.h Shell.h
STRINGS_TMPLS = util/StrDefs.ct util/StrDefs.ht util/Shell.ht
STRING_LIST = util/string.list
ToolkitMakeStrings($(STRINGS_FILES),$(STRING_LIST),$(STRINGSABIOPTIONS),$(STRING
S_TMPLS),StringDefs.c)

I did:

 makestrs -intelabi < util/string.list > StringDefs.c
 mv StringDefs.h Shell.h include/X11/

That -intelabi was wrong (as seen below).

7) This needs X11/SM/SMlib.h, so I installed libSM. And I made
configure.ac check for that pkgconfig for "sm".

8) It built and installed fine[1].

9) xpm[2] using Xt mostly built fine, but then when linking with Xt it
failed:

cc -pipe -o sxpm -g -I/usr/include -I/usr/X11R6/include      -L/usr/lib
sxpm.o -L../lib -L/usr/lib -lXpm -lXt -lSM -lICE -lXext -lX11
sxpm.o(.text+0x1de): In function `main':
/scratch/pkgsrc/graphics/xpm/work.puget/xpm-3.4k/sxpm/sxpm.c:195:
undefined reference to `XtStrings'
sxpm.o(.text+0x208):/scratch/pkgsrc/graphics/xpm/work.puget/xpm-3.4k/sxpm/sxpm.c:197:
undefined reference to `XtStrings'
sxpm.o(.text+0x232):/scratch/pkgsrc/graphics/xpm/work.puget/xpm-3.4k/sxpm/sxpm.c:200:
undefined reference to `XtStrings'
sxpm.o(.text+0x25c):/scratch/pkgsrc/graphics/xpm/work.puget/xpm-3.4k/sxpm/sxpm.c:202:
undefined reference to `XtShellStrings'
sxpm.o(.text+0x4f7):/scratch/pkgsrc/graphics/xpm/work.puget/xpm-3.4k/sxpm/sxpm.c:244:
undefined reference to `XtStrings'
sxpm.o(.text+0x523):/scratch/pkgsrc/graphics/xpm/work.puget/xpm-3.4k/sxpm/sxpm.c:246:
undefined reference to `XtShellStrings'
/usr/lib/libXt.so: undefined reference to `XtStringsR6'
/usr/lib/libXt.so: undefined reference to `XtShellStringsR6'
collect2: ld returned 1 exit status

The above problem is related to my makestrs for ToolkitMakeStrings usage.

10) Used makestrs without any option and my final libXt worked for xpm.
(And rxvt worked using that libxpm.) (Later I will try more when I get Xaw
installed too.)

11) So I added support to Makefile.am to run the makestrs. Please review
this and share any suggestions.

12) What about all the great X Toolkit Intrinsics documentation in
Postscript and man pages? Should I add them too?

13) Also what version is this libXt anyways? I used 6.0.

I should go to sleep now ...

   Jeremy C. Reed
   http://bsd.reedmedia.net/

[1] The files as installed (using default prefix):
/usr/local/include
/usr/local/include/X11
/usr/local/include/X11/Composite.h
/usr/local/include/X11/CompositeP.h
/usr/local/include/X11/Constraint.h
/usr/local/include/X11/ConstrainP.h
/usr/local/include/X11/Core.h
/usr/local/include/X11/CoreP.h
/usr/local/include/X11/Intrinsic.h
/usr/local/include/X11/IntrinsicP.h
/usr/local/include/X11/Object.h
/usr/local/include/X11/ObjectP.h
/usr/local/include/X11/RectObj.h
/usr/local/include/X11/RectObjP.h
/usr/local/include/X11/Shell.h
/usr/local/include/X11/ShellP.h
/usr/local/include/X11/StringDefs.h
/usr/local/include/X11/Vendor.h
/usr/local/include/X11/VendorP.h
/usr/local/lib
/usr/local/lib/libXt.so.6.0
/usr/local/lib/libXt.so.6
/usr/local/lib/libXt.so
/usr/local/lib/libXt.la
/usr/local/lib/libXt.a
/usr/local/lib/pkgconfig
/usr/local/lib/pkgconfig/xt.pc

[2] http://www.inria.fr/koala/lehors/xpm.html