fix build on IRIX 6.2 with MIPSpro

master
John Tsiombikas 2025-04-04 12:32:38 +03:00
rodzic a75eb7d00d
commit bcc2e295d1
5 zmienionych plików z 62 dodań i 11 usunięć

Wyświetl plik

@ -10,7 +10,7 @@ libpaths = -L/usr/local/lib -L/usr/X11R6/lib -L/opt/homebrew/lib
CC ?= gcc
AR ?= ar
CFLAGS = $(opt) $(dbg) -std=c89 $(pic) -pedantic -Wall -fno-strict-aliasing $(incpaths) $(user_cflags)
CFLAGS = $(cc_cflags) $(opt) $(dbg) $(pic) $(incpaths) $(user_cflags)
LDFLAGS = $(libpaths) $(user_ldflags) $(xlib) -lm
ifeq ($(shell uname -s), Darwin)
@ -23,7 +23,6 @@ else
soname = $(devlink).$(so_major)
lib_so = $(soname).$(so_minor)
shared = -shared -Wl,-soname,$(soname)
pic = -fPIC
endif

54
configure vendored
Wyświetl plik

@ -1,6 +1,22 @@
#!/bin/sh
echo 'configuring spacenav library...'
if [ -z "$CC" ]; then
CC=cc
fi
cfgtest_src=.cfgtest.c
run_test() {
$CC -o .cfgtest $cfgtest_src >cfgtest.log 2>&1
if [ $? != 0 ]; then
echo "failed to compile test program, see cfgtest.log" >&2
exit 1
fi
./.cfgtest && cfgtest_result=0 || cfgtest_result=1
rm -f .cfgtest $cfgtest_src cfgtest.log
return $cfgtest_result
}
PREFIX=/usr/local
OPT=yes
@ -27,7 +43,7 @@ libdir=lib
# libdir=lib64
#fi
for arg; do
for arg in $*; do
case "$arg" in
--prefix=*)
value=`echo $arg | sed 's/--prefix=//'`
@ -65,6 +81,19 @@ for arg; do
esac
done
sys=`uname -s | sed 's/MINGW.*/mingw/'`
# check if CC is gcc
echo 'int main(void) {' >$cfgtest_src
echo '#ifdef __GNUC__' >>$cfgtest_src
echo ' return 0;' >>$cfgtest_src
echo '#endif' >>$cfgtest_src
echo ' return 1; }' >>$cfgtest_src
run_test && cc_is_gcc=true || cc_is_gcc=false
# check if CC is MIPSpro
$CC -version 2>&1 | grep MIPSpro >/dev/null && cc_is_mipspro=true || cc_is_mipspro=false
echo " prefix: $PREFIX"
echo " optimize for speed: $OPT"
echo " include debugging symbols: $DBG"
@ -96,11 +125,15 @@ if [ -n "$LDFLAGS" ]; then
fi
if [ "$DBG" = 'yes' ]; then
echo 'dbg = -g' >>Makefile
echo 'dbg = -g3' >>Makefile
fi
if [ "$OPT" = 'yes' ]; then
echo 'opt = -O3' >>Makefile
if $cc_is_gcc; then
echo 'opt = -O2 -fno-strict-aliasing' >>Makefile
else
echo 'opt = -O2' >>Makefile
fi
fi
if [ "$X11" = 'yes' ]; then
@ -108,6 +141,19 @@ if [ "$X11" = 'yes' ]; then
echo 'xlib = -lX11' >>Makefile
fi
if $cc_is_gcc; then
echo 'cc_cflags = -std=c89 -pedantic -Wall -MMD' >>Makefile
fi
if [ "$sys" != mingw -a "$sys" != Darwin ]; then
if $cc_is_mipspro; then
echo 'pic = -KPIC' >>Makefile
else
echo 'pic = -fPIC' >>Makefile
fi
fi
cat "$srcdir/Makefile.in" >>Makefile
# create spnav_config.h

Wyświetl plik

@ -5,7 +5,7 @@ incdir = -I../.. -I../../src -I/usr/local/include -I/usr/X11R6/include \
-I/opt/homebrew/include
libdir = -L../.. -L/usr/local/lib -L/usr/X11R6/lib -L/opt/homebrew/lib
CFLAGS = -pedantic -Wall -O3 $(incdir)
CFLAGS = -O2 $(incdir)
LDFLAGS = $(libdir) -lGL -lGLU -lspnav -lX11 -lm
$(bin): $(obj)

Wyświetl plik

@ -16,6 +16,12 @@
#include <spnav.h>
#include "xwin.h"
#ifndef GL_VERSION_1_1
#define glGenTextures glGenTexturesEXT
#define glDeleteTextures glDeleteTexturesEXT
#define glBindTexture glBindTextureEXT
#endif
#define GRID_REP 60
#define GRID_SZ 200
#define GRID_RES 7

Wyświetl plik

@ -24,10 +24,10 @@ int create_xwin(const char *title, int xsz, int ysz)
int attr[] = {
GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
None
};