/*	XConfig.h
 *
 *		This header does nothing but set different preprocessor
 *	symbols to specify the compiler target for this code.
 *
 *		This uses the Metrowerks Codewarrior predefined symbols
 *	for the Macintosh and for Windows, and depends on the ability
 *	to specify command-line predefined symbols for the GNU Unix tools.
 *
 *
 *		Note: to compile with X Windows support, compile with the
 *	symbol 'OPT_XWIN' set to 1. For Windows support, predefine the
 *	symbol 'WIN32' (done by default by Microsoft Visual C++).
 */

/*  YAAF - Yet another application framework
 *  Copyright (C) 1997, 1998 William Edward Woody
 *  
 *  This library is free software; you can redistribute it
 *  and/or modify it under the terms of the GNU Library
 *  General Public License as published by the Free Software
 *  Foundation; either version 2 of the License, or any
 *  later version.
 *  
 *  This library is distributed in the hope that it will be
 *  useful, but WITHOUT ANY WARRANTY; without even the implied
 *  warranty of MERCHANTABIILITY or FITNESS FOR A PARTICULAR
 *  PURPOSE. See the GNU Library General Public License for
 *  more details.
 *  
 *  You should have received a copy of the GNU Library General
 *  Public License along with this library; if not, write to the
 *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 *  Boston, MA 02111-1307, USA.
 *  
 *  To contact the author, either e-mail me at woody@pandawave.com, 
 *	or write to
 *  
 *          William Edward Woody
 *          In Phase Consulting
 *          1545 Ard Eevin Avenue
 *          Glendale, CA 91202
 *
 *	Or visit us on the web at http://www.pandawave.com
 */


#ifndef PandaWave_XCONFIG
#define PandaWave_XCONFIG


/************************************************************************/
/*																		*/
/*	Documentation Escapes												*/
/*																		*/
/************************************************************************/

/*
 *	@F"OPT_MACOS"
 *	@H"XConfig.h"
 *	@U"#if OPT_MACOS == 1"
 *	@I
 *
 *		This macro is defined to be 1 if the YAAF libraries are being
 *	compiled on the Macintosh. This is set by examining the various
 *	compiler-defined macros defined by the Metrowerks Codewarrior
 *	compiler.
 *
 *		If you are recompiling the YAAF libraries using another
 *	Macintosh compiler, it's worth examining the code in <XConfig.h>
 *	to convert it apporpriately.
 */

/*
 *	@F"OPT_WINOS"
 *	@H"XConfig.h"
 *	@U"#if OPT_WINOS == 1"
 *	@I
 *
 *		This macro is defined to be 1 if the YAAF libraries are being
 *	compiled on Microsoft Windows. This is set by examining the various
 *	compiler-defined macros defined by the Metrowerks Codewarrior
 *	compiler and by the Microsoft Visual C++ compiler.
 *
 *		If you are recompiling the YAAF libraries using another
 *	Windows compiler, it's worth examining the code in <XConfig.h>
 *	to convert it apporpriately.
 */

/*
 *	@F"OPT_XWIN"
 *	@H"XConfig.h"
 *	@U"#if OPT_XWIN == 1"
 *	@I
 *
 *		This macro is defined to be 1 if the YAAF libraries are being
 *	compiled on the Macintosh. This is set as command line arguments
 *	in the Unix makefile.
 */


/************************************************************************/
/*																		*/
/*	Define the appropriate symbols										*/
/*																		*/
/************************************************************************/

#if defined(__MWERKS__)						// using Metrowerks?

	#if defined(macintosh)
		#define OPT_MACOS		1
		#define OPT_WINOS		0
		#define OPT_XWIN		0
	#endif // defined(macintosh)
	
	#if defined(__INTEL__)
		#define OPT_MACOS		0
		#define OPT_WINOS		1
		#define OPT_XWIN		0
	#endif // defined(__INTEL__)

#else // !defined(__MWERKS__)

	#if OPT_XWIN == 1
		#define OPT_MACOS		0
		#define OPT_WINOS		0
	#endif
	
	#if defined(WIN32)
		#define OPT_MACOS		0
		#define OPT_WINOS		1
		#define OPT_XWIN		0
	#endif

#endif // define(__MWERKS__)

/************************************************************************/
/*																		*/
/*	Verify symbols defined correctly									*/
/*																		*/
/************************************************************************/

#if !defined(OPT_MACOS) || !defined(OPT_WINOS) || !defined(OPT_XWIN)
	#error  Target platform not specified
#endif


/************************************************************************/
/*																		*/
/*	Define certain constants											*/
/*																		*/
/************************************************************************/

/*
 *	@F"OPT_NATIVEORDER"
 *	@H"XConfig.h"
 *	@U"#if OPT_NATIVEORDER == 1"
 *	@I
 *
 *		This macro is defined to be 1 if the byte order for integers
 *	is in network-native (Macintosh) order, or 0 if otherwise. This
 *	is set in the <XConfig.h> header.
 */

#if OPT_MACOS == 1
	#define	OPT_NATIVEORDER		1			// integer is native (net) order
#endif

#if OPT_WINOS == 1
	#define OPT_NATIVEORDER		0			// integer is _not_ native net order
#endif

/*
 *	See if this is set
 */

#if !defined(OPT_NATIVEORDER)
	#error OPT_NATIVEORDER has not been set properly
#endif

/************************************************************************/
/*																		*/
/*	And load various headers											*/
/*																		*/
/************************************************************************/

#if OPT_WINOS && !defined(__MWERKS__)
#include <Windows.h>						// The MS Windows headers

    #ifdef _WINDOWS
    #pragma warning (disable: 4244)			// disable for VC++
	#pragma warning (disable: 4800)
    #endif

#endif


#if OPT_XWIN && defined(__cplusplus) && (OPT_NATIVEORDER == 1)
	// Kludge to make this work with MkLinux's compiler under DR2.1r6.
	// You may wish to comment the following out with DR3
	#include <g++/std/typeinfo.h>			// 'cause I hate including this
#endif

#endif /* PandaWave_XCONFIG */
