Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!CS.ROCHESTER.EDU!becker From: becker@CS.ROCHESTER.EDU (Tim Becker) Newsgroups: comp.windows.x Subject: Imake for Installed Libs/Includes Message-ID: <8901171751.AA04277@teak.cs.rochester.edu> Date: 17 Jan 89 17:51:44 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 83 Lots of sites (besides mine) don't want to continually build every X application that comes along from inside the X11 distributed src tree. It could even be argued that from a s/w engineering point of view that this is a *bad thing*. (Why even bother to install the libraries and include files if none of the applications that get built uses them?!) For these reasons, I think it's important that we get a way to build X applications using Imakefile's that grab the installed libs/includes. I've done a bit of work to get Imakefiles to work using installed libraries and includes. However, I'd like a few changes from the X workers at MIT to get it to work well. (Someone at MIT X staff, please read this.) My current incantation is an ximake shell script that is something like this: #! /bin/sh IRULESRC=/usr/lib/X11/imake.includes IMAKE=/usr/lib/X11/imake $IMAKE -DCompileWithInstalled -TImake.tmpl -I$IRULESRC -s Makefile I changed the Imake.tmpl to understand the CompileWithInstalled cpp define. The first set of changes are nice and clean: #ifdef CompileWithInstalled XLIB = $(USRLIBDIR)/libX11.a XMULIB = $(USRLIBDIR)/libXmu.a OLDXLIB = $(USRLIBDIR)/liboldX.a XTOOLLIB = $(USRLIBDIR)/libXt.a XAWLIB = $(USRLIBDIR)/libXaw.a #else CompileWithInstalled XLIB = $(XLIBSRC)/libX11.a XMULIB = $(XMUSRC)/libXmu.a OLDXLIB = $(OLDXLIBSRC)/liboldX.a XTOOLLIB = $(TOOLKITSRC)/libXt.a XAWLIB = $(AWIDGETSRC)/libXaw.a #endif CompileWithInstalled Note that I don't have any new path variables or hardcoded paths here. If the local installer defined UsrLibDir correctly (or didn't define it at all - leaving the default for USRLIBDIR), the *correct* thing will happen. The loader will get all the libs from the right (installed) place. The above change doesn't cover include files however. Here's what I have now for this area: #ifdef CompileWithInstalled # this should work but does not because INCDIR is /usr/include/X11 # INCLUDES = -I$(INCDIR) INCLUDES = -I/usr/include #else CompileWithInstalled INCLUDES = -I$(TOP) #endif CompileWithInstalled Note my comment in the code. The problem is that INCDIR is defined to be the directory where the header files are to be installed. Yet, most of the X11 application code gets these headers by writing "#include ". Cpp will complain if I pass -I$(INCDIR) because it can't find /usr/include/X11/X11/xxxx (note the X11/X11). Before you say, "why bother with -I/usr/include when cpp will search there by default", I must confess that I've not told the truth in my examples above. I want to install things in /usr/xxx/{bin,lib,include} - where xxx is "staff" for me (could be "new", "local", etc). So, I have to bother with a -I.... on the INCLUDES line in Imake.tmpl. Since all the application code does "#include ", it won't work to make INCDIR not end in "/X11". (I couldn't install the header files in /usr/local/include, for example. It would have to be /usr/local/include/X11.) So could we somehow specify INCDIR to not include the /X11 on the end (but to assume it wherever it's used) or could we have another variable that doesn't include the /X11 (so INCDIR = $(INCLUDEDIR)/X11)? I don't like the first solution, but the second isn't as ugly. I think this is the only stickler keeping a non-src-hierarchy version of imake from working. Can we figure out a way to fix this? Tim.