2013-08-12 22:12:09 +02:00
|
|
|
dnl configure.ac
|
|
|
|
dnl Process this file with autoconf to produce a configure script.
|
|
|
|
|
2013-11-06 22:43:54 +01:00
|
|
|
AC_PREREQ([2.63])
|
2016-03-02 20:53:48 +01:00
|
|
|
AC_INIT([libglvnd], [0.1.0], [kbrenneman@nvidia.com])
|
2013-08-12 22:12:09 +02:00
|
|
|
AC_CONFIG_SRCDIR([config.h.in])
|
|
|
|
AC_CONFIG_HEADERS([config.h])
|
|
|
|
|
|
|
|
AC_CONFIG_AUX_DIR([bin])
|
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
|
|
AC_CANONICAL_SYSTEM
|
|
|
|
|
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
|
2013-09-27 02:11:26 +02:00
|
|
|
AM_INIT_AUTOMAKE([1.11 foreign silent-rules])
|
|
|
|
AM_SILENT_RULES([yes])
|
2013-08-12 22:12:09 +02:00
|
|
|
|
2015-07-08 19:01:14 +02:00
|
|
|
dnl Add an --enable-debug option
|
|
|
|
AX_CHECK_ENABLE_DEBUG(no, DEBUG)
|
|
|
|
|
2013-08-12 22:12:09 +02:00
|
|
|
dnl Checks for programs.
|
|
|
|
AC_PROG_CXX
|
|
|
|
|
|
|
|
AC_PROG_CC
|
2016-01-20 11:17:25 +01:00
|
|
|
AC_PROG_CC_C99
|
2013-08-12 22:12:09 +02:00
|
|
|
AM_PROG_AS
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_LN_S
|
|
|
|
AC_PROG_MAKE_SET
|
|
|
|
AC_PROG_LIBTOOL
|
2016-01-20 13:46:33 +01:00
|
|
|
AC_PROG_MKDIR_P
|
2016-01-20 10:09:47 +01:00
|
|
|
AC_CHECK_PROGS([PYTHON2], [python2.7 python2 python])
|
Re-implement libGL such that ELF symbol filtering is optional
Unfortunately, glibc has a bug where dlopening a shared library with
DT_FILTER or DT_AUXILIARY ELF headers can cause the application to
segfault (see https://sourceware.org/bugzilla/show_bug.cgi?id=16272).
Hence, for now, we can't rely on ELF symbol filtering to implement the
libGL compatibility library for libGLdispatch and libGLX. This change
re-implements libGL such that this is no longer necessary, by building
in the glapi static dispatch stubs and implementing thin wrapper
functions around GLX entrypoints.
- Rename getCachedProcAddress() to __glXGetCachedProcAddress() and give
this public visibility. This is used by the libGL wrapper library to
retrieve GLX entrypoints at load time.
- Link libGLX with the -Bsymbolic flag so __glXGetCachedProcAddress()
avoids referencing functions in the libGL wrapper library when libGL
and libGLX are both loaded.
- Replace the hand-coded no-op definitions in libglxnoopdefs.h with
a spec file, glx_funcs.spec, and a simple Perl script, gen_stubs.pl,
which parses the file and generates no-op functions as well as
pass-through functions that are used by libGL.
- Restructure GLdispatch/vnd-glapi/mapi/entry.c such that the pure C
fallback code is in its own header, entry_pure_c.h. In each of the
entry_*.h headers, separate code not related to implementing the
static dispatch stubs into an "#if !defined(STATIC_DISPATCH_ONLY)"
block.
- Give u_current (which is #defined as _glapi_Current or
_glapi_tls_Current depending on the thread storage model used) public
visibility so it can be referenced from outside of libGLdispatch.so.
- When building libGL, include GLdispatch/vnd-glapi/mapi/entry.c in the
sources, and define STATIC_DISPATCH_ONLY so that only the static
entrypoints are compiled. Remove the -Wl,--auxiliary flags from
Makefile.am.
Bonus: fix "make distcheck" by adding GLdispatchABI.h to noinst_HEADERS.
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
2013-12-03 21:06:47 +01:00
|
|
|
AC_CHECK_PROGS([PERL], [perl])
|
2013-08-12 22:12:09 +02:00
|
|
|
|
2016-01-20 11:17:25 +01:00
|
|
|
if test "x$ac_cv_prog_cc_c99" = xno; then
|
|
|
|
AC_MSG_ERROR([Building libglvnd requires a C99-enabled compiler])
|
|
|
|
fi
|
|
|
|
|
2013-08-12 22:12:09 +02:00
|
|
|
dnl
|
|
|
|
dnl Arch/platform-specific settings. Copied from mesa
|
|
|
|
dnl
|
|
|
|
AC_ARG_ENABLE([asm],
|
|
|
|
[AS_HELP_STRING([--disable-asm],
|
2016-02-11 04:06:14 +01:00
|
|
|
[disable assembly usage @<:@default=enabled on supported platforms@:>@])],
|
2013-08-12 22:12:09 +02:00
|
|
|
[enable_asm="$enableval"],
|
|
|
|
[enable_asm=yes]
|
|
|
|
)
|
|
|
|
asm_arch=""
|
|
|
|
AC_MSG_CHECKING([whether to enable assembly])
|
|
|
|
test "x$enable_asm" = xno && AC_MSG_RESULT([no])
|
|
|
|
# check for supported arches
|
|
|
|
if test "x$enable_asm" = xyes; then
|
|
|
|
case "$host_cpu" in
|
|
|
|
i?86)
|
|
|
|
case "$host_os" in
|
|
|
|
linux* | *freebsd* | dragonfly* | *netbsd*)
|
2016-01-20 09:24:43 +01:00
|
|
|
asm_arch=x86
|
2013-08-12 22:12:09 +02:00
|
|
|
;;
|
|
|
|
gnu*)
|
|
|
|
asm_arch=x86
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
x86_64)
|
|
|
|
case "$host_os" in
|
|
|
|
linux* | *freebsd* | dragonfly* | *netbsd*)
|
2016-01-20 09:24:43 +01:00
|
|
|
asm_arch=x86_64
|
2013-08-12 22:12:09 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2015-07-15 02:24:05 +02:00
|
|
|
armv7l)
|
|
|
|
asm_arch=armv7l
|
|
|
|
;;
|
2013-08-12 22:12:09 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
case "$asm_arch" in
|
|
|
|
x86)
|
|
|
|
DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
|
|
|
|
AC_MSG_RESULT([yes, x86])
|
|
|
|
;;
|
|
|
|
x86_64)
|
|
|
|
DEFINES="$DEFINES -DUSE_X86_64_ASM"
|
|
|
|
AC_MSG_RESULT([yes, x86_64])
|
|
|
|
;;
|
2015-07-15 02:24:05 +02:00
|
|
|
armv7l)
|
|
|
|
DEFINES="$DEFINES -DUSE_ARMV7_ASM"
|
|
|
|
AC_MSG_RESULT([yes, armv7l])
|
|
|
|
;;
|
2013-08-12 22:12:09 +02:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([no, platform not supported])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2013-08-12 22:12:10 +02:00
|
|
|
dnl
|
|
|
|
dnl mapi top-relative paths: defined here so mapi can be used elsewhere
|
|
|
|
dnl
|
|
|
|
|
2013-09-27 05:08:04 +02:00
|
|
|
AC_SUBST([MAPI_PREFIX], [src/GLdispatch/vnd-glapi/mapi])
|
2013-08-12 22:12:10 +02:00
|
|
|
AC_SUBST([MAPI_MESA_PREFIX], [src/GLdispatch/mesa])
|
|
|
|
|
2013-08-12 22:12:09 +02:00
|
|
|
dnl Checks for libraries.
|
2015-03-25 22:32:30 +01:00
|
|
|
AX_PTHREAD()
|
2013-08-12 22:12:09 +02:00
|
|
|
|
|
|
|
PKG_CHECK_MODULES([X11], [x11])
|
|
|
|
PKG_CHECK_MODULES([XEXT], [xext])
|
|
|
|
PKG_CHECK_MODULES([XORG], [xorg-server >= 1.11.0])
|
2016-01-21 23:39:41 +01:00
|
|
|
PKG_CHECK_MODULES([GLPROTO], [glproto])
|
2013-08-12 22:12:09 +02:00
|
|
|
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_C_TYPEOF
|
|
|
|
|
|
|
|
dnl Checks for library functions.
|
|
|
|
AC_FUNC_STRNLEN
|
|
|
|
|
|
|
|
dnl TLS detection
|
2015-05-26 19:05:49 +02:00
|
|
|
AC_ARG_ENABLE([tls],
|
|
|
|
[AS_HELP_STRING([--disable-tls],
|
2016-02-11 04:06:14 +01:00
|
|
|
[disable TLS usage @<:@default=enabled on supported platforms@:>@])],
|
2015-05-26 19:05:49 +02:00
|
|
|
[enable_tls="$enableval"],
|
|
|
|
[enable_tls=yes]
|
|
|
|
)
|
|
|
|
|
2013-08-12 22:12:09 +02:00
|
|
|
AC_MSG_CHECKING([for initial-exec TLS])
|
2015-08-06 23:02:57 +02:00
|
|
|
if test "x$enable_tls" = "xyes"; then
|
2015-03-25 22:32:30 +01:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
|
|
|
__thread int foo __attribute__((tls_model("initial-exec")));
|
|
|
|
])],
|
2015-08-06 23:02:57 +02:00
|
|
|
[HAVE_INIT_TLS=yes],[HAVE_INIT_TLS=no])
|
2015-03-25 22:32:30 +01:00
|
|
|
else
|
2015-08-06 23:02:57 +02:00
|
|
|
HAVE_INIT_TLS=no
|
2015-03-25 22:32:30 +01:00
|
|
|
fi
|
2015-08-06 23:02:57 +02:00
|
|
|
AC_MSG_RESULT($HAVE_INIT_TLS)
|
|
|
|
|
|
|
|
# Figure out what implementation to use for the entrypoint stubs.
|
|
|
|
# This will set an automake condition, which is then used in
|
|
|
|
# src/GLdispatch/vnd-glapi/entry_files.mk.
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for entrypoint stub type])
|
|
|
|
case "x$asm_arch" in
|
|
|
|
xx86)
|
|
|
|
# The x86 TLS stubs don't work, so use the TSD stubs instead.
|
|
|
|
gldispatch_entry_type=x86_tsd
|
|
|
|
gldispatch_use_tls=no
|
|
|
|
;;
|
|
|
|
xx86_64)
|
|
|
|
# For x86-64, both the TLS and TSD stubs work.
|
|
|
|
if test "x$HAVE_INIT_TLS" = "xyes" ; then
|
|
|
|
gldispatch_entry_type=x86_64_tls
|
|
|
|
gldispatch_use_tls=yes
|
|
|
|
else
|
|
|
|
gldispatch_entry_type=x86_64_tsd
|
|
|
|
gldispatch_use_tls=no
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
xarmv7l)
|
|
|
|
# For ARMv7, only the TSD stubs have been implemented yet.
|
|
|
|
gldispatch_entry_type=armv7_tsd
|
|
|
|
gldispatch_use_tls=no
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# The C stubs will work with either TLS or TSD.
|
|
|
|
gldispatch_entry_type=pure_c
|
|
|
|
gldispatch_use_tls=$HAVE_INIT_TLS
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_MSG_RESULT([$gldispatch_entry_type, TLS=$gldispatch_use_tls])
|
|
|
|
|
|
|
|
AS_IF([test "x$gldispatch_use_tls" = "xyes"],
|
|
|
|
[AC_DEFINE([GLDISPATCH_USE_TLS], 1,
|
|
|
|
[Define to 1 if libGLdispatch should use a TLS variable for the dispatch table.])])
|
|
|
|
AM_CONDITIONAL([GLDISPATCH_USE_TLS], [test "x$gldispatch_use_tls" = "xyes"])
|
|
|
|
AM_CONDITIONAL([GLDISPATCH_TYPE_X86_TLS], [test "x$gldispatch_entry_type" = "xx86_tls"])
|
|
|
|
AM_CONDITIONAL([GLDISPATCH_TYPE_X86_TSD], [test "x$gldispatch_entry_type" = "xx86_tsd"])
|
|
|
|
AM_CONDITIONAL([GLDISPATCH_TYPE_X86_64_TLS], [test "x$gldispatch_entry_type" = "xx86_64_tls"])
|
|
|
|
AM_CONDITIONAL([GLDISPATCH_TYPE_X86_64_TSD], [test "x$gldispatch_entry_type" = "xx86_64_tsd"])
|
|
|
|
AM_CONDITIONAL([GLDISPATCH_TYPE_ARMV7_TSD], [test "x$gldispatch_entry_type" = "xarmv7_tsd"])
|
|
|
|
AM_CONDITIONAL([GLDISPATCH_TYPE_PURE_C], [test "x$gldispatch_entry_type" = "xpure_c"])
|
2013-08-12 22:12:09 +02:00
|
|
|
|
|
|
|
|
2015-03-27 18:38:58 +01:00
|
|
|
AC_MSG_CHECKING([for constructor attributes])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
|
|
|
void __attribute__ ((constructor)) foo(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void __attribute__ ((destructor)) bar(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
])],
|
|
|
|
[USE_ATTRIBUTE_CONSTRUCTOR=yes],[USE_ATTRIBUTE_CONSTRUCTOR=no])
|
|
|
|
AC_MSG_RESULT($USE_ATTRIBUTE_CONSTRUCTOR)
|
|
|
|
AS_IF([test "x$USE_ATTRIBUTE_CONSTRUCTOR" = "xyes"],
|
|
|
|
[AC_DEFINE([USE_ATTRIBUTE_CONSTRUCTOR], 1,
|
2015-03-31 01:00:14 +02:00
|
|
|
[Define to 1 if the compiler supports constructor attributes.])])
|
2015-03-27 18:38:58 +01:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([for pthreads rwlocks])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
|
|
|
#include <pthread.h>
|
|
|
|
void foo(void)
|
|
|
|
{
|
|
|
|
pthread_rwlock_t lock;
|
|
|
|
pthread_rwlock_init(&lock, NULL);
|
|
|
|
}
|
|
|
|
])],
|
|
|
|
[HAVE_PTHREAD_RWLOCK_T=yes],[HAVE_PTHREAD_RWLOCK_T=no])
|
|
|
|
AC_MSG_RESULT($HAVE_PTHREAD_RWLOCK_T)
|
|
|
|
AS_IF([test "x$HAVE_PTHREAD_RWLOCK_T" = "xyes"],
|
|
|
|
[AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
|
|
|
|
[Define to 1 if the compiler supports pthreads rwlocks.])])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for sync intrinsics])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
|
|
|
int foo(int volatile *val, int oldVal, int newVal)
|
|
|
|
{
|
|
|
|
return __sync_add_and_fetch(val, 1);
|
|
|
|
return __sync_lock_test_and_set(val, newVal);
|
|
|
|
return __sync_val_compare_and_swap(val, oldVal, newVal);
|
|
|
|
}
|
|
|
|
])],
|
|
|
|
[HAVE_SYNC_INTRINSICS=yes],[HAVE_SYNC_INTRINSICS=no])
|
|
|
|
AC_MSG_RESULT($HAVE_SYNC_INTRINSICS)
|
|
|
|
AS_IF([test "x$HAVE_SYNC_INTRINSICS" = "xyes"],
|
|
|
|
[AC_DEFINE([HAVE_SYNC_INTRINSICS], 1,
|
2015-03-31 01:00:14 +02:00
|
|
|
[Define to 1 if the compiler supports __sync intrinsic functions.])])
|
2015-03-27 18:38:58 +01:00
|
|
|
|
2016-01-20 10:08:42 +01:00
|
|
|
# See if the linker supports the --no-undefined flag.
|
2015-07-24 22:35:45 +02:00
|
|
|
AX_CHECK_LINK_FLAG([-Xlinker --no-undefined],
|
|
|
|
[AC_SUBST([LINKER_FLAG_NO_UNDEFINED], ["-Xlinker --no-undefined"])],
|
|
|
|
[AC_SUBST([LINKER_FLAG_NO_UNDEFINED], [""])])
|
|
|
|
|
2013-08-12 22:12:09 +02:00
|
|
|
dnl default CFLAGS
|
2016-01-20 11:17:25 +01:00
|
|
|
CFLAGS="$CFLAGS -Wall -Werror -include config.h -fvisibility=hidden $DEFINES"
|
2013-08-12 22:12:09 +02:00
|
|
|
|
|
|
|
AC_CONFIG_FILES([Makefile
|
2015-11-24 21:38:41 +01:00
|
|
|
libglvnd.pc
|
|
|
|
include/Makefile
|
2013-08-23 01:20:01 +02:00
|
|
|
src/Makefile
|
2013-08-12 22:12:10 +02:00
|
|
|
src/GL/Makefile
|
|
|
|
src/OpenGL/Makefile
|
2015-11-13 23:17:20 +01:00
|
|
|
src/GLESv1/Makefile
|
2015-11-13 22:24:02 +01:00
|
|
|
src/GLESv2/Makefile
|
2013-08-23 01:20:01 +02:00
|
|
|
src/GLX/Makefile
|
2013-08-12 22:12:09 +02:00
|
|
|
src/GLdispatch/Makefile
|
2013-09-27 05:08:04 +02:00
|
|
|
src/GLdispatch/vnd-glapi/Makefile
|
2013-09-27 00:48:30 +02:00
|
|
|
src/util/Makefile
|
2013-08-12 22:12:10 +02:00
|
|
|
src/util/trace/Makefile
|
2013-08-12 22:12:10 +02:00
|
|
|
tests/Makefile
|
|
|
|
tests/GLX_dummy/Makefile])
|
2013-08-12 22:12:09 +02:00
|
|
|
AC_OUTPUT
|