configure.ac revision f220fa62
1# Copyright © 2011 Intel Corporation 2# 3# Permission is hereby granted, free of charge, to any person obtaining a 4# copy of this software and associated documentation files (the "Software"), 5# to deal in the Software without restriction, including without limitation 6# the rights to use, copy, modify, merge, publish, distribute, sublicense, 7# and/or sell copies of the Software, and to permit persons to whom the 8# Software is furnished to do so, subject to the following conditions: 9# 10# The above copyright notice and this permission notice (including the next 11# paragraph) shall be included in all copies or substantial portions of the 12# Software. 13# 14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20# IN THE SOFTWARE. 21 22AC_PREREQ([2.60]) 23AC_INIT([glu], 24 [9.0.0], 25 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa&component=GLU]) 26AC_CONFIG_SRCDIR([Makefile.am]) 27AC_CANONICAL_HOST 28 29AM_INIT_AUTOMAKE([dist-bzip2 foreign subdir-objects]) 30 31LT_PREREQ([2.2]) 32LT_INIT 33 34dnl Check for progs 35AC_PROG_CPP 36AC_PROG_CC 37AC_PROG_CXX 38 39dnl Enable quiet compiles on automake 1.11. 40m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 41 42AC_ARG_ENABLE(debug, 43 AS_HELP_STRING([--enable-debug], 44 [Enable debugging information]), 45 [CFLAGS="$CFLAGS -g -O0" 46 CXXFLAGS="$CXXFLAGS -g -O0"], 47 []) 48 49dnl Make sure the pkg-config macros are defined 50m4_ifndef([PKG_PROG_PKG_CONFIG], 51 [m4_fatal([Could not locate the pkg-config autoconf macros. 52 These are usually located in /usr/share/aclocal/pkg.m4. If your macros 53 are in a different location, try setting the environment variable 54 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])]) 55PKG_PROG_PKG_CONFIG() 56 57AC_ARG_ENABLE(osmesa, 58 AS_HELP_STRING([--enable-osmesa], 59 [Enable use of OSMesa instead of libGL]), 60 [OSMESA="$enableval"], 61 [OSMESA=no]) 62 63dnl Get the pkg-config definitions for libGL/OSMesa. We include a fallback 64dnl path for implementations that don't provide a .pc file 65if test "x$OSMESA" = "xyes"; then 66 GLU_REQUIRES="osmesa" 67 PKG_CHECK_MODULES(OSMESA, [osmesa], [], [ 68 AC_CHECK_LIB([OSMesa], 69 [glBegin], 70 [OSMESA_LIBS=-lOSMesa], 71 AC_MSG_ERROR([OSMesa required])) 72 ]) 73else 74 GLU_REQUIRES="gl" 75 PKG_CHECK_MODULES(GL, [gl], [], [ 76 AC_CHECK_HEADER([GL/gl.h], 77 [], 78 AC_MSG_ERROR([GL not found])) 79 AC_CHECK_LIB([GL], 80 [glBegin], 81 [GL_LIBS=-lGL], 82 AC_MSG_ERROR([GL required])) 83 ]) 84fi 85AC_SUBST([GLU_REQUIRES]) 86 87dnl Set up C warning and visibility flags. 88if test "x$GCC" = xyes; then 89 WARNCFLAGS="-Wall" 90 91 # Enable -fvisibility=hidden if using a gcc that supports it 92 save_CFLAGS="$CFLAGS" 93 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden]) 94 VISIBILITY_CFLAGS="-fvisibility=hidden" 95 CFLAGS="$CFLAGS $VISIBILITY_CFLAGS" 96 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), 97 [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]); 98 99 # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed. 100 CFLAGS=$save_CFLAGS 101 102 if test "x$GXX" = xyes; then 103 WARNCXXFLAGS="-Wall" 104 105 # Enable -fvisibility=hidden if using a gcc that supports it 106 save_CXXFLAGS="$CXXFLAGS" 107 AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden]) 108 VISIBILITY_CXXFLAGS="-fvisibility=hidden" 109 CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS" 110 AC_LANG_PUSH([C++]) 111 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), 112 [VISIBILITY_CXXFLAGS=""; AC_MSG_RESULT([no])]); 113 AC_LANG_POP([C++]) 114 115 # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed. 116 CXXFLAGS=$save_CXXFLAGS 117 fi 118else 119 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) 120 if test "x$SUNCC" = "xyes"; then 121 WARNCFLAGS="-v" 122 WARNCXXFLAGS="-v" 123 fi 124fi 125AC_SUBST([WARNCFLAGS]) 126AC_SUBST([WARNCXXFLAGS]) 127AC_SUBST([VISIBILITY_CFLAGS]) 128AC_SUBST([VISIBILITY_CXXFLAGS]) 129 130AC_OUTPUT([ 131 Makefile 132 glu.pc 133]) 134