1## -*-m4-*- 2 3dnl Process this file with autoconf to produce a configure script. 4 5# FILE: 6# configure.in 7# 8# FUNCTION: 9# implements checks for a variety of system-specific functions 10# 11# Contents: 12# Headers - Autoconf header stuff 13# Variables - Hardcoded variables 14# Programs - Check for programs binaries 15# Functions - Check for functions 16# With - Check for --with/without options 17# Enable - Check for --enable/disable options 18# Libraries - Check for libraries 19# Footer - Autoconf footer stuff 20 21### -------------------------------------------------------------------------- 22### Headers 23### check for various programs, and stuff (do this first because later 24### commands depend on them): 25 26AC_INIT(src/gle.h) 27AM_INIT_AUTOMAKE(gle,3.1.0) 28AM_CONFIG_HEADER(config.h) 29 30AC_PROG_CC 31AC_PROG_INSTALL 32AM_PROG_LIBTOOL 33 34AC_ISC_POSIX 35AC_PROG_MAKE_SET 36AC_HEADER_STDC 37 38AC_CHECK_FUNCS(memcpy) 39 40### -------------------------------------------------------------------------- 41### Variables 42### Set up all the initial variable values... 43 44# We should always see these errors... 45CFLAGS="${CFLAGS} -Wall" 46 47# Strict, or lenient tesselator? 48AC_ARG_ENABLE(lenient-tess, 49 [ --enable-lenient-tess compile for lenient tesselator], 50 AC_DEFINE(LENIENT_TESSELATOR,1), 51 AC_DEFINE(DELICATE_TESSELATOR,1) ) 52 53# Disable texture mapping? 54AC_ARG_ENABLE(auto-texture, 55 [ --disable-auto-texture compile with texture mapping disabled], 56 AC_DEFINE(AUTO_TEXTURE,0), 57 AC_DEFINE(AUTO_TEXTURE,1) ) 58 59# Should we build for old IrisGL? 60AC_ARG_ENABLE(irisgl, 61 [ --enable-irisgl compile for old IrisGL/GL-3.2], 62 AC_DEFINE(GL_32,1), 63 AC_DEFINE(OPENGL_10,1) ) 64 65AC_ARG_ENABLE( debug, 66 [ --enable-debug compile with debugging flags set], 67 CFLAGS="${CFLAGS} -g" 68 LDFLAGS="${LDFLAGS} -g" 69 AC_DEFINE(DEBUG_OUTPUT,1), ) 70 71AC_ARG_ENABLE( profile, 72 [ --enable-profile compile with profiling set], 73 CFLAGS="${CFLAGS} -pg" 74 LDFLAGS="${LDFLAGS} -pg") 75 76AC_ARG_ENABLE( warnings, 77 [ --enable-warnings compile with lots of warnings 78generated], 79 CFLAGS="${CFLAGS} -g -Wall -ansi -pedantic -Wwrite-strings -Wid-clash-31 -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Woverloaded-virtual -Winline -felide-constructors -fnonnull-objects" 80 LDFLAGS="${LDFLAGS} -g -Wall" 81 ) 82 83 84### -------------------------------------------------------------------------- 85### Libraries 86LIBS="$LIBS -lm" 87 88# We're going to set up our own X configure variables. These are only 89# used in side configure. At the end, we use them to set X_LIBS. 90# This allows us to be careful about libarary ordering, in case that's 91# important. 92 93AC_PATH_XTRA 94if test x"$no_x" = xyes; then 95 AC_ERROR([Can not find X11 development headers or libraries.]) 96fi 97 98# AC_CHECK_HEADER(GL/gl.h) 99# AC_CHECK_HEADER(GL/glut.h) 100 101# configure seems to work best when tested subroutines take no arguments 102AC_CHECK_LIB(GL, glGetError, 103 X_LIBS="-lGL $X_LIBS", 104 AC_MSG_ERROR([Cannot find required GL library]), 105 $X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS) 106 107AC_CHECK_LIB(GLU, gluNewQuadric, 108 X_LIBS="-lGLU $X_LIBS", 109 AC_MSG_ERROR([Cannot find required GLU library]), 110 $X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS) 111 112# ---------------------------------------------------------- 113# Newest versions of glut require Xmu, which doesn't show up 114# by default in X_LIBS 115AC_CHECK_LIB(Xmu, XmuLookupStandardColormap, 116 X_LIBS="-lXmu $X_LIBS", 117 AC_MSG_ERROR([Cannot find required Xmu library]), 118 $X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS) 119 120AC_CHECK_LIB(Xi, XListInputDevices, 121 X_LIBS="-lXi -lXext $X_LIBS", 122 AC_MSG_ERROR([Cannot find required Xi (X11 Input Extension) library]), 123 $X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS) 124 125# latest versions of glut also use Xi the XInput extension 126AC_CHECK_LIB(glut, glutSwapBuffers, 127 X_LIBS="-lglut $X_LIBS", 128 AC_MSG_ERROR([Cannot find required glut library]), 129 $X_PRE_LIBS -lXmu $X_LIBS -lX11 $X_EXTRA_LIBS) 130 131 132# This is how to use the variables set by AC_PATH_XTRA: 133# cc @X_CFLAGS@ -c -o foo.o foo.c 134# cc @X_LIBS@ (-lfoo...) @X_PRE_LIBS@ -lX11 @X_EXTRA_LIBS@ 135# (Perhaps X_LIBS should have been called X_LDFLAGS.) 136 137X_LIBS="-lgle $X_LIBS -lXt -lX11" 138 139AC_OUTPUT( 140 Makefile 141 src/Makefile 142 doc/Makefile 143 doc/html/Makefile 144 examples/Makefile 145 man/Makefile 146 ms-visual-c/Makefile 147 ms-visual-c/gle/Makefile 148 swig/Makefile, 149 [ln -sf src GL] 150 ) 151