Eric Anholt | a909eb4 | 2013-09-19 09:50:49 -0700 | [diff] [blame] | 1 | # 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 |
| 23 | AC_PREREQ([2.60]) |
| 24 | AC_INIT([libepoxy], |
| 25 | [1.0], |
| 26 | [https://people.freedesktop.org/~anholt/libepoxy], |
| 27 | [libepoxy]) |
| 28 | AC_CONFIG_SRCDIR([Makefile.am]) |
| 29 | AC_CONFIG_HEADERS([config.h]) |
| 30 | |
| 31 | # Initialize Automake |
| 32 | AM_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 |
| 35 | m4_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 | |
| 40 | XORG_MACROS_VERSION(1.8) |
| 41 | XORG_DEFAULT_OPTIONS |
| 42 | |
| 43 | AC_CHECK_PROGS([PYTHON], [python3 python2 python]) |
| 44 | |
| 45 | # Initialize libtool |
| 46 | AC_DISABLE_STATIC |
Eric Anholt | 2591368 | 2013-12-06 13:40:30 -0800 | [diff] [blame] | 47 | AC_LIBTOOL_WIN32_DLL |
Eric Anholt | a909eb4 | 2013-09-19 09:50:49 -0700 | [diff] [blame] | 48 | AC_PROG_LIBTOOL |
| 49 | AC_SYS_LARGEFILE |
| 50 | |
Eric Anholt | 0d7d265 | 2013-12-06 12:09:57 -0800 | [diff] [blame] | 51 | case $host_os in |
| 52 | mingw*) |
| 53 | build_egl=no |
| 54 | build_glx=no |
Eric Anholt | 1d746bf | 2013-12-09 14:52:19 -0800 | [diff] [blame] | 55 | build_wgl=yes |
Eric Anholt | 2591368 | 2013-12-06 13:40:30 -0800 | [diff] [blame] | 56 | # 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 Anholt | bfd687d | 2013-12-06 16:33:46 -0800 | [diff] [blame] | 60 | |
| 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 Anholt | 0d7d265 | 2013-12-06 12:09:57 -0800 | [diff] [blame] | 66 | ;; |
| 67 | *) |
| 68 | build_egl=yes |
| 69 | build_glx=yes |
Eric Anholt | 1d746bf | 2013-12-09 14:52:19 -0800 | [diff] [blame] | 70 | build_wgl=no |
Eric Anholt | 2591368 | 2013-12-06 13:40:30 -0800 | [diff] [blame] | 71 | # 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 Anholt | 0d7d265 | 2013-12-06 12:09:57 -0800 | [diff] [blame] | 74 | ;; |
| 75 | esac |
| 76 | |
Eric Anholt | 2591368 | 2013-12-06 13:40:30 -0800 | [diff] [blame] | 77 | AC_SUBST(EPOXY_LINK_LIBS) |
| 78 | |
Eric Anholt | 0d7d265 | 2013-12-06 12:09:57 -0800 | [diff] [blame] | 79 | AM_CONDITIONAL(BUILD_EGL, test x$build_egl = xyes) |
| 80 | if test x$build_egl = xyes; then |
| 81 | AC_DEFINE([BUILD_EGL], [1], [build EGL tests]) |
| 82 | fi |
| 83 | |
| 84 | AM_CONDITIONAL(BUILD_GLX, test x$build_glx = xyes) |
| 85 | if test x$build_glx = xyes; then |
| 86 | AC_DEFINE([BUILD_GLX], [1], [build GLX tests]) |
| 87 | fi |
| 88 | |
Eric Anholt | 1d746bf | 2013-12-09 14:52:19 -0800 | [diff] [blame] | 89 | AM_CONDITIONAL(BUILD_WGL, test x$build_wgl = xyes) |
| 90 | if test x$build_wgl = xyes; then |
| 91 | AC_DEFINE([BUILD_WGL], [1], [build WGL tests]) |
| 92 | fi |
| 93 | |
Eric Anholt | a909eb4 | 2013-09-19 09:50:49 -0700 | [diff] [blame] | 94 | |
Eric Anholt | 2591368 | 2013-12-06 13:40:30 -0800 | [diff] [blame] | 95 | case $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 | ;; |
| 113 | esac |
Eric Anholt | a909eb4 | 2013-09-19 09:50:49 -0700 | [diff] [blame] | 114 | |
| 115 | AC_SUBST([VISIBILITY_CFLAGS]) |
| 116 | |
| 117 | PKG_CHECK_MODULES(X11, [x11], [x11=yes], [x11=no]) |
Eric Anholt | 847ba1a | 2013-12-11 16:25:48 -0800 | [diff] [blame^] | 118 | if test x$x11 = xno -a x$build_glx = xyes; then |
| 119 | AC_MSG_ERROR([libX11 headers (libx11-dev) required to build with GLX support]) |
| 120 | fi |
| 121 | |
Eric Anholt | a909eb4 | 2013-09-19 09:50:49 -0700 | [diff] [blame] | 122 | AM_CONDITIONAL(HAVE_X11, test x$x11 = xyes) |
| 123 | |
Eric Anholt | 9ffa5d2 | 2013-12-05 13:50:10 -0800 | [diff] [blame] | 124 | PKG_CHECK_MODULES(GL, [gl], [gl=yes], [gl=no]) |
Eric Anholt | a909eb4 | 2013-09-19 09:50:49 -0700 | [diff] [blame] | 125 | |
| 126 | AC_CONFIG_FILES([ |
| 127 | epoxy.pc |
| 128 | Makefile |
Eric Anholt | 43acf7b | 2013-12-06 11:50:00 -0800 | [diff] [blame] | 129 | include/epoxy/Makefile |
Eric Anholt | a909eb4 | 2013-09-19 09:50:49 -0700 | [diff] [blame] | 130 | src/Makefile |
Eric Anholt | 04cf940 | 2013-11-11 09:59:25 -0800 | [diff] [blame] | 131 | test/Makefile |
Eric Anholt | a909eb4 | 2013-09-19 09:50:49 -0700 | [diff] [blame] | 132 | ]) |
| 133 | AC_OUTPUT |
| 134 | |
Eric Anholt | 906d5b6 | 2013-12-06 12:21:54 -0800 | [diff] [blame] | 135 | echo " EGL: $build_egl" |
| 136 | echo " GLX: $build_glx" |
Eric Anholt | 1d746bf | 2013-12-09 14:52:19 -0800 | [diff] [blame] | 137 | echo " WGL: $build_wgl" |
Eric Anholt | a909eb4 | 2013-09-19 09:50:49 -0700 | [diff] [blame] | 138 | echo " PYTHON: $PYTHON" |