XCOMM platform:  $XFree86: xc/config/cf/bsdi.cf,v 3.40 2004/06/25 15:33:21 tsi Exp $

/*
 * Copyright (c) 1994-2004 by The XFree86 Project, Inc.
 * All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject
 * to the following conditions:
 *
 *   1.  Redistributions of source code must retain the above copyright
 *       notice, this list of conditions, and the following disclaimer.
 *
 *   2.  Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer
 *       in the documentation and/or other materials provided with the
 *       distribution, and in the same place and form as other copyright,
 *       license and disclaimer information.
 *
 *   3.  The end-user documentation included with the redistribution,
 *       if any, must include the following acknowledgment: "This product
 *       includes software developed by The XFree86 Project, Inc
 *       (http://www.xfree86.org/) and its contributors", in the same
 *       place and form as other third-party acknowledgments.  Alternately,
 *       this acknowledgment may appear in the software itself, in the
 *       same form and location as other such third-party acknowledgments.
 *
 *   4.  Except as contained in this notice, the name of The XFree86
 *       Project, Inc shall not be used in advertising or otherwise to
 *       promote the sale, use or other dealings in this Software without
 *       prior written authorization from The XFree86 Project, Inc.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */


#ifndef OSName
#define OSName		DefaultOSName
#endif
#ifndef OSVendor
#define OSVendor	BSDI
#endif
#ifndef OSMajorVersion
#define OSMajorVersion	DefaultOSMajorVersion
#endif
#ifndef OSMinorVersion
#define OSMinorVersion	DefaultOSMinorVersion
#endif
#ifndef OSTeenyVersion
#define OSTeenyVersion	DefaultOSTeenyVersion
#endif
XCOMM operating system:  OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion)

#define HasBSD44Sockets		YES
#define HasBsdMake		YES
#define HasDlopen		YES
#define HasPutenv		YES
#define HasSnprintf		YES
#define HasMkstemp		YES
#define HasUsableFileMmap	YES
#define HasZlib			YES
#define HasSetUseContext	YES
#define HasBSDAuth		YES
#define HasSetProcTitle		YES
#define HasBasename		NO

#if 0
#define HasKrb5			YES
#define Krb5Include		-I/usr/include/krb5
#define Krb5Libraries		-lkrb5 -lk5crypto -lprofile -lcom_err
#endif

#define SharedGLUReqs		$(LDPRELIB) $(XLIB) $(GLXLIB) -lstdc++

#if (OSMajorVersion == 4 && OSMinorVersion >= 1) || (OSMajorVersion > 4)
#define HasNCurses		YES
#else
#define HasNCurses		NO
#endif
#if (OSMajorVersion == 4 && OSMinorVersion >= 3) || (OSMajorVersion > 4)
#define HasStrlcat		YES
#else
#define HasStrlcat		NO
#endif

#define BuildLBX		YES
#define GzipFontCompression	YES
#define BuildXaw6		NO

XCOMM BSD/OS 5.1 (intel) comes with gcc 3.2.2 installed as gcc and cc.

XCOMM BSD/OS 5.0 (intel) comes with gcc 2.95.3 installed as gcc and cc.

XCOMM BSD/OS 4.3/4.3.1 (intel) comes with gcc 2.95.3 installed as gcc and cc.

XCOMM BSD/OS 4.2 (intel) comes with gcc 2.95.2 installed as gcc and cc.
XCOMM BSD/OS 4.2 (sparc) comes with gcc 2.95.2 installed as gcc and cc.

XCOMM BSD/OS 4.1 (intel) comes with gcc 2.91.66 installed as gcc and cc.
XCOMM BSD/OS 4.1 (sparc) comes with gcc 2.95.2 installed as gcc and cc.

XCOMM BSD/OS 4.0.1 (intel) comes with gcc 2.7.2.1 installed as gcc2, gcc and cc.
XCOMM BSD/OS 4.0.1 (sparc) comes with gcc 2.7.2.1 installed as gcc2, gcc and cc.
XCOMM Punt on OS revs earlier than 4.0.1

XCOMM BSDI uses shlicc for compiling C and shlic++ for compiling C++
XCOMM using static shared libraries.  We also build ELF dynamic shared
XCOMM libraries as well as normal archive libraries.

XCOMM BSD/OS 3.0 comes with gcc 2.7.2 installed as gcc2 and gcc.
XCOMM gcc 1.42 is installed as cc.

XCOMM BSD/OS 2.1 comes with gcc 2.7.1 installed as gcc2 and gcc.
XCOMM gcc 1.42 is installed as cc.

XCOMM BSD/OS 2.0 comes with gcc 2.6.3 installed as gcc2 and gcc.
XCOMM gcc 1.42 is installed as cc.

XCOMM BSD/386 1.1 comes with gcc 2.5.8 installed as gcc2.
XCOMM BSD/386 1.0 comes with gcc 1.40 as the only compiler.
XCOMM The default is to use gcc2 on release 2.1, 2.0 and 1.1 and gcc1 on 1.0
XCOMM The defaults can be altered by defining "HasGcc2" as YES or NO in
XCOMM xf86site.def

#ifndef HasGcc
# define HasGcc			YES
#endif
#if OSMajorVersion > 1 || OSMinorVersion >= 1
# ifndef HasGcc2
#  define HasGcc2		YES
# endif
#endif
#if HasGcc2
# ifndef HasGcc2ForCplusplus
#  define HasGcc2ForCplusplus	YES
# endif
# ifdef i386Architecture
#  define CcCmd			gcc /* shlicc */
#  define CplusplusCmd		g++ /* shlicc++ */
#  if ((OSMajorVersion == 4 && OSMinorVersion >= 2) || (OSMajorVersion > 4))
#   define OptimizedCDebugFlags	-O3 -mcpu=pentiumpro -march=pentium GccAliasingArgs
#  else
#   define OptimizedCDebugFlags	-O2 -m486 GccAliasingArgs
#  endif
# endif
# ifdef PpcArchitecture
#  define CcCmd			gcc
#  define CplusplusCmd		g++
#  define OptimizedCDebugFlags	-O2 GccAliasingArgs
# endif
# ifdef SparcArchitecture
#  define CcCmd			gcc
#  define CplusplusCmd		g++
#  define OptimizedCDebugFlags	-O2 -cpu=v8 -mtune=v8 GccAliasingArgs
# endif
#else
# define CcCmd			cc
# define OptimizedCDebugFlags	-O
#endif

/*
 * A hack to work around an optimization problem with GCC 2.95.2 - 2.95.4
 */
#if ((OSMajorVersion == 4 && OSMinorVersion >= 2) || (OSMajorVersion > 4))
#define GccOptBug295
#endif

#define CppCmd		/usr/bin/cpp
#define HasGroff	YES
#define MkdirHierCmd	mkdir -p
#define SetTtyGroup	YES
#define HasNdbm		YES
#define	DBMLibrary	/**/
#define HasWChar32      YES
#define DirFailPrefix -
#define AvoidNullMakeCommand YES
#define HasVarRun       YES
#define HasVarDb        YES

# ifndef GccUsesGas
#  define GccUsesGas    YES
# endif
#if HasGcc
#ifndef DefaultCCOptions
#if defined(UseInstalled) && (!defined(XF86LinkKit) || !XF86LinkKit)
#define DefaultCCOptions	/**/
#else
#define DefaultCCOptions	/* -ansi */
#endif
#endif
#endif

#if GccUsesGas
# define GccGasOption -DGCCUSESGAS
#else
# define GccGasOption /**/
#endif

/*
 * Build a threaded X server on BSD/OS 4.1 and newer releases
 */
#if (OSMajorVersion == 4 && OSMinorVersion >= 1) || (OSMajorVersion > 4)
#define HasPosixThreads         YES     /* this will autodefine HasThreadedX */
#define HasThreadSafeAPI        YES
/*
 * Heck, build a server that can load modules too...
 */
#define DoLoadableServer        Yes
#endif

XCOMM math.h uses _REENTRANT in FreeBSD, so we define it here too
#if (OSMajorVersion >= 5)
#define SystemMTDefines         -D_REENTRANT -D_THREAD_SAFE -D_POSIX_THREAD_SAFE_FUNCTIONS
#elif (OSMajorVersion == 4 && OSMinorVersion >= 1)
#define SystemMTDefines         -D_REENTRANT -D_THREAD_SAFE
#endif


#ifdef i386Architecture
#ifndef BuildXF86DRI
#define BuildXF86DRI            NO
#endif
#endif

#ifdef i386Architecture
# define HasTk			YES
# define TkLibName		tk4.2
# define TkLibDir		/usr/contrib/lib
# define TkIncDir		/usr/include
# define XF86SetupUsesStaticTk	NO
# define HasTcl			YES
# define TclLibName		tcl7.6
# define TclLibDir		/usr/contrib/lib
# define TclIncDir		/usr/include
# define XF86SetupUsesStaticTcl	NO
# define SharedLibXv		YES
# define SharedLibXinerama	YES
# define ServerExtraDefines GccGasOption XFree86ServerDefines -I/sys
# define ServerOSDefines XFree86ServerOSDefines
# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME
# define XFree86ConsoleDefines	-DBSDI_VT
# if OSMajorVersion > 3 || (OSMajorVersion == 3 && OSMinorVersion >= 1)
#  include <bsdiLib.rules>
#  define DontUseLibPathVar
#  define BuildDynamicLoading YES
#  define ServerCcCmd         cc
#  define ServerExtraSysLibs  DlLibrary
# endif
# define XConfigDir /etc/X11
#endif

#ifdef PpcArchitecture
# define BuildServer		NO
# define BuildFonts		NO
# define XConfigDir /etc/X11
# include <bsdiLib.rules>
# define DontUseLibPathVar
# define BuildDynamicLoading	YES
# define ServerCcCmd		cc
# define ServerExtraSysLibs	DlLibrary
#endif

#ifdef SparcArchitecture
# define ServerExtraDefines
# define ServerOSDefines   -DDDXOSINIT
#endif

#define HasShm			YES
#define AsmDefines -DUSE_GAS

