1
0
Fork 0

MINGW patch from Benot Laniel

This commit is contained in:
fredb 2010-01-23 22:26:30 +00:00 committed by Tim Moore
parent 2a29c8c604
commit 00e9ad3055
27 changed files with 124 additions and 58 deletions

View file

@ -17,6 +17,7 @@ AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LN_S
@ -216,7 +217,6 @@ if test "x$with_threads" = "xyes"; then
CFLAGS="$CFLAGS -D_REENTRANT"
fi
AC_CHECK_HEADER(pthread.h)
AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
dnl Used by JSBSim to conditionally compile in fgfs interface code
AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
@ -276,6 +276,7 @@ if test "x$ac_cv_header_pthread_h" = "xyes"; then
if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
CXXFLAGS="-pthread $CXXFLAGS"
CFLAGS="-pthread $CFLAGS"
LIBS="-lsgthreads $LIBS"
fi
fi
@ -404,7 +405,7 @@ case "${host}" in
dnl CygWin under Windoze.
INCLUDES="$INCLUDES -I/usr/local/include/"
LIBS="$LIBS -L/usr/local/lib"
AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal ] )
AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
openal_LIBS="$LIBS"
@ -681,7 +682,7 @@ case "${host}" in
AC_CHECK_LIB(osgViewerd,osgViewerGetVersion)
AC_CHECK_LIB(osgSimd,osgSimGetVersion)
AC_CHECK_LIB(osgParticled,osgParticleGetVersion)
LIBS="$LIBS -losgFXd"
LIBS="$LIBS -losgFXd $opengl_LIBS"
else
AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
AC_CHECK_LIB(osg,osgGetVersion)
@ -692,7 +693,7 @@ case "${host}" in
AC_CHECK_LIB(osgViewer,osgViewerGetVersion)
AC_CHECK_LIB(osgSim,osgSimGetVersion)
AC_CHECK_LIB(osgParticle,osgParticleGetVersion)
LIBS="$LIBS -losgFX"
LIBS="$LIBS -losgFX $opengl_LIBS"
fi
;;
esac
@ -718,6 +719,41 @@ AC_COMPILE_IFELSE(
[AC_DEFINE([HAVE_CULLSETTINGS_CLEAR_MASK],1,[define if OSG has CullSettings::CLEAR_MASK])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# Special handling for static version of OSG
if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_LIBRARY_STATIC" 2>/dev/null`" ; then
saved_LIBS="$LIBS"
LIBS=""
#***** Check image support (needed for static build) *****
AC_SEARCH_LIBS([jpeg_read_header], [jpeg], [CPPFLAGS="$CPPFLAGS -DOSG_JPEG_ENABLED"])
AC_SEARCH_LIBS([png_read_image], [png 'png -lz'], [CPPFLAGS="$CPPFLAGS -DOSG_PNG_ENABLED"])
AC_SEARCH_LIBS([TIFFOpen], [tiff], [CPPFLAGS="$CPPFLAGS -DOSG_TIFF_ENABLED"])
img_LIBS="$LIBS"
LIBS="$saved_LIBS"
if test "x$with_osg" != "x" ; then
osg_prefix="$with_osg"
else
osg_prefix="/usr"
fi
PKG_CHECK_EXISTS([openscenegraph], [osg_version="`$PKG_CONFIG --modversion openscenegraph 2>/dev/null`"])
LIBS="-L$osg_prefix/lib/osgPlugins-$osg_version -losgdb_bmp -losgdb_dds -losgdb_hdr -losgdb_pic -losgdb_pnm -losgdb_rgb -losgdb_tga \
-losgdb_3ds -losgdb_ac -losgdb_ive -losgdb_osg -losgdb_txf \
-losgVolume -losgTerrain $LIBS -losgUtil"
if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_JPEG_ENABLED" 2>/dev/null`" ; then
LIBS="$LIBS -losgdb_jpeg"
fi
if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_PNG_ENABLED" 2>/dev/null`" ; then
LIBS="$LIBS -losgdb_png"
fi
if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_TIFF_ENABLED" 2>/dev/null`" ; then
LIBS="$LIBS -losgdb_tiff"
fi
LIBS="$LIBS $img_LIBS"
fi
AC_LANG_POP
dnl Check for system installed zlib

View file

@ -61,7 +61,7 @@ extern void fgDumpSnapShotWrapper();
extern void fgHiResDumpWrapper();
extern void fgHiResDump();
#endif
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
#if defined( _WIN32 ) && !defined(__MINGW32__)
extern void printScreen();
#endif
extern void helpCb();

View file

@ -51,12 +51,12 @@
#include <Main/viewmgr.hxx>
#include <GUI/new_gui.hxx>
#if defined( WIN32 ) && !defined( __CYGWIN__ ) && !defined(__MINGW32__)
#ifdef _WIN32
# include <shellapi.h>
# if !defined(__MINGW32__)
# include <simgear/screen/win32-printer.h>
# include <simgear/screen/GlBitmaps.h>
#endif
#ifdef __MINGW32__
#include <shellapi.h>
# endif
#endif
#include "gui.h"
@ -75,7 +75,7 @@ const __fg_gui_fn_t __fg_gui_fn[] = {
{"dumpHiResSnapShot", fgHiResDumpWrapper},
#endif
{"dumpSnapShot", fgDumpSnapShotWrapper},
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
#if defined( _WIN32 ) && !defined(__MINGW32__)
{"printScreen", printScreen},
#endif
// Help
@ -170,7 +170,7 @@ void helpCb ()
SGPath path( globals->get_fg_root() );
path.append( "Docs/index.html" );
#if !defined(WIN32)
#ifndef _WIN32
command = globals->get_browser();
string::size_type pos;
@ -182,7 +182,7 @@ void helpCb ()
command += " &";
system( command.c_str() );
#else // WIN32
#else // _WIN32
// Look for favorite browser
char Dummy[1024], ExecName[1024], browserParameter[1024];
@ -404,7 +404,7 @@ void fgHiResDump()
#endif // #if defined( TR_HIRES_SNAP)
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
#if defined( _WIN32 ) && !defined(__MINGW32__)
void rotateView( double roll, double pitch, double yaw )
{
@ -441,7 +441,7 @@ GLubyte *hiResScreenCapture( int multiplier )
}
#endif
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
#if defined( _WIN32 ) && !defined(__MINGW32__)
// win32 print screen function
void printScreen () {
int mouse = fgGetMouseCursor();
@ -455,7 +455,7 @@ void printScreen () {
fgSetMouseCursor(mouse);
}
#endif // #ifdef WIN32
#endif // #ifdef _WIN32
void fgDumpSnapShotWrapper () {

View file

@ -36,7 +36,7 @@ do_hires_snapshot_dialog (const SGPropertyNode * arg)
}
#endif // TR_HIRES_SNAP
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
#if defined( _WIN32 ) && !defined(__MINGW32__)
extern void printScreen ();
static bool
do_print_dialog (const SGPropertyNode * arg)
@ -61,7 +61,7 @@ static struct {
#if defined(TR_HIRES_SNAP)
{ "old-hires-snapshot-dialog", do_hires_snapshot_dialog },
#endif
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
#if defined( _WIN32 ) && !defined(__MINGW32__)
{ "old-print-dialog", do_print_dialog },
#endif
{ "old-help-dialog", do_help_dialog },

View file

@ -2,8 +2,11 @@
// Alterations: Copyright C. Hotchkiss 1996
//
// $Log$
// Revision 1.1 2002/09/10 01:14:04 curt
// Initial revision
// Revision 1.2 2010/01/23 22:26:52 fredb
// MINGW patch from Benoît Laniel
//
// Revision 1.1.1.1 2002-09-10 01:14:04 curt
// Initial revision of FlightGear-0.9.0
//
// Revision 1.2 2001/05/16 21:27:59 curt
// Added David Megginson's patch for reconfigurable keyboard bindings.
@ -75,11 +78,11 @@ typedef long LONG ; // 32-bit signed data
typedef unsigned long ULONG ; // 32-bit unsigned data
typedef unsigned short UWORD; // Unsigned 16 bit quantity (WIN=SHORT)
#if !defined(WIN32)
#ifndef _WIN32
typedef signed short WORD; // Signed 16 bit quantity
#endif
typedef BYTE UBYTE; // Used in some 3rd party code
#ifndef WIN32
#ifndef _WIN32
typedef int BOOLEAN; //
#endif

View file

@ -47,7 +47,7 @@ js_demo_LDADD = $(js_demo_PLIB_LIBS) $(base_LIBS) $(joystick_LIBS)
fgjs_SOURCES = fgjs.cxx jsinput.cxx jsinput.h jssuper.cxx jssuper.h
fgjs_LDADD = $(js_demo_PLIB_LIBS) $(base_LIBS) $(joystick_LIBS) \
-lsgprops -lsgmisc -lsgio -lsgdebug -lsgstructure -lsgxml -lz
-lsgprops -lsgmisc -lsgio -lsgdebug -lsgstructure -lsgxml -lz $(network_LIBS)
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/src/Main \
$(libInput_Event_INCLUDES)

View file

@ -28,8 +28,8 @@
#include <simgear/compiler.h>
#if defined( _MSC_VER ) || defined( __MINGW32__ )
# include <Winsock2.h>
#ifdef _WIN32
# include <winsock2.h>
#endif
#include <math.h>
@ -338,9 +338,9 @@ string getFGRoot ( int argc, char **argv ) {
// find fg-root any other way.
if ( root.empty() ) {
#if defined( __CYGWIN__ )
root = "/FlightGear";
#elif defined( WIN32 )
root = "\\FlightGear";
root = "../data";
#elif defined( _WIN32 )
root = "..\\data";
#elif defined(OSX_BUNDLE)
/* the following code looks for the base package directly inside
the application bundle. This can be changed fairly easily by

View file

@ -98,7 +98,7 @@ int main ( int, char ** )
/* give other processes a chance */
#ifdef WIN32
#ifdef _WIN32
Sleep ( 1 ) ;
#elif defined(sgi)
sginap ( 1 ) ;

View file

@ -9,12 +9,6 @@ else
SP_FDM_LIBS =
endif
if WITH_THREADS
THREAD_LIBS = -lsgthreads $(thread_LIBS)
else
THREAD_LIBS =
endif
if WITH_EVENTINPUT
EVENT_LIBS = $(eventinput_LIBS)
else
@ -119,7 +113,7 @@ fgfs_LDADD = \
-lsgserial -lsgstructure -lsgenvironment \
$(fgfs_PLIB_LIBS) \
$(OSG_LIBS) \
$(THREAD_LIBS) \
$(thread_LIBS) \
$(network_LIBS) \
-lz \
$(opengl_LIBS) \

View file

@ -183,7 +183,7 @@ int main ( int argc, char **argv ) {
}
initFPE();
#endif
#if !defined( _MSC_VER ) && !defined( __MINGW32__ )
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif

View file

@ -189,7 +189,7 @@ do_exit (const SGPropertyNode * arg)
fgSetBool("/sim/signals/exit", true);
if (fgGetBool("/sim/startup/save-on-exit")) {
#ifdef _MSC_VER
#ifdef _WIN32
char* envp = ::getenv( "APPDATA" );
if ( envp != NULL ) {
SGPath config( envp );

View file

@ -32,12 +32,12 @@
#if defined( unix ) || defined( __CYGWIN__ )
# include <unistd.h> // for gethostname()
#endif
#if defined( _MSC_VER) || defined(__MINGW32__)
#ifdef _WIN32
# include <direct.h> // for getcwd()
# define getcwd _getcwd
# include <io.h> // isatty()
# define isatty _isatty
# include "Winsock2.h" // for gethostname()
# include "winsock2.h" // for gethostname()
#endif
// work around a stdc++ lib bug in some versions of linux, but doesn't
@ -269,9 +269,9 @@ bool fgInitFGRoot ( int argc, char **argv ) {
// find fg-root any other way.
if ( root.empty() ) {
#if defined( __CYGWIN__ )
root = "/FlightGear";
#elif defined( WIN32 )
root = "\\FlightGear";
root = "../data";
#elif defined( _WIN32 )
root = "..\\data";
#elif defined(__APPLE__)
/*
The following code looks for the base package inside the application
@ -585,7 +585,7 @@ bool fgInitConfig ( int argc, char **argv ) {
}
SGPropertyNode autosave;
#if defined( _MSC_VER ) || defined( __MINGW32__ )
#ifdef _WIN32
char *envp = ::getenv( "APPDATA" );
if (envp != NULL ) {
SGPath config( envp );

View file

@ -59,6 +59,35 @@
#include "WindowBuilder.hxx"
#include "WindowSystemAdapter.hxx"
// Static linking of OSG needs special macros
#ifdef OSG_LIBRARY_STATIC
#include <osgDB/Registry>
USE_GRAPHICSWINDOW();
// Image formats
USE_OSGPLUGIN(bmp);
USE_OSGPLUGIN(dds);
USE_OSGPLUGIN(hdr);
USE_OSGPLUGIN(pic);
USE_OSGPLUGIN(pnm);
USE_OSGPLUGIN(rgb);
USE_OSGPLUGIN(tga);
#ifdef OSG_JPEG_ENABLED
USE_OSGPLUGIN(jpeg);
#endif
#ifdef OSG_PNG_ENABLED
USE_OSGPLUGIN(png);
#endif
#ifdef OSG_TIFF_ENABLED
USE_OSGPLUGIN(tiff);
#endif
// Model formats
USE_OSGPLUGIN(3ds);
USE_OSGPLUGIN(ac);
USE_OSGPLUGIN(ive);
USE_OSGPLUGIN(osg);
USE_OSGPLUGIN(txf);
#endif
// fg_os implementation using OpenSceneGraph's osgViewer::Viewer class
// to create the graphics window and run the event/update/render loop.

View file

@ -783,7 +783,7 @@ static void fgIdleFunction ( void ) {
# if defined( __CYGWIN__ )
string command = "start /m `cygpath -w " + mp3file.str() + "`";
# elif defined( WIN32 )
# elif defined( _WIN32 )
string command = "start /m " + mp3file.str();
# else
string command = "mpg123 " + mp3file.str() + "> /dev/null 2>&1";

View file

@ -32,7 +32,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h> //snprintf
#if defined( _MSC_VER ) || defined(__MINGW32__)
#ifdef _WIN32
# include <io.h> //lseek, read, write
#endif

View file

@ -348,9 +348,7 @@ bool FGATCOutput::open( int lock_fd ) {
ATCRelease( lock_fd );
#if defined( _MSC_VER )
ulMilliSecondSleep(33);
#elif defined (WIN32) && !defined(__CYGWIN__)
#ifdef _WIN32
Sleep (33);
#else
usleep(33);

View file

@ -39,7 +39,7 @@
#if defined( _MSC_VER )
# include <windows.h>
#elif defined( __MINGW32__ )
# include <Winsock2.h>
# include <winsock2.h>
#else
# include <netinet/in.h> // htonl() ntohl()
#endif

View file

@ -42,7 +42,7 @@
#if defined( _MSC_VER )
# include <windows.h>
#elif defined( __MINGW32__ )
# include <Winsock2.h>
# include <winsock2.h>
#else
# include <netinet/in.h> // htonl() ntohl()
#endif

View file

@ -39,8 +39,10 @@
#include "native_gui.hxx"
// FreeBSD works better with this included last ... (?)
#if defined(WIN32) && !defined(__CYGWIN__)
#if defined( _MSC_VER )
# include <windows.h>
#elif defined( __MINGW32__ )
# include <winsock2.h>
#else
# include <netinet/in.h> // htonl() ntohl()
#endif

View file

@ -415,7 +415,7 @@ static naRef f_parsexml(naContext c, naRef me, int argc, naRef* args)
// Return UNIX epoch time in seconds.
static naRef f_systime(naContext c, naRef me, int argc, naRef* args)
{
#ifdef WIN32
#ifdef _WIN32
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
double t = (4294967296.0 * ft.dwHighDateTime + ft.dwLowDateTime);

View file

@ -2,7 +2,7 @@
# include <config.h>
#endif
#if !defined( _MSC_VER ) && !defined( __MINGW32__ )
#ifndef _WIN32
# include <strings.h> // for bzero()
#else
# define bzero(a,b) memset(a,0,b)

View file

@ -29,6 +29,10 @@
#include <windows.h>
#endif
#ifdef __MINGW32__
#include <time.h>
#include <unistd.h>
#endif
#include <stdlib.h> // atoi() atof() abs() system()

View file

@ -8,7 +8,7 @@ fgadmin_SOURCES = \
main.cxx \
untarka.c untarka.h
fgadmin_LDADD = -lsgmisc -lplibul -lz
fgadmin_LDADD = -lsgmisc -lsgdebug -lplibul -lz
fgadmin.cxx fgadmin.h: fgadmin.fl
fluid -c fgadmin.fl

View file

@ -26,7 +26,7 @@
#include <set>
#include <sys/stat.h>
#ifdef _MSC_VER
#ifdef _WIN32
# include <direct.h>
#endif

View file

@ -52,7 +52,7 @@
*/
#undef DOSISH
#if defined(WIN32) || defined(__MINGW32__) || defined(__CYGWIN__) || MSC_VER > 1000
#ifdef WIN32
# include <windows.h>
# define DOSISH 1
# undef __STRICT_ANSI__

View file

@ -20,4 +20,4 @@ fgviewer_SOURCES = fgviewer.cxx
fgviewer_LDADD = \
-lsgtgdb -lsgmaterial -lsgmodel -lsgbvh -lsgutil -lsgio -lsgbucket \
-lsgmath -lsgprops -lsgdebug -lsgmisc -lsgxml -lsgstructure \
$(fgviewer_PLIB_LIBS) $(OSG_LIBS) $(opengl_LIBS) $(THREAD_LIBS) -lz
$(fgviewer_PLIB_LIBS) $(OSG_LIBS) $(opengl_LIBS) $(thread_LIBS) -lz

View file

@ -126,7 +126,7 @@ int main ( int argc, char ** argv )
/* give other processes a chance */
#ifdef WIN32
#ifdef _WIN32
Sleep ( 1 ) ;
#elif defined(sgi)
sginap ( 1 ) ;