goat3dgfx

changeset 32:7f0aed0fe289

uberized the configure script
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Mar 2014 17:40:51 +0200
parents 3ba80928b530
children 3eb6c8f89fe1
files Makefile.in configure
diffstat 2 files changed, 36 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/Makefile.in	Sun Mar 02 04:20:00 2014 +0200
     1.2 +++ b/Makefile.in	Sun Mar 02 17:40:51 2014 +0200
     1.3 @@ -28,11 +28,11 @@
     1.4  inc = -Isrc -Isrc/vr
     1.5  warn = -Wall
     1.6  
     1.7 -libs_ldflags = -limago -lanim -lpsys -lvmath -lresman
     1.8 +libs_ldflags =
     1.9  
    1.10  CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(cfg_cflags) $(libs_cflags)
    1.11  CXXFLAGS =  $(CFLAGS)
    1.12 -LDFLAGS = $(cfg_ldflags) $(libs_ldflags) -lgoat3d
    1.13 +LDFLAGS = $(cfg_ldflags) $(libs_ldflags)
    1.14  
    1.15  .PHONY: all
    1.16  all: $(lib_so) $(lib_a)
     2.1 --- a/configure	Sun Mar 02 04:20:00 2014 +0200
     2.2 +++ b/configure	Sun Mar 02 17:40:51 2014 +0200
     2.3 @@ -113,13 +113,14 @@
     2.4  
     2.5  		libgl='-framework OpenGL'
     2.6  	else
     2.7 -		emit '#include <GL/gl.h>'
     2.8 -
     2.9  		if uname -s | grep MINGW; then
    2.10  			libgl='-lopengl32 -lglu32'
    2.11 +			emit '#include <windows.h>'
    2.12  		else
    2.13  			libgl='-lGL -lGLU'
    2.14  		fi
    2.15 +
    2.16 +		emit '#include <GL/gl.h>'
    2.17  	fi
    2.18  	emit 'int main() { return 0; }'
    2.19  
    2.20 @@ -168,6 +169,31 @@
    2.21  	rm -f $tmpfile_bin $tmpfile_src
    2.22  }
    2.23  
    2.24 +check_lib()
    2.25 +{
    2.26 +	libname=$1
    2.27 +	hdr=$2
    2.28 +	lib=-l$libname
    2.29 +	tmpfile_bin=${tmpfile_prefix}check_$libname
    2.30 +	tmpfile_src=${tmpfile_bin}.cc
    2.31 +
    2.32 +	echo -n "checking for $libname ... "
    2.33 +
    2.34 +	begin_emit $tmpfile_src
    2.35 +	emit "#include <${hdr}>"
    2.36 +	emit 'int main() {}'
    2.37 +
    2.38 +	if ! c++ -o $tmpfile_bin $tmpfile_src $lib -lpthread >$build_log 2>&1; then
    2.39 +		echo not found!
    2.40 +		exit 1
    2.41 +	else
    2.42 +		echo ok
    2.43 +	fi
    2.44 +
    2.45 +	LDFLAGS="$LDFLAGS $lib"
    2.46 +	rm -f $tmpfile_bin $tmpfile_src
    2.47 +}
    2.48 +
    2.49  gen_config()
    2.50  {
    2.51  	echo "generating: src/config.h ..."
    2.52 @@ -227,6 +253,12 @@
    2.53  check_glut
    2.54  check_glew
    2.55  if $vr; then check_ovr; fi
    2.56 +check_lib vmath vmath/vmath.h
    2.57 +check_lib imago imago2.h
    2.58 +check_lib anim anim/anim.h
    2.59 +check_lib psys psys/psys.h
    2.60 +check_lib resman resman.h
    2.61 +check_lib goat3d goat3d.h
    2.62  
    2.63  gen_makefile
    2.64  gen_config