1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-17 06:35:47 +01:00

Configure: Moved configure's detection of XShm to a dedicated macro

The original check was not compliant with autoconf's syntax, did not have
a very good behaviour for user and was not easy to make evolve.

The new macro:
 - uses as much as possible autoconf macros for portability and code
consistency;
 - checks also for header usability with the compiler;
 - provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support)

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2013-11-17 18:51:20 +01:00
committed by Carlos R. Mafra
parent 062f6dd59d
commit b8b59d939d
2 changed files with 46 additions and 22 deletions

View File

@@ -39,6 +39,42 @@ AC_DEFUN_ONCE([WM_XEXT_CHECK_XSHAPE],
]) dnl AC_DEFUN
# WM_XEXT_CHECK_XSHM
# ------------------
#
# Check for the MIT-SHM extension for Shared Memory support
# The check depends on variable 'enable_shm' being either:
# yes - detect, fail if not found
# no - do not detect, disable support
# auto - detect, disable if not found
#
# When found, append appropriate stuff in XLIBS, and append info to
# the variable 'supported_xext'
# When not found, append info to variable 'unsupported'
AC_DEFUN_ONCE([WM_XEXT_CHECK_XSHM],
[WM_LIB_CHECK([XShm], [-lXext], [XShmAttach], [$XLIBS],
[wm_save_CFLAGS="$CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
@%:@include <X11/Xlib.h>
@%:@include <X11/extensions/XShm.h>
], [dnl
XShmSegmentInfo si;
XShmAttach(NULL, &si);])],
[],
[AC_MSG_ERROR([found $CACHEVAR but cannot compile using XShm header])])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
@%:@include <sys/ipc.h>
@%:@include <sys/shm.h>
], [dnl
shmget(IPC_PRIVATE, 1024, IPC_CREAT);])],
[],
[AC_MSG_ERROR([found $CACHEVAR but cannot compile using ipc/shm headers])])
CFLAGS="$wm_save_CFLAGS"],
[supported_xext], [XLIBS], [enable_shm], [-])dnl
]) dnl AC_DEFUN
# WM_XEXT_CHECK_XINERAMA
# ----------------------
#