blob: 5b61ace1b64ad0a2123f99a209f2b1c94b6d8379 [file] [log] [blame]
Eric Anholta909eb42013-09-19 09:50:49 -07001# Copyright © 2013 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
22# Initialize Autoconf
23AC_PREREQ([2.60])
24AC_INIT([libepoxy],
25 [1.0],
26 [https://people.freedesktop.org/~anholt/libepoxy],
27 [libepoxy])
28AC_CONFIG_SRCDIR([Makefile.am])
29AC_CONFIG_HEADERS([config.h])
30
31# Initialize Automake
32AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
33
34# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
35m4_ifndef([XORG_MACROS_VERSION],
36 [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen.
37 Hint: either install from source, git://anongit.freedesktop.org/xorg/util/macros or,
38 depending on you distribution, try package 'xutils-dev' or 'xorg-x11-util-macros'])])
39
40XORG_MACROS_VERSION(1.8)
41XORG_DEFAULT_OPTIONS
42
43AC_CHECK_PROGS([PYTHON], [python3 python2 python])
44
45# Initialize libtool
46AC_DISABLE_STATIC
Eric Anholt25913682013-12-06 13:40:30 -080047AC_LIBTOOL_WIN32_DLL
Eric Anholta909eb42013-09-19 09:50:49 -070048AC_PROG_LIBTOOL
49AC_SYS_LARGEFILE
50
Eric Anholt0d7d2652013-12-06 12:09:57 -080051case $host_os in
52 mingw*)
53 build_egl=no
54 build_glx=no
Eric Anholt1d746bf2013-12-09 14:52:19 -080055 build_wgl=yes
Eric Anholt25913682013-12-06 13:40:30 -080056 # On windows, the DLL has to have all of its functions
57 # resolved at link time, so we have to link directly aginst
58 # opengl32.dll. But that's the only GL provider, anyway.
59 EPOXY_LINK_LIBS="-lopengl32"
Eric Anholtbfd687d2013-12-06 16:33:46 -080060
61 # Testing our built windows binaries requires that they be run
62 # under wine. Yeah, we should be nice and autodetect, but
63 # there's lots of missing autodetection for the testsuite
64 # (like checking for EGL and GLX libs in non-windows.).
65 AC_SUBST([LOG_COMPILER], [wine])
Eric Anholt0d7d2652013-12-06 12:09:57 -080066 ;;
67 *)
68 build_egl=yes
69 build_glx=yes
Eric Anholt1d746bf2013-12-09 14:52:19 -080070 build_wgl=no
Eric Anholt25913682013-12-06 13:40:30 -080071 # On platforms with dlopen, we load everything dynamically and
72 # don't link against a specific window system or GL implementation.
73 EPOXY_LINK_LIBS=""
Eric Anholt0d7d2652013-12-06 12:09:57 -080074 ;;
75esac
76
Eric Anholt25913682013-12-06 13:40:30 -080077AC_SUBST(EPOXY_LINK_LIBS)
78
Eric Anholt0d7d2652013-12-06 12:09:57 -080079AM_CONDITIONAL(BUILD_EGL, test x$build_egl = xyes)
80if test x$build_egl = xyes; then
81 AC_DEFINE([BUILD_EGL], [1], [build EGL tests])
82fi
83
84AM_CONDITIONAL(BUILD_GLX, test x$build_glx = xyes)
85if test x$build_glx = xyes; then
86 AC_DEFINE([BUILD_GLX], [1], [build GLX tests])
87fi
88
Eric Anholt1d746bf2013-12-09 14:52:19 -080089AM_CONDITIONAL(BUILD_WGL, test x$build_wgl = xyes)
90if test x$build_wgl = xyes; then
91 AC_DEFINE([BUILD_WGL], [1], [build WGL tests])
92fi
93
Eric Anholta909eb42013-09-19 09:50:49 -070094
Eric Anholt25913682013-12-06 13:40:30 -080095case $host_os in
96 mingw*)
97 # visibility flags aren't supported for windows DLLs, and the
98 # compiler whines to tell you so, so don't set them up.
99 ;;
100 *)
101 if test "x$GCC" = xyes; then
102 save_CFLAGS="$CFLAGS"
103 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
104 VISIBILITY_CFLAGS="-fvisibility=hidden"
105 CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
106 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
107 [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
108
109 # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
110 CFLAGS=$save_CFLAGS
111 fi
112 ;;
113esac
Eric Anholta909eb42013-09-19 09:50:49 -0700114
115AC_SUBST([VISIBILITY_CFLAGS])
116
117PKG_CHECK_MODULES(X11, [x11], [x11=yes], [x11=no])
Eric Anholt847ba1a2013-12-11 16:25:48 -0800118if test x$x11 = xno -a x$build_glx = xyes; then
119 AC_MSG_ERROR([libX11 headers (libx11-dev) required to build with GLX support])
120fi
121
Eric Anholta909eb42013-09-19 09:50:49 -0700122AM_CONDITIONAL(HAVE_X11, test x$x11 = xyes)
123
Eric Anholt9ffa5d22013-12-05 13:50:10 -0800124PKG_CHECK_MODULES(GL, [gl], [gl=yes], [gl=no])
Eric Anholta909eb42013-09-19 09:50:49 -0700125
126AC_CONFIG_FILES([
127 epoxy.pc
128 Makefile
Eric Anholt43acf7b2013-12-06 11:50:00 -0800129 include/epoxy/Makefile
Eric Anholta909eb42013-09-19 09:50:49 -0700130 src/Makefile
Eric Anholt04cf9402013-11-11 09:59:25 -0800131 test/Makefile
Eric Anholta909eb42013-09-19 09:50:49 -0700132])
133AC_OUTPUT
134
Eric Anholt906d5b62013-12-06 12:21:54 -0800135echo " EGL: $build_egl"
136echo " GLX: $build_glx"
Eric Anholt1d746bf2013-12-09 14:52:19 -0800137echo " WGL: $build_wgl"
Eric Anholta909eb42013-09-19 09:50:49 -0700138echo " PYTHON: $PYTHON"