configure.ac revision 40dd5a57
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
22dnl Process this file with autoconf to create configure.
23
24AC_PREREQ([2.59])
25AC_INIT([glw], [8.0.0],
26    [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
27AC_CANONICAL_HOST
28
29AM_INIT_AUTOMAKE([dist-bzip2])
30
31dnl Check for progs
32AC_PROG_CPP
33AC_PROG_CC
34AC_PROG_LIBTOOL
35AM_PROG_CC_C_O
36
37# Enable quiet compiles on automake 1.11.
38m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
39
40dnl Make sure the pkg-config macros are defined
41m4_ifndef([PKG_PROG_PKG_CONFIG],
42    [m4_fatal([Could not locate the pkg-config autoconf macros.
43  These are usually located in /usr/share/aclocal/pkg.m4. If your macros
44  are in a different location, try setting the environment variable
45  ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
46PKG_PROG_PKG_CONFIG()
47
48AC_ARG_ENABLE([motif],
49    [AS_HELP_STRING([--enable-motif],
50        [use Motif widgets @<:@default=disabled@:>@])],
51    [enable_motif="$enableval"],
52    [enable_motif=no])
53AM_CONDITIONAL([ENABLE_MOTIF], [test "$enable_motif" = yes])
54
55dnl Get the pkg-config definitions for libGL.  We include a fallback
56dnl path for GL implementation that don't provide a .pc file
57PKG_CHECK_MODULES(GL, [gl], [], [
58		  AC_CHECK_HEADER([GL/gl.h],
59				  [],
60				  AC_MSG_ERROR([GL not found]))
61		  AC_CHECK_LIB([GL],
62			       [glBegin],
63			       [GL_LIBS=-lGL],
64			       AC_MSG_ERROR([GL required]))
65		  ])
66
67PKG_CHECK_MODULES([GLW],[x11 xt])
68
69MOTIF_CFLAGS=
70if test "x$enable_motif" = xyes; then
71    AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
72    if test "x$MOTIF_CONFIG" != xno; then
73        MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
74        MOTIF_LIBS=`$MOTIF_CONFIG --libs`
75    else
76        AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
77            [AC_MSG_ERROR([Can't locate Motif headers])])
78        AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
79            [AC_MSG_ERROR([Can't locate Motif Xm library])])
80    fi
81    # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
82    GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
83    GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
84fi
85
86AC_SUBST([GLW_PC_LIB_PRIV])
87AC_SUBST([GLW_PC_CFLAGS])
88
89CFLAGS="$CFLAGS $GL_CFLAGS"
90LIBS="$LIBS $GL_LIBS $MOTIF_LIBS"
91
92dnl Set up C warning flags.  Copy of XORG_CWARNFLAGS.
93if  test "x$GCC" = xyes ; then
94    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
95-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
96-Wbad-function-cast"
97    case `$CC -dumpversion` in
98    3.4.* | 4.*)
99	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
100	;;
101    esac
102else
103    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
104    if test "x$SUNCC" = "xyes"; then
105	CWARNFLAGS="-v"
106    fi
107fi
108CFLAGS="$CFLAGS $CWARNFLAGS"
109
110PKG_CHECK_MODULES(X11, [x11 xext], [x11_enabled=yes], [enable_x11=no])
111
112AC_CONFIG_FILES([glw.pc])
113AC_OUTPUT([
114	Makefile
115])
116