Skip to content

Commit eb778a3

Browse files
committed
fixed build issues on IRIX with MIPSpro and /bin/sh being the bourne shell
1 parent e06ca85 commit eb778a3

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

configure

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ for arg in $*; do
3333
done
3434

3535
sys=`uname -s | sed 's/MINGW.*/mingw/'`
36+
arch=`uname -m`
3637

3738
testsrc=/tmp/meshfile_cfg_test.c
3839
testbin=/tmp/meshfile_cfg_test
3940
testlog=/tmp/meshfile_cfg_test.log
4041

4142
run_test() {
42-
if ! $CC -o $testbin $testsrc >$testlog 2>&1; then
43+
$CC -o $testbin $testsrc >$testlog 2>&1
44+
if [ $? != 0 ]; then
4345
echo "failed to compile test program, see $testlog" >&2
4446
exit 1
4547
fi
@@ -59,6 +61,9 @@ echo ' return 1;' >>$testsrc
5961
echo '}' >>$testsrc
6062
run_test && cc_is_gcc=true || cc_is_gcc=false
6163

64+
# check if CC is MIPSpro
65+
cc -version 2>&1 | grep MIPSpro >/dev/null && cc_is_mipspro=true || cc_is_mipspro=false
66+
6267
$cc_is_gcc && echo 'compiler is gcc or compatible'
6368
echo "optimizations: $opt"
6469
echo "debug symbols: $dbg"
@@ -70,8 +75,14 @@ echo "PREFIX = $prefix" >>$cfgmk
7075
echo "libdir = $libdir" >>$cfgmk
7176
echo 'src =' `ls src/*.c | sort` >>$cfgmk
7277
echo >>$cfgmk
73-
$opt && echo 'opt = -O3' >>$cfgmk
74-
$dbg && echo 'dbg = -g' >>$cfgmk
78+
79+
if $cc_is_mipspro; then
80+
$opt && echo 'opt = -O2' >>$cfgmk
81+
$dbg && echo 'dbg = -g3' >>$cfgmk
82+
else
83+
$opt && echo 'opt = -O3' >>$cfgmk
84+
$dbg && echo 'dbg = -g' >>$cfgmk
85+
fi
7586

7687
if $cc_is_gcc; then
7788
echo 'warn = -pedantic -Wall -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast' >>$cfgmk
@@ -96,7 +107,12 @@ else
96107
echo 'soname = $(ldname).$(somajor)' >>$cfgmk
97108
echo 'libso = $(ldname).$(somajor).$(sominor)' >>$cfgmk
98109
echo 'shared = -shared -Wl,-soname,$(soname)' >>$cfgmk
99-
echo 'pic = -fPIC' >>$cfgmk
110+
111+
if $cc_is_mipspro; then
112+
echo 'pic = -KPIC' >>$cfgmk
113+
else
114+
echo 'pic = -fPIC' >>$cfgmk
115+
fi
100116
fi
101117

102118

src/fmtjtf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ int mf_save_jtf(const struct mf_meshfile *mf, const struct mf_userio *io)
131131
struct jtf_face face;
132132
struct mf_mesh *mesh;
133133
struct mf_face *mff;
134-
static const mf_vec3 defnorm = {0, 1, 0};
135-
static const mf_vec2 defuv;
134+
static mf_vec3 defnorm = {0, 1, 0};
135+
static mf_vec2 defuv;
136136

137137
total_faces = 0;
138138
for(i=0; i<(unsigned int)mf_num_meshes(mf); i++) {

0 commit comments

Comments
 (0)