Various mingwin patches contributed by Norman Vine.
This commit is contained in:
39
configure.in
39
configure.in
@@ -34,11 +34,6 @@ AC_PROG_RANLIB
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
|
||||
# Check to see if this `configure' is being run in the `Cygwin32' environment
|
||||
AC_CYGWIN
|
||||
AC_MINGW32
|
||||
AC_EXEEXT
|
||||
|
||||
AR="ar"
|
||||
OS=`uname -s`
|
||||
if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
|
||||
@@ -102,19 +97,31 @@ AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
|
||||
dnl Check for MS Windows environment
|
||||
AC_CHECK_HEADER(windows.h)
|
||||
|
||||
if test "x$HOSTTYPE" != "xmacintosh" ; then
|
||||
AC_EGREP_CPP(yes,
|
||||
[#ifdef __MINGW32__
|
||||
yes
|
||||
#endif
|
||||
],is_mingw=yes, is_mingw=no)
|
||||
|
||||
echo "IS_MINGW = "$is_mingw
|
||||
AM_CONDITIONAL(IS_MINGW, test $is_mingw="yes")
|
||||
|
||||
AC_EGREP_CPP(yes,
|
||||
[#ifdef __CYGWIN__
|
||||
yes
|
||||
#endif
|
||||
],is_cygwin=yes, is_cygwin=no)
|
||||
|
||||
echo "IS_CYGWIN = "$is_cygwin
|
||||
AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin="yes")
|
||||
|
||||
if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
|
||||
dnl extra library and include directories
|
||||
EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
|
||||
|
||||
if test -d /opt/X11R6 ; then
|
||||
EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
|
||||
fi
|
||||
|
||||
if test "x$ac_cv_header_windows_h" = "xyes" ; then
|
||||
if test -d /usr/mingw/usr ; then
|
||||
EXTRA_DIRS="$EXTRA_DIRS /usr/mingw/usr"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
|
||||
@@ -141,10 +148,6 @@ null_LIBS="$LIBS"
|
||||
|
||||
AC_CHECK_LIB(m, cos)
|
||||
|
||||
if test "x$ac_cv_mingw32" = "xyes" ; then
|
||||
LIBS="$LIBS -lwsock32"
|
||||
fi
|
||||
|
||||
base_LIBS="$LIBS"
|
||||
|
||||
dnl Thread related checks
|
||||
@@ -240,8 +243,8 @@ else
|
||||
|
||||
LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
|
||||
LIBS="$LIBS -luser32 -lgdi32"
|
||||
if test "x$ac_cv_mingw32" = "xyes" ; then
|
||||
LIBS="$LIBS -wsock32"
|
||||
if test "x$is_mingw" = "xyes" ; then
|
||||
EXTRA_DIRS="${EXTRA_DIRS}"
|
||||
fi
|
||||
echo "Will link apps with $LIBS"
|
||||
fi
|
||||
|
||||
@@ -26,6 +26,12 @@ else
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
endif
|
||||
|
||||
if IS_MINGW
|
||||
NETWORK_LIB = -lwsock32
|
||||
else
|
||||
NETWORK_LIB =
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = decode_binobj socktest lowtest
|
||||
|
||||
socktest_SOURCES = socktest.cxx
|
||||
@@ -51,4 +57,4 @@ decode_binobj_LDADD = \
|
||||
$(top_builddir)/simgear/misc/libsgmisc.a \
|
||||
$(top_builddir)/simgear/debug/libsgdebug.a \
|
||||
$(top_builddir)/simgear/xml/libsgxml.a \
|
||||
-lz
|
||||
$(NETWORK_LIB) -lz
|
||||
|
||||
@@ -41,6 +41,10 @@ int main() {
|
||||
if ( s.readline( buf, 256 ) > 0 ) {
|
||||
cout << "result = " << buf;
|
||||
}
|
||||
#ifdef __MINGW32__
|
||||
Sleep(100);
|
||||
#else
|
||||
sleep(1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,13 @@
|
||||
#ifndef _SG_INLINES_H
|
||||
#define _SG_INLINES_H
|
||||
|
||||
// return the sign of a value
|
||||
template <class T>
|
||||
inline const int SG_SIGN(const T x) {
|
||||
return x < T(0) ? -1 : 1;
|
||||
}
|
||||
|
||||
// return the minimum of two values
|
||||
template <class T>
|
||||
inline const T SG_MIN2(const T a, const T b) {
|
||||
return a < b ? a : b;
|
||||
@@ -44,6 +46,7 @@ inline const T SG_MIN3( const T a, const T b, const T c) {
|
||||
return (a < b ? SG_MIN2 (a, c) : SG_MIN2 (b, c));
|
||||
}
|
||||
|
||||
// return the maximum of two values
|
||||
template <class T>
|
||||
inline const T SG_MAX2(const T a, const T b) {
|
||||
return a > b ? a : b;
|
||||
@@ -55,10 +58,47 @@ inline const T SG_MAX3 (const T a, const T b, const T c) {
|
||||
return (a > b ? SG_MAX2 (a, c) : SG_MAX2 (b, c));
|
||||
}
|
||||
|
||||
//
|
||||
// return the minimum and maximum of three values
|
||||
template <class T>
|
||||
inline void SG_MIN_MAX3 ( T &min, T &max, const T a, const T b, const T c) {
|
||||
if( a > b ) {
|
||||
if( a > c ) {
|
||||
max = a;
|
||||
min = SG_MIN2 (b, c);
|
||||
} else {
|
||||
max = c;
|
||||
min = SG_MIN2 (a, b);
|
||||
}
|
||||
} else {
|
||||
if( b > c ) {
|
||||
max = b;
|
||||
min = SG_MIN2 (a, c);
|
||||
} else {
|
||||
max = c;
|
||||
min = SG_MIN2 (a, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// swap two values
|
||||
template <class T>
|
||||
inline void SG_SWAP( T &a, T &b) {
|
||||
T c = a; a = b; b = c;
|
||||
}
|
||||
|
||||
// clamp a value to lie between min and max
|
||||
template <class T>
|
||||
inline void SG_CLAMP_RANGE(T &x, const T min, const T max ) {
|
||||
if ( x < min ) { x = min; }
|
||||
if ( x > max ) { x = max; }
|
||||
}
|
||||
|
||||
// normalize a value to lie between min and max
|
||||
template <class T>
|
||||
inline void SG_NORMALIZE_RANGE( T &val, const T min, const T max ) {
|
||||
T step = max - min;
|
||||
while( val >= max ) val -= step;
|
||||
while( val < min ) val += step;
|
||||
};
|
||||
|
||||
#endif // _SG_INLINES_H
|
||||
|
||||
@@ -363,14 +363,11 @@ double sgTimeCurrentMJD( long int warp ) {
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
struct tm m_gmt; // copy of system gmtime(&time_t) structure
|
||||
struct tm *gmt = &m_gmt;
|
||||
#else
|
||||
struct tm *gmt;
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
tm * gmt = &m_gmt;
|
||||
#endif
|
||||
|
||||
// get current Unix calendar time (in seconds)
|
||||
// warp += warp_delta;
|
||||
time_t cur_time = time(NULL) + warp;
|
||||
|
||||
Reference in New Issue
Block a user