XCOMM  Imakefile for XSession
XCOMM  Copyright (C) 1993, 1994  Alain Nissen & Raphael Quinet,
XCOMM                                             University of Liege, Belgium.
XCOMM 
XCOMM  The X Consortium, and any party obtaining a copy of these files from the
XCOMM  X Consortium, directly or indirectly, is granted, free of charge, a full
XCOMM  and unrestricted irrevocable, world-wide, paid up, royalty-free,
XCOMM  nonexclusive right and license to deal in this software and
XCOMM  documentation files (the "Software"), including without limitation the
XCOMM  rights to use, copy, modify, merge, publish, distribute, sublicense,
XCOMM  and/or sell copies of the Software, and to permit persons who receive
XCOMM  copies from any such party to do so.  This license includes without
XCOMM  limitation a license to do the foregoing actions under any patents of
XCOMM  the party supplying this software to the X Consortium.
XCOMM
XCOMM  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
XCOMM  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
XCOMM  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
XCOMM  IN NO EVENT SHALL THE X CONSORTIUM, THE AUTHORS OR THE UNIVERSITY OF
XCOMM  LIEGE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
XCOMM  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
XCOMM  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
XCOMM  SOFTWARE.
XCOMM
XCOMM  The above copyright notice and this permission notice shall be included
XCOMM  in all copies or substantial portions of the Software.
XCOMM 
XCOMM  Authors:
XCOMM     Raphael Quinet <quinet@montefiore.ulg.ac.be>
XCOMM                    <quinet@stud.montefiore.ulg.ac.be>
XCOMM     Alain Nissen   <nissen@montefiore.ulg.ac.be>
XCOMM                    <nissen@stud.montefiore.ulg.ac.be>

XCOMM Define USE_SOUNDS if you want to have a noisy xsession.  You will need
XCOMM Mark Boyns' rplay library, available from sounds.sdsu.edu and 
XCOMM ftp2.montefiore.ulg.ac.be in the directory /pub/rplay.  Otherwise, don't
XCOMM define anything here.
#define USE_SOUNDS

XCOMM The second argument of the waitpid(2) system call can be either a
XCOMM "union wait" (old definition) or a "int" (new definition) variable.  The
XCOMM new definition is assumed by default.  If your system still has the old
XCOMM definition, you must define OLD_WAITPID here.  Otherwise, don't define
XCOMM anything here.
/* #define OLD_WAITPID */

XCOMM Some System V systems do not have the vfork(2) system call in their
XCOMM standard C library.  Imake has an heuristic to determine if your system
XCOMM has vfork(2) or not.  You can override this heuristic by defining
XCOMM NO_VFORK or HAS_VFORK here.
/* #define NO_VFORK */
/* #define HAS_VFORK */

XCOMM On most systems, cpp(1) is located in /lib, but this is not always the
XCOMM case. Imake has an heuristic to determine where cpp is located on your
XCOMM system. You can override this heuristic by defining CPP_CMD here
XCOMM as the command to be run.  The `-P' option will be added after the
XCOMM command, so don't add it yourself!
/* #define CPP_CMD /lib/cpp */

XCOMM On some systems (Linux, AIX, Irix, ...), only a root-setuid program can
XCOMM redirect the console messages elsewhere.  If you work on such a system,
XCOMM it will be necessary to "root-setuid" by hand the installed xsession, and
XCOMM you must define ENABLE_SUID here.  A setuid xsession will abort if
XCOMM ENABLE_SUID has not been defined at compilation-time.
/* #define ENABLE_SUID */

XCOMM Uncomment and adjust these to change the destinations of "make install"
XCOMM and "make install.man" if the defaults generated by Imake are not
XCOMM satisfactory.
XCOMM BINDIR		= /usr/local/bin
XCOMM MANDIR		= /usr/local/man/man1
XCOMM MANSUFFIX		= 1

XCOMM It's not a good idea to change the default "app-defaults" directory.
XCOMM Chances are that "XSession" and "XSession-color" will simply be ignored
XCOMM if you uncomment and change the following line.  But you may change it if
XCOMM you can't install the files in their default directory.  If you do this,
XCOMM you will have to set the XAPPLRESDIR environment variable to the
XCOMM appropriate directory before executing xsession.
XCOMM XAPPLOADDIR     = /usr/lib/X11/app-defaults

XCOMM How excited are you about debugging?  This can be -g, -O, or nothing.
CDEBUGFLAGS	= -O

XCOMM -------------------------------------------------------------------------
XCOMM Please don't change anything below this point - no need really - We hope.
XCOMM

        SRCS = widgets.c console.c exec.c xsession.c

        OBJS = widgets.o console.o exec.o xsession.o

#ifdef USE_SOUNDS
        SOUNDDEF = -DSOUNDS
        SOUNDLIB = -lrplay
#else
        SOUNDDEF = 
        SOUNDLIB =
#endif

#ifdef OLD_WAITPID
        WAITPIDDEF = -DOLD_WAITPID
#else
        WAITPIDDEF = 
#endif

#if HasVFork == YES
        IMAKE_FORKDEF = -DHasVFork
#else
        IMAKE_FORKDEF = -DNoVFork
#endif

#ifdef NO_VFORK
        FORKDEF = -DNO_VFORK
#else
#ifdef HAS_VFORK
        FORKDEF = -DHAS_VFORK
#else
        FORKDEF = 
#endif
#endif

        TMP1 = CppCmd
        IMAKE_CPPDEF = -DCppCmd="\"$(TMP1)\""

#ifdef CPP_CMD
        TMP2 = CPP_CMD
        CPPDEF = -DCPP_CMD="\"$(TMP2)\""
#else
        CPPDEF = 
#endif

#ifdef ENABLE_SUID
        SUIDDEF = -DENABLE_SUID
#else
        SUIDDEF = 
#endif

DEPLIBS         = XawClientDepLibs
LOCAL_LIBRARIES = XawClientLibs $(SOUNDLIB)
DEFINES	        = $(SOUNDDEF) $(WAITPIDDEF) $(FORKDEF) $(CPPDEF) $(SUIDDEF) $(IMAKE_FORKDEF) $(IMAKE_CPPDEF) -DUsingImake


ComplexProgramTarget(xsession)

install:: XSession.ad
	MakeDir($(DESTDIR)$(XAPPLOADDIR))
	$(INSTALL) -c $(INSTAPPFLAGS) XSession.ad $(DESTDIR)$(XAPPLOADDIR)/XSession

install:: XSession.adc
	MakeDir($(DESTDIR)$(XAPPLOADDIR))
	$(INSTALL) -c $(INSTAPPFLAGS) XSession.adc $(DESTDIR)$(XAPPLOADDIR)/XSession-color

XCOMM You will only need the following lines if you change XSession.ad and
XCOMM you want to hard-code the changes into xsession.  This is not needed if
XCOMM XSession.ad is installed in the ".../lib/X11/app-defaults" directory,
XCOMM because the defaults in XSession.ad will override the fallback resources
XCOMM taken from XSess-ad.h.  See the X(1) manual page for details.
XCOMM
XCOMM The shell script "ad2c" is included in this distribution, but is actually
XCOMM part of the ad2c-1.7 distribution, an X11 contribution, available for
XCOMM "anonymous" FTP on ftp.x.org.  See the file ./utils/ad2c/README.
XSess-ad.h: XSession.ad
	/bin/sh ./utils/ad2c/ad2c XSession.ad > XSess-ad.h

