mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +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:
committed by
Carlos R. Mafra
parent
062f6dd59d
commit
b8b59d939d
32
configure.ac
32
configure.ac
@@ -499,6 +499,16 @@ AC_ARG_ENABLE([shape],
|
|||||||
[enable_shape=auto])
|
[enable_shape=auto])
|
||||||
WM_XEXT_CHECK_XSHAPE
|
WM_XEXT_CHECK_XSHAPE
|
||||||
|
|
||||||
|
dnl MIT-SHM support
|
||||||
|
dnl ===============
|
||||||
|
AC_ARG_ENABLE([shm],
|
||||||
|
[AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
|
||||||
|
[AS_CASE(["$enableval"],
|
||||||
|
[yes|no], [],
|
||||||
|
[AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
|
||||||
|
[enable_shm=auto])
|
||||||
|
WM_XEXT_CHECK_XSHM
|
||||||
|
|
||||||
dnl XINERAMA support
|
dnl XINERAMA support
|
||||||
dnl ================
|
dnl ================
|
||||||
AC_ARG_ENABLE([xinerama],
|
AC_ARG_ENABLE([xinerama],
|
||||||
@@ -587,28 +597,6 @@ AC_SUBST(XFTFLAGS)
|
|||||||
AC_SUBST(XFTLIBS)
|
AC_SUBST(XFTLIBS)
|
||||||
|
|
||||||
|
|
||||||
dnl MIT-SHM support
|
|
||||||
dnl ===============
|
|
||||||
shm=yes
|
|
||||||
AC_ARG_ENABLE(shm, AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension]),
|
|
||||||
shm=$enableval, shm=yes)
|
|
||||||
|
|
||||||
if test "$shm" = yes; then
|
|
||||||
AC_CHECK_LIB(Xext, XShmAttach, ok=yes, ok=no, $XLFLAGS $XLIBS)
|
|
||||||
|
|
||||||
if test "$ok" = yes; then
|
|
||||||
AC_CHECK_FUNC(shmget, ok=yes, ok=no)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$ok" = yes; then
|
|
||||||
if test "$added_xext" = no; then
|
|
||||||
XLIBS="-lXext $XLIBS"
|
|
||||||
fi
|
|
||||||
AC_DEFINE(USE_XSHM, 1, [define if X's shared memory extension is available (set by configure)])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
dnl ==============================================
|
dnl ==============================================
|
||||||
dnl Graphic Format Libraries
|
dnl Graphic Format Libraries
|
||||||
dnl ==============================================
|
dnl ==============================================
|
||||||
|
|||||||
@@ -39,6 +39,42 @@ AC_DEFUN_ONCE([WM_XEXT_CHECK_XSHAPE],
|
|||||||
]) dnl AC_DEFUN
|
]) 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
|
# WM_XEXT_CHECK_XINERAMA
|
||||||
# ----------------------
|
# ----------------------
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user