goat3dgfx

diff configure @ 32:7f0aed0fe289

uberized the configure script
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Mar 2014 17:40:51 +0200
parents 0ac499409edd
children
line diff
     1.1 --- a/configure	Sun Mar 02 04:20:00 2014 +0200
     1.2 +++ b/configure	Sun Mar 02 17:40:51 2014 +0200
     1.3 @@ -113,13 +113,14 @@
     1.4  
     1.5  		libgl='-framework OpenGL'
     1.6  	else
     1.7 -		emit '#include <GL/gl.h>'
     1.8 -
     1.9  		if uname -s | grep MINGW; then
    1.10  			libgl='-lopengl32 -lglu32'
    1.11 +			emit '#include <windows.h>'
    1.12  		else
    1.13  			libgl='-lGL -lGLU'
    1.14  		fi
    1.15 +
    1.16 +		emit '#include <GL/gl.h>'
    1.17  	fi
    1.18  	emit 'int main() { return 0; }'
    1.19  
    1.20 @@ -168,6 +169,31 @@
    1.21  	rm -f $tmpfile_bin $tmpfile_src
    1.22  }
    1.23  
    1.24 +check_lib()
    1.25 +{
    1.26 +	libname=$1
    1.27 +	hdr=$2
    1.28 +	lib=-l$libname
    1.29 +	tmpfile_bin=${tmpfile_prefix}check_$libname
    1.30 +	tmpfile_src=${tmpfile_bin}.cc
    1.31 +
    1.32 +	echo -n "checking for $libname ... "
    1.33 +
    1.34 +	begin_emit $tmpfile_src
    1.35 +	emit "#include <${hdr}>"
    1.36 +	emit 'int main() {}'
    1.37 +
    1.38 +	if ! c++ -o $tmpfile_bin $tmpfile_src $lib -lpthread >$build_log 2>&1; then
    1.39 +		echo not found!
    1.40 +		exit 1
    1.41 +	else
    1.42 +		echo ok
    1.43 +	fi
    1.44 +
    1.45 +	LDFLAGS="$LDFLAGS $lib"
    1.46 +	rm -f $tmpfile_bin $tmpfile_src
    1.47 +}
    1.48 +
    1.49  gen_config()
    1.50  {
    1.51  	echo "generating: src/config.h ..."
    1.52 @@ -227,6 +253,12 @@
    1.53  check_glut
    1.54  check_glew
    1.55  if $vr; then check_ovr; fi
    1.56 +check_lib vmath vmath/vmath.h
    1.57 +check_lib imago imago2.h
    1.58 +check_lib anim anim/anim.h
    1.59 +check_lib psys psys/psys.h
    1.60 +check_lib resman resman.h
    1.61 +check_lib goat3d goat3d.h
    1.62  
    1.63  gen_makefile
    1.64  gen_config