/*  BuGLe: an OpenGL debugging tool
 *  Copyright (C) 2008  Bruce Merry
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; version 2.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef BUGLE_SRC_PORTING_H
#define BUGLE_SRC_PORTING_H

#define BUGLE_BINFMT_ELF 1
#define BUGLE_WINSYS_X11 1
#define BUGLE_GLWIN_GLX 1
#define BUGLE_GLTYPE_GL 1
#define BUGLE_FS_UNIX 1
#define BUGLE_OSAPI_POSIX 1

#if BUGLE_BINFMT_ELF
/* 1 if symbols are bound to a specific dynamic object,
 * 0 if found at first use */
# define BUGLE_BINFMT_SYMBOL_BY_DSO 0
/* 1 if LD_PRELOAD or similar mechanism is used to load bugle
 * 0 if bugle is replaces the OpenGL library in the search path
 */
# define BUGLE_BINFMT_LDPRELOAD 1
/* 1 if __attribute__((constructor)) may safely load new libraries
 * 0 if not
 */
# define BUGLE_BINFMT_CONSTRUCTOR_LTDL 1
#endif
#if BUGLE_BINFMT_PE
# define BUGLE_BINFMT_SYMBOL_BY_DSO 1
# define BUGLE_BINFMT_LDPRELOAD 0
# define BUGLE_BINFMT_CONSTRUCTOR_LTDL 0
#endif

#if !defined(BUGLE_BINFMT_SYMBOL_BY_DSO)
# error "Your binary format is unknown. Please update bugle/porting.h"
#endif

#if BUGLE_GLWIN_WGL
# define BUGLE_GLWIN_CONTEXT_DEPENDENT 1
#else
# define BUGLE_GLWIN_CONTEXT_DEPENDENT 0
#endif

/* Win32 doesn't allow select() to be used on pipes. It also does not allow
 * fcntl to be used to do non-blocking I/O. The only way to tell if there is
 * data to be read is to buffer the data in a separate thread and implement
 * an equivalent interface to that thread.
 */
#if BUGLE_OSAPI_WIN32
# define BUGLE_OSAPI_SELECT_BROKEN 1
#else
# define BUGLE_OSAPI_SELECT_BROKEN 0
#endif

#endif /* BUGLE_SRC_PORTING_H */