#ifndef LdPreLib
#define LdPreLib -L$(BUILDLIBDIR) -L$(USRLIBDIR)
#endif

#if OSMajorVersion >= 4
#define StandardDefines	-D__ELF__ -DCSRG_BASED
#else
#define StandardDefines	-DCSRG_BASED
#endif

#define InstallCmd /usr/bin/install
#define	EqnCmd eqn -Tps
#define	NeqnCmd eqn -Tascii
          COL = col
         NEQN = NeqnCmd
        NROFF = nroff

#define DefaultUserPath		:/bin:/usr/bin:/usr/local/bin:$(BINDIR)
#define DefaultSystemPath	/sbin:/usr/sbin:/bin:/usr/bin:$(BINDIR)

#define StripInstalledPrograms	YES
#define InstPgmFlags		-s -m 0555 -o bin -g bin
#define InstBinFlags		-m 0555 -o bin -g bin
#define InstUidFlags		-m 4555 -o root -g bin
#define InstLibFlags		-m 0444 -o bin -g bin
#define InstIncFlags		-m 0444 -o bin -g bin
#define InstManFlags		-m 0444 -o bin -g bin
#define InstDatFlags		-m 0444 -o bin -g bin

XCOMM Man pages need to be formatted when installed, so override the default
XCOMM imake rules.

#define ManSuffix       1
#define ManSourcePath   $(MANPATH)/cat

#define InstallManPageLong(file,destdir,dest)                           @@\
CppManTarget(file, $(EXTRAMANDEFS))					@@\
									@@\
all:: file.0								@@\
									@@\
file.0:: file.$(MANNEWSUFFIX)						@@\
	@if [ -f file.$(MANNEWSUFFIX) ]; \				@@\
	then \								@@\
	cat file.$(MANNEWSUFFIX) | $(NEQN) | $(TBL) | $(NROFF) $(MANMACROS) | $(COL) >/tmp/$$$$.man; \	@@\
	cp /tmp/$$$$.man file.0; \					@@\
	$(RM) /tmp/$$$$.man; \						@@\
	fi 								@@\
									@@\
install.man::                                                           @@\
	MakeDir($(DESTDIR)destdir)					@@\
	-@if [ -f file.0 ]; \						@@\
	then \								@@\
	$(INSTALL) -c $(INSTMANFLAGS) file.0 $(DESTDIR)destdir/dest.0; \@@\
	fi

#define InstallGenManPageLong(file,destdir,dest,suffix)			@@\
	InstallManPageLong(file,destdir,dest)

#define InstallMultipleManSuffix(list,dest,suff)                        @@\
install.man:: 								@@\
	MakeDir($(DESTDIR)dest)						@@\
	case '${MFLAGS}' in *[i]*) set +e;; esac; \			@@\
	for i in list; do \                                             @@\
	  (set -x; \							@@\
	  cat $$i.suff | $(NEQN) | $(TBL) | $(NROFF) $(MANMACROS) | $(COL) >/tmp/$$$$.suff; \	@@\
	  $(INSTALL) -c $(INSTMANFLAGS) /tmp/$$$$.suff $(DESTDIR)dest/$$i.0; \	@@\
	  $(RM) /tmp/$$$$.suff); \						@@\
	done

#define InstallMultipleMan(list,dest)                                   @@\
	InstallMultipleManSuffix(list,dest,man)

#define InstallManPageAliases(file,destdir,aliases)                     @@\
install.man:: 								@@\
	@case '${MFLAGS}' in *[i]*) set +e;; esac; \                    @@\
	for i in aliases; do \                                          @@\
		(set -x; \						@@\
		$(RM) $(DESTDIR)destdir/$$i.0;\  			@@\
		(cd $(DESTDIR)destdir; $(LN) file.0 $$i.0);\  		@@\
		); \							@@\
	done

#define InstallGenManPageAliases(file,destdir,suffix,aliases)		@@\
	InstallManPageAliases(file,destdir,aliases)

/*
 * These seem redundant, but leave them in for now.
 */
#ifdef i386Architecture
#define i386Bsd 1
#define i386Bsdi 1
#include <xfree86.cf>
#endif

#ifdef SparcArchitecture
#ifndef       XsunMonoServer
#define       XsunMonoServer  NO              /* monochrome only */
#endif
#ifndef       XsunServer
#define       XsunServer      YES             /* mono + 8 bit color */
#endif
#ifndef       Xsun24Server
#define       Xsun24Server    NO              /* mono + 8 bit color + 24 bit c
olor */
#endif

#ifndef       BuildPexExt
#define       BuildPexExt     (XsunServer || Xsun24Server)
#endif

#ifndef NeedConstPrototypes
#define NeedConstPrototypes YES
#endif
#ifndef NeedNestedPrototypes
#define NeedNestedPrototypes YES
#endif
#ifndef NeedVarargsPrototypes
#define NeedVarargsPrototypes YES
#endif

#define PexCCOptions DefaultCCOptions

#ifndef       BuildXKB
#define       BuildXKB        YES
#endif

#endif /* SparcArchitecture */

