configure.ac revision 32001f49
132001f49Smrg# Copyright © 2009 Intel Corporation 232001f49Smrg# 332001f49Smrg# Permission is hereby granted, free of charge, to any person obtaining a 432001f49Smrg# copy of this software and associated documentation files (the "Software"), 532001f49Smrg# to deal in the Software without restriction, including without limitation 632001f49Smrg# the rights to use, copy, modify, merge, publish, distribute, sublicense, 732001f49Smrg# and/or sell copies of the Software, and to permit persons to whom the 832001f49Smrg# Software is furnished to do so, subject to the following conditions: 932001f49Smrg# 1032001f49Smrg# The above copyright notice and this permission notice (including the next 1132001f49Smrg# paragraph) shall be included in all copies or substantial portions of the 1232001f49Smrg# Software. 1332001f49Smrg# 1432001f49Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1532001f49Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1632001f49Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1732001f49Smrg# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1832001f49Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1932001f49Smrg# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 2032001f49Smrg# IN THE SOFTWARE. 2132001f49Smrg# 2232001f49Smrg# Authors: 2332001f49Smrg# Eric Anholt <eric@anholt.net> 2432001f49Smrg 2532001f49Smrgdnl Process this file with autoconf to create configure. 2632001f49Smrg 2732001f49SmrgAC_PREREQ([2.59]) 2832001f49SmrgAC_INIT([mesa-demos], [8.2.0], 2932001f49Smrg [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa&component=Demos]) 3032001f49SmrgAC_CANONICAL_HOST 3132001f49Smrg 3232001f49SmrgAM_INIT_AUTOMAKE([dist-bzip2]) 3332001f49Smrg 3432001f49Smrgdnl Check for progs 3532001f49SmrgAC_PROG_CPP 3632001f49SmrgAC_PROG_CC 3732001f49SmrgAC_PROG_CXX 3832001f49SmrgAC_PROG_LIBTOOL 3932001f49SmrgAM_PROG_CC_C_O 4032001f49Smrg 4132001f49SmrgAC_CONFIG_MACRO_DIR([m4]) 4232001f49Smrg 4332001f49Smrg# Enable quiet compiles on automake 1.11. 4432001f49Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 4532001f49Smrg 4632001f49Smrgdnl Make sure the pkg-config macros are defined 4732001f49Smrgm4_ifndef([PKG_PROG_PKG_CONFIG], 4832001f49Smrg [m4_fatal([Could not locate the pkg-config autoconf macros. 4932001f49Smrg These are usually located in /usr/share/aclocal/pkg.m4. If your macros 5032001f49Smrg are in a different location, try setting the environment variable 5132001f49Smrg ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])]) 5232001f49SmrgPKG_PROG_PKG_CONFIG() 5332001f49Smrg 5432001f49Smrgdnl Get the pkg-config definitions for libGL. We include a fallback 5532001f49Smrgdnl path for GL implementation that don't provide a .pc file 5632001f49SmrgPKG_CHECK_MODULES(GL, [gl], [], [ 5732001f49Smrg AC_CHECK_HEADER([GL/gl.h], 5832001f49Smrg [], 5932001f49Smrg AC_MSG_ERROR([GL not found])) 6032001f49Smrg AC_CHECK_LIB([GL], 6132001f49Smrg [glBegin], 6232001f49Smrg [GL_LIBS=-lGL], 6332001f49Smrg AC_MSG_ERROR([GL required])) 6432001f49Smrg ]) 6532001f49Smrg 6632001f49SmrgDEMO_CFLAGS="$DEMO_CFLAGS $GL_CFLAGS" 6732001f49SmrgDEMO_LIBS="$DEMO_LIBS $GL_LIBS" 6832001f49Smrg 6932001f49Smrgdnl Check for GLUT 7032001f49SmrgGLUT_CFLAGS="" 7132001f49SmrgGLUT_LIBS=-lglut 7232001f49Smrgglut_enabled=yes 7332001f49SmrgAC_ARG_WITH([glut], 7432001f49Smrg [AS_HELP_STRING([--with-glut=DIR], 7532001f49Smrg [glut install directory])], 7632001f49Smrg [GLUT_CFLAGS="-I$withval/include" 7732001f49Smrg GLUT_LIBS="-L$withval/lib -lglut"]) 7832001f49SmrgAC_CHECK_HEADER([GL/glut.h], 7932001f49Smrg [], 8032001f49Smrg [glut_enabled=no]) 8132001f49SmrgAC_CHECK_LIB([glut], 8232001f49Smrg [glutInit], 8332001f49Smrg [], 8432001f49Smrg [glut_enabled=no]) 8532001f49Smrg 8632001f49Smrgdnl Check for FreeGLUT 2.6 or later 8732001f49SmrgAC_EGREP_HEADER([glutInitContextProfile], 8832001f49Smrg [GL/freeglut.h], 8932001f49Smrg [AC_DEFINE(HAVE_FREEGLUT)], 9032001f49Smrg []) 9132001f49Smrg 9232001f49Smrgdnl Check for GLEW 9332001f49SmrgPKG_CHECK_MODULES(GLEW, [glew >= 1.5.4]) 9432001f49SmrgDEMO_CFLAGS="$DEMO_CFLAGS $GLEW_CFLAGS" 9532001f49SmrgDEMO_LIBS="$DEMO_LIBS $GLEW_LIBS" 9632001f49Smrg 9732001f49Smrg# LIBS was set by AC_CHECK_LIB above 9832001f49SmrgLIBS="" 9932001f49Smrg 10032001f49SmrgPKG_CHECK_MODULES(GLU, [glu], [], 10132001f49Smrg [AC_CHECK_HEADER([GL/glu.h], 10232001f49Smrg [], 10332001f49Smrg AC_MSG_ERROR([GLU not found])) 10432001f49Smrg AC_CHECK_LIB([GLU], 10532001f49Smrg [gluBeginCurve], 10632001f49Smrg [GLU_LIBS=-lGLU], 10732001f49Smrg AC_MSG_ERROR([GLU required])) ]) 10832001f49Smrg 10932001f49SmrgDEMO_CFLAGS="$DEMO_CFLAGS $GLU_CFLAGS" 11032001f49SmrgDEMO_LIBS="$DEMO_LIBS $GLU_LIBS" 11132001f49Smrg 11232001f49SmrgAC_ARG_ENABLE([egl], 11332001f49Smrg [AS_HELP_STRING([--enable-egl], 11432001f49Smrg [enable EGL library @<:@default=auto@:>@])], 11532001f49Smrg [egl_enabled="$enableval"], 11632001f49Smrg [egl_enabled=auto]) 11732001f49Smrgif test "x$egl_enabled" != "xno"; then 11832001f49Smrg PKG_CHECK_MODULES(EGL, [egl], [egl_enabled=yes], [egl_enabled=no]) 11932001f49Smrgfi 12032001f49SmrgAC_ARG_ENABLE([gles1], 12132001f49Smrg [AS_HELP_STRING([--enable-gles1], 12232001f49Smrg [enable support for OpenGL ES 1.x API @<:@default=auto@:>@])], 12332001f49Smrg [glesv1_enabled="$enableval"], 12432001f49Smrg [glesv1_enabled=auto]) 12532001f49Smrgif test "x$glesv1_enabled" != "xno"; then 12632001f49Smrg PKG_CHECK_MODULES(GLESV1, [glesv1_cm], [glesv1_enabled=yes], [glesv1_enabled=no]) 12732001f49Smrgfi 12832001f49SmrgAC_ARG_ENABLE([gles2], 12932001f49Smrg [AS_HELP_STRING([--enable-gles2], 13032001f49Smrg [enable support for OpenGL ES 2.x API @<:@default=auto@:>@])], 13132001f49Smrg [glesv2_enabled="$enableval"], 13232001f49Smrg [glesv2_enabled=auto]) 13332001f49Smrgif test "x$glesv2_enabled" != "xno"; then 13432001f49Smrg PKG_CHECK_MODULES(GLESV2, [glesv2], [glesv2_enabled=yes], [glesv2_enabled=no]) 13532001f49Smrgfi 13632001f49SmrgAC_ARG_ENABLE([vg], 13732001f49Smrg [AS_HELP_STRING([--enable-vg], 13832001f49Smrg [enable support for OpenVG API @<:@default=auto@:>@])], 13932001f49Smrg [vg_enabled="$enableval"], 14032001f49Smrg [vg_enabled=auto]) 14132001f49Smrgif test "x$vg_enabled" != "xno"; then 14232001f49Smrg PKG_CHECK_MODULES(VG, [vg], [vg_enabled=yes], [vg_enabled=no]) 14332001f49Smrgfi 14432001f49SmrgAC_ARG_ENABLE([osmesa], 14532001f49Smrg [AS_HELP_STRING([--enable-osmesa], 14632001f49Smrg [enable OSMesa library @<:@default=auto@:>@])], 14732001f49Smrg [osmesa_enabled="$enableval"], 14832001f49Smrg [osmesa_enabled=auto]) 14932001f49Smrgif test "x$osmesa_enabled" != "xno"; then 15032001f49Smrg PKG_CHECK_MODULES(OSMESA, [osmesa], [osmesa_enabled=yes], [osmesa_enabled=no]) 15132001f49Smrgfi 15232001f49SmrgAC_ARG_ENABLE([libdrm], 15332001f49Smrg [AS_HELP_STRING([--enable-libdrm], 15432001f49Smrg [enable support for libdrm @<:@default=auto@:>@])], 15532001f49Smrg [drm_enabled="$enableval"], 15632001f49Smrg [drm_enabled=auto]) 15732001f49Smrgif test "x$drm_enabled" != "xno"; then 15832001f49Smrg PKG_CHECK_MODULES(DRM, [libdrm], [drm_enabled=yes], [drm_enabled=no]) 15932001f49Smrgfi 16032001f49Smrgdnl The OSMesa .pc uses OSMesa32, while we want to build with other versions 16132001f49Smrgdnl too. 16232001f49SmrgOSMESA32_LIBS=$OSMESA_LIBS 16332001f49SmrgOSMESA16_LIBS=`echo $OSMESA_LIBS | sed 's|32|16|g'` 16432001f49SmrgOSMESA_LIBS=`echo $OSMESA_LIBS | sed 's|32||g'` 16532001f49Smrg 16632001f49Smrgdnl Compiler macros 16732001f49Smrgcase "$host_os" in 16832001f49Smrglinux*|*-gnu*|gnu*) 16932001f49Smrg DEMO_CFLAGS="$DEMO_CFLAGS -D_GNU_SOURCE -DPTHREADS" 17032001f49Smrg ;; 17132001f49Smrgsolaris*) 17232001f49Smrg DEMO_CFLAGS="$DEFINES -DPTHREADS -DSVR4" 17332001f49Smrg ;; 17432001f49Smrgcygwin*) 17532001f49Smrg DEMO_CFLAGS="$DEFINES -DPTHREADS" 17632001f49Smrg ;; 17732001f49Smrgesac 17832001f49Smrg 17932001f49Smrgdnl Set up C warning flags. Copy of XORG_CWARNFLAGS. 18032001f49Smrgif test "x$GCC" = xyes ; then 18132001f49Smrg CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ 18232001f49Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \ 18332001f49Smrg-Wbad-function-cast" 18432001f49Smrg case `$CC -dumpversion` in 18532001f49Smrg 3.4.* | 4.*) 18632001f49Smrg CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement" 18732001f49Smrg ;; 18832001f49Smrg esac 18932001f49Smrgelse 19032001f49Smrg AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) 19132001f49Smrg if test "x$SUNCC" = "xyes"; then 19232001f49Smrg CWARNFLAGS="-v" 19332001f49Smrg fi 19432001f49Smrgfi 19532001f49SmrgDEMO_CFLAGS="$DEMO_CFLAGS $CWARNFLAGS" 19632001f49Smrg 19732001f49SmrgAC_ARG_ENABLE([x11], 19832001f49Smrg [AS_HELP_STRING([--enable-x11], 19932001f49Smrg [enable support for X11 @<:@default=auto@:>@])], 20032001f49Smrg [x11_enabled="$enableval"], 20132001f49Smrg [x11_enabled=auto]) 20232001f49Smrgif test "x$x11_enabled" != "xno"; then 20332001f49Smrg PKG_CHECK_MODULES(X11, [x11 xext], [x11_enabled=yes], [x11_enabled=no]) 20432001f49Smrgfi 20532001f49Smrg 20632001f49SmrgAC_ARG_ENABLE([wayland], 20732001f49Smrg [AS_HELP_STRING([--enable-wayland], 20832001f49Smrg [enable support for wayland @<:@default=no@:>@])], 20932001f49Smrg [wayland_enabled="$enableval"], 21032001f49Smrg [wayland_enabled=no]) 21132001f49Smrg 21232001f49Smrgif test "x$wayland_enabled" != "xno"; then 21332001f49Smrg PKG_CHECK_MODULES(WAYLAND, [wayland-client wayland-egl], [wayland_enabled=yes], [wayland_enabled=no]) 21432001f49Smrgfi 21532001f49Smrg 21632001f49Smrgdnl GBM is needed for EGL on KMS 21732001f49SmrgAC_ARG_ENABLE([gbm], 21832001f49Smrg [AS_HELP_STRING([--enable-gbm], 21932001f49Smrg [enable support for GBM @<:@default=auto@:>@])], 22032001f49Smrg [gbm_enabled="$enableval"], 22132001f49Smrg [gbm_enabled=auto]) 22232001f49Smrgif test "x$gbm_enabled" != "xno"; then 22332001f49Smrg PKG_CHECK_MODULES(GBM, [gbm], [gbm_enabled=yes], [gbm_enabled=no]) 22432001f49Smrgfi 22532001f49Smrg 22632001f49Smrgdnl FreeType2 is needed by an OpenVG demo 22732001f49SmrgAC_ARG_ENABLE([freetype2], 22832001f49Smrg [AS_HELP_STRING([--enable-freetype2], 22932001f49Smrg [enable support for FreeType2 @<:@default=auto@:>@])], 23032001f49Smrg [freetype2_enabled="$enableval"], 23132001f49Smrg [freetype2_enabled=auto]) 23232001f49Smrgif test "x$freetype2_enabled" != "xno"; then 23332001f49Smrg PKG_CHECK_MODULES(FREETYPE2, [freetype2], [freetype2_enabled=yes], [freetype2_enabled=no]) 23432001f49Smrgfi 23532001f49Smrg 23632001f49Smrgmesa_source_enabled=no 23732001f49SmrgAC_ARG_WITH([mesa-source], 23832001f49Smrg [AS_HELP_STRING([--with-mesa-source=DIR], 23932001f49Smrg [Mesa source directory for finding gl_API.xml])], 24032001f49Smrg [mesa_source_enabled="yes" 24132001f49Smrg mesa_source_dir="$withval"], 24232001f49Smrg [mesa_source_enabled="no"]) 24332001f49SmrgMESA_GLAPI="$mesa_source_dir/src/mapi/glapi/gen" 24432001f49Smrg 24532001f49SmrgAC_ARG_ENABLE([rbug], 24632001f49Smrg [AS_HELP_STRING([--enable-rbug], 24732001f49Smrg [enable support for rbug @<:@default=no@:>@])], 24832001f49Smrg [rbug_enabled="yes"], 24932001f49Smrg [rbug_enabled="no"]) 25032001f49Smrg 25132001f49Smrguse_system_data=no 25232001f49SmrgAC_ARG_WITH([system-data-files], 25332001f49Smrg [AS_HELP_STRING([--with-system-data-files], 25432001f49Smrg [Use system data files for demos (default: no)])], 25532001f49Smrg [use_system_data=yes], []) 25632001f49Smrgif test "x$use_system_data" = xyes; then 25732001f49Smrg demos_data_dir="${datadir}/${PACKAGE}/" 25832001f49Smrgelse 25932001f49Smrg demos_data_dir="../data/" 26032001f49Smrgfi 26132001f49SmrgAC_DEFINE_DIR(DEMOS_DATA_DIR, demos_data_dir, [Data dir for demos]) 26232001f49SmrgAC_DEFINE_UNQUOTED([DEMOS_DATA_DIR], "$DEMOS_DATA_DIR", 26332001f49Smrg [Directory for demos data files]) 26432001f49Smrg 26532001f49Smrgdnl 26632001f49Smrgdnl Program library dependencies 26732001f49Smrgdnl Only libm is added here if necessary as the libraries should 26832001f49Smrgdnl be pulled in by the linker 26932001f49Smrgdnl 27032001f49Smrgcase "$host_os" in 27132001f49Smrgsolaris*) 27232001f49Smrg DEMO_LIBS="$DEMO_LIBS -lX11 -lsocket -lnsl -lm" 27332001f49Smrg ;; 27432001f49Smrgcygwin*) 27532001f49Smrg DEMO_LIBS="$DEMO_LIBS -lX11" 27632001f49Smrg ;; 27732001f49Smrg*) 27832001f49Smrg DEMO_LIBS="$DEMO_LIBS -lm" 27932001f49Smrg ;; 28032001f49Smrgesac 28132001f49Smrg 28232001f49SmrgAC_SUBST([DEMO_CFLAGS]) 28332001f49SmrgAC_SUBST([DEMO_LIBS]) 28432001f49SmrgAC_SUBST([EGL_CFLAGS]) 28532001f49SmrgAC_SUBST([EGL_LIBS]) 28632001f49SmrgAC_SUBST([GLESV1_CFLAGS]) 28732001f49SmrgAC_SUBST([GLESV1_LIBS]) 28832001f49SmrgAC_SUBST([GLESV2_CFLAGS]) 28932001f49SmrgAC_SUBST([GLESV2_LIBS]) 29032001f49SmrgAC_SUBST([GLUT_CFLAGS]) 29132001f49SmrgAC_SUBST([GLUT_LIBS]) 29232001f49SmrgAC_SUBST([X11_CFLAGS]) 29332001f49SmrgAC_SUBST([X11_LIBS]) 29432001f49SmrgAC_SUBST([OSMESA_CFLAGS]) 29532001f49SmrgAC_SUBST([OSMESA_LIBS]) 29632001f49SmrgAC_SUBST([OSMESA16_LIBS]) 29732001f49SmrgAC_SUBST([OSMESA32_LIBS]) 29832001f49SmrgAC_SUBST([MESA_GLAPI]) 29932001f49SmrgAC_SUBST([WAYLAND_CFLAGS]) 30032001f49SmrgAC_SUBST([WAYLAND_LIBS]) 30132001f49Smrg 30232001f49Smrg 30332001f49SmrgAM_CONDITIONAL(HAVE_EGL, test "x$egl_enabled" = "xyes") 30432001f49SmrgAM_CONDITIONAL(HAVE_GLESV1, test "x$glesv1_enabled" = "xyes") 30532001f49SmrgAM_CONDITIONAL(HAVE_GLESV2, test "x$glesv2_enabled" = "xyes") 30632001f49SmrgAM_CONDITIONAL(HAVE_VG, test "x$vg_enabled" = "xyes") 30732001f49SmrgAM_CONDITIONAL(HAVE_GLUT, test "x$glut_enabled" = "xyes") 30832001f49SmrgAM_CONDITIONAL(HAVE_X11, test "x$x11_enabled" = "xyes") 30932001f49SmrgAM_CONDITIONAL(HAVE_GBM, test "x$gbm_enabled" = "xyes") 31032001f49SmrgAM_CONDITIONAL(HAVE_FREETYPE2, test "x$freetype2_enabled" = "xyes") 31132001f49SmrgAM_CONDITIONAL(HAVE_OSMESA, test "x$osmesa_enabled" = "xyes") 31232001f49SmrgAM_CONDITIONAL(HAVE_DRM, test "x$drm_enabled" = "xyes") 31332001f49SmrgAM_CONDITIONAL(HAVE_MESA_SOURCE, test "x$mesa_source_enabled" = "xyes") 31432001f49SmrgAM_CONDITIONAL(HAVE_WAYLAND, test "x$wayland_enabled" = "xyes") 31532001f49SmrgAM_CONDITIONAL(HAVE_RBUG, test "x$rbug_enabled" = "xyes") 31632001f49Smrg 31732001f49SmrgAC_OUTPUT([ 31832001f49Smrg Makefile 31932001f49Smrg src/Makefile 32032001f49Smrg src/demos/Makefile 32132001f49Smrg src/egl/Makefile 32232001f49Smrg src/egl/eglut/Makefile 32332001f49Smrg src/egl/opengl/Makefile 32432001f49Smrg src/egl/opengles1/Makefile 32532001f49Smrg src/egl/opengles2/Makefile 32632001f49Smrg src/egl/openvg/Makefile 32732001f49Smrg src/egl/openvg/trivial/Makefile 32832001f49Smrg src/egl/oes_vg/Makefile 32932001f49Smrg src/fp/Makefile 33032001f49Smrg src/fpglsl/Makefile 33132001f49Smrg src/glsl/Makefile 33232001f49Smrg src/gs/Makefile 33332001f49Smrg src/data/Makefile 33432001f49Smrg src/objviewer/Makefile 33532001f49Smrg src/osdemos/Makefile 33632001f49Smrg src/perf/Makefile 33732001f49Smrg src/rbug/Makefile 33832001f49Smrg src/redbook/Makefile 33932001f49Smrg src/samples/Makefile 34032001f49Smrg src/slang/Makefile 34132001f49Smrg src/tests/Makefile 34232001f49Smrg src/tools/Makefile 34332001f49Smrg src/trivial/Makefile 34432001f49Smrg src/util/Makefile 34532001f49Smrg src/vp/Makefile 34632001f49Smrg src/vpglsl/Makefile 34732001f49Smrg src/wgl/Makefile 34832001f49Smrg src/xdemos/Makefile 34932001f49Smrg]) 350