summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 0357f326c37f75a623c7b88e40fe4067860aab7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Copyright © 2011 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

AC_PREREQ([2.60])
AC_INIT([glu],
        [9.0.0],
        [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa&component=GLU])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CANONICAL_HOST

AM_INIT_AUTOMAKE([dist-bzip2 foreign subdir-objects])

LT_PREREQ([2.2])
LT_INIT

dnl Check for progs
AC_PROG_CPP
AC_PROG_CC
AC_PROG_CXX

dnl Enable quiet compiles on automake 1.11.
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

dnl Make sure the pkg-config macros are defined
m4_ifndef([PKG_PROG_PKG_CONFIG],
    [m4_fatal([Could not locate the pkg-config autoconf macros.
  These are usually located in /usr/share/aclocal/pkg.m4. If your macros
  are in a different location, try setting the environment variable
  ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
PKG_PROG_PKG_CONFIG()

AC_ARG_ENABLE(osmesa,
              AS_HELP_STRING([--enable-osmesa],
                [Enable use of OSMesa instead of libGL]),
              [OSMESA="$enableval"],
              [OSMESA=no])

dnl Get the pkg-config definitions for libGL/OSMesa.  We include a fallback
dnl path for implementations that don't provide a .pc file
if test "x$OSMESA" = "xyes"; then
    PKG_CHECK_MODULES(OSMESA, [osmesa], [], [
          AC_CHECK_HEADER([GL/osmesa.h],
                  [],
                  AC_MSG_ERROR([OSMesa not found]))
          AC_CHECK_LIB([OSMesa],
                   [glBegin],
                   [OSMESA_LIBS=-lOSMesa],
                   AC_MSG_ERROR([OSMesa required]))
          ])
else
    PKG_CHECK_MODULES(GL, [gl], [], [
          AC_CHECK_HEADER([GL/gl.h],
                  [],
                  AC_MSG_ERROR([GL not found]))
          AC_CHECK_LIB([GL],
                   [glBegin],
                   [GL_LIBS=-lGL],
                   AC_MSG_ERROR([GL required]))
          ])
fi

dnl Set up C warning and visibility flags.
if test "x$GCC" = xyes; then
    WARNCFLAGS="-Wall"

    # Enable -fvisibility=hidden if using a gcc that supports it
    save_CFLAGS="$CFLAGS"
    AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
    VISIBILITY_CFLAGS="-fvisibility=hidden"
    CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
    AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
		   [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);

    # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
    CFLAGS=$save_CFLAGS

    if test "x$GXX" = xyes; then
        WARNCXXFLAGS="-Wall"

        # Enable -fvisibility=hidden if using a gcc that supports it
        save_CXXFLAGS="$CXXFLAGS"
        AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
        VISIBILITY_CXXFLAGS="-fvisibility=hidden"
        CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
	AC_LANG_PUSH([C++])
        AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
		       [VISIBILITY_CXXFLAGS=""; AC_MSG_RESULT([no])]);
        AC_LANG_POP([C++])

        # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
        CXXFLAGS=$save_CXXFLAGS
    fi
else
    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
    if test "x$SUNCC" = "xyes"; then
        WARNCFLAGS="-v"
        WARNCXXFLAGS="-v"
    fi
fi
AC_SUBST([WARNCFLAGS])
AC_SUBST([WARNCXXFLAGS])
AC_SUBST([VISIBILITY_CFLAGS])
AC_SUBST([VISIBILITY_CXXFLAGS])

AC_OUTPUT([
    Makefile
    glu.pc
])