-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
configure.ac
142 lines (112 loc) · 4.5 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
AC_INIT([Haskell X11 package], [1.4.6], [[email protected]], [X11])
FP_ARG_X11
if test "$enable_x11" = no; then
X11_BUILD_PACKAGE=no
BUILD_PACKAGE_BOOL=False
else
# Safety check: Ensure that we are in the correct source directory.
AC_CONFIG_SRCDIR([include/HsXlib.h])
AC_CONFIG_HEADERS([include/HsX11Config.h include/X11_extras_config.h])
# Check for X11 include paths and libraries
AC_PATH_XTRA
# AC_PATH_XTRA doesn't actually check that the C compiler can
# really include the X headers, so double-check here. In particular,
# this will catch the case of using a mingw32 gcc on a Cygwin system:
# Cygwin has the X headers & libs installed, but the mingw32 gcc can't
# use them, and we want to disable the package in this case.
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_TRY_CPP([#include <X11/Xlib.h>],,[no_x=yes])
# If there's some oddball X11 include path, we need it to check there for
# Xinerama headers.
if test -n "$x_includes"; then
CPPFLAGS="$CPPFLAGS -I$x_includes"
fi
# Build the package if we found X11 stuff
if test "$no_x" = yes; then
AC_MSG_FAILURE([X11 libraries not found, so X11 package cannot be built])
else
X11_BUILD_PACKAGE=yes
BUILD_PACKAGE_BOOL=True
fi
fi
AC_SUBST([X11_BUILD_PACKAGE])
AC_SUBST([BUILD_PACKAGE_BOOL])
# Define CPP variables used in package.conf.in
if test "$X11_BUILD_PACKAGE" = yes; then
AC_DEFINE_UNQUOTED(X_CFLAGS,
[`echo '' $X_CFLAGS | sed -e 's/-[[^ ]]*/,"&"/g' -e 's/^ *,//'`],
[C flags for X11, as a list of string literals.])
AC_DEFINE_UNQUOTED(X_LIBS,
[`echo '' $X_LIBS | sed -e 's/-[[^ ]]*/,"&"/g' -e 's/^ *,//'`],
[Library flags for X11, as a list of string literals.])
fi
AC_MSG_CHECKING([whether to build Xinerama])
AC_ARG_WITH(xinerama,
AS_HELP_STRING([--without-xinerama], [do not build Xinerama support]),
[],
[with_xinerama=yes])
AC_MSG_RESULT([$with_xinerama])
if test "$with_xinerama" = yes; then
AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [have_xinerama=yes])
if test "$have_xinerama" = yes; then
EXTRA_LIBRARIES="Xinerama Xext"
else
echo "WARNING: Xinerama headers not found. Building without Xinerama support"
fi
else
echo "WARNING: Building without Xinerama support per user request"
fi
AC_CHECK_HEADERS([X11/extensions/Xrandr.h], [have_xrandr=yes])
if ! test "$have_xrandr" = yes; then
AC_MSG_ERROR([X11/extensions/Xrandr.h (from libXrandr) is required])
fi
AC_CHECK_HEADERS([X11/extensions/scrnsaver.h], [have_xscreensaver=yes])
if ! test "$have_xscreensaver" = yes; then
AC_MSG_ERROR([X11/extensions/scrnsaver.h (from libXss) is required])
fi
EXTRA_LIBRARIES="Xss $EXTRA_LIBRARIES"
AC_MSG_CHECKING([whether to include X.org keysyms])
AC_ARG_WITH(xorg-keysym,
AS_HELP_STRING([--without-xorg-keysym], [do not build X.org keysym support]),
[],
[with_xorg_keysym=yes])
AC_MSG_RESULT([$with_xorg_keysym])
if test "$with_xorg_keysym" = yes; then
AC_CHECK_HEADERS([X11/keysym.h], [have_keysym=yes])
if ! test "$have_keysym" = yes; then
echo "WARNING: Couldn't find <X11/keysym.h> for X.org keysyms"
fi
AC_CHECK_HEADERS([X11/DECkeysym.h], [have_dec_keysym=yes])
if ! test "$have_dec_keysym" = yes; then
echo "WARNING: Couldn't find <X11/DECkeysym.h> for X.org keysyms"
fi
AC_CHECK_HEADERS([X11/Sunkeysym.h], [have_sun_keysym=yes])
if ! test "$have_sun_keysym" = yes; then
echo "WARNING: Couldn't find <X11/Sunkeysym.h> for X.org keysyms"
fi
AC_CHECK_HEADERS([X11/ap_keysym.h], [have_ap_keysym=yes])
if ! test "$have_ap_keysym" = yes; then
echo "WARNING: Couldn't find <X11/ap_keysym.h> for X.org keysyms"
fi
AC_CHECK_HEADERS([X11/HPkeysym.h], [have_hp_keysym=yes])
if ! test "$have_hp_keysym" = yes; then
echo "WARNING: Couldn't find <X11/HPkeysym.h> for X.org keysyms"
fi
AC_CHECK_HEADERS([X11/XF86keysym.h], [have_xf86_keysym=yes])
if ! test "$have_xf86_keysym" = yes; then
echo "WARNING: Couldn't find <X11/XF86keysym.h> for X.org keysyms"
fi
AC_CHECK_HEADERS([X11/keysymdef.h], [have_keysymdef=yes])
if ! test "$have_keysymdef" = yes; then
echo "WARNING: Couldn't find <X11/keysymdef.h> for X.org keysyms"
fi
AC_CHECK_HEADERS([X11/cursorfont.h], [have_cursorfont=yes])
if ! test "$have_cursorfont" = yes; then
AC_MSG_ERROR([X11/cursorfont.h (from libx11) is required])
fi
fi
AC_SUBST([EXTRA_LIBRARIES])
X_LIBRARIES="$x_libraries"
AC_SUBST([X_LIBRARIES])
AC_CONFIG_FILES([config.mk X11.buildinfo])
AC_OUTPUT