Debian Codegraph @

nx-X11/lib/configure.ac

raw
1 # Initialize Autoconf
2 AC_PREREQ([2.60])
3 AC_INIT([libNX_X11], [1.7.3.1],
4 [https://github.com/ArcticaProject/nx-libs/issues], [libNX_X11])
5 AC_CONFIG_AUX_DIR([build-aux])
6 AC_CONFIG_SRCDIR([Makefile.am])
7 AC_CONFIG_HEADERS([src/config.h include/X11/XlibConf.h])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CANONICAL_BUILD
10 AC_CANONICAL_HOST
11 # Set common system defines for POSIX extensions, such as _GNU_SOURCE
12 # Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
13 # to avoid autoconf errors.
14 AC_USE_SYSTEM_EXTENSIONS
15
16 # Initialize Automake
17 AM_INIT_AUTOMAKE([foreign dist-xz])
18
19 # Initialize libtool
20 AC_PROG_LIBTOOL
21
22 # Upstream's pkg.m4 (since 0.27) offers this now, but define our own
23 # compatible version in case the local version of pkgconfig isn't new enough.
24 # https://bugs.freedesktop.org/show_bug.cgi?id=48743
25 m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR],
26 [AC_ARG_WITH([pkgconfigdir],
27 [AS_HELP_STRING([--with-pkgconfigdir],
28 [install directory for nx-x11.pc pkg-config file])],
29 [],[with_pkgconfigdir='$(libdir)/pkgconfig'])
30 AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])])
31
32 NX_COMPILER_BRAND
33 NX_DEFAULT_OPTIONS
34
35 # Required when PKG_CHECK_MODULES called within an if statement
36 PKG_PROG_PKG_CONFIG
37
38 if test x"$CC_FOR_BUILD" = x; then
39 if test x"$cross_compiling" = xyes; then
40 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
41 else
42 CC_FOR_BUILD="$CC"
43 fi
44 fi
45 AC_SUBST([CC_FOR_BUILD])
46
47 if test x"$CPPFLAGS_FOR_BUILD" = x; then
48 if test ! x"$cross_compiling" = xyes; then
49 CPPFLAGS_FOR_BUILD=${CPPFLAGS}
50 fi
51 fi
52 AC_SUBST(CPPFLAGS_FOR_BUILD)
53
54 if test x"$CFLAGS_FOR_BUILD" = x; then
55 if test ! x"$cross_compiling" = xyes; then
56 CFLAGS_FOR_BUILD=${CFLAGS}
57 fi
58 fi
59 AC_SUBST(CFLAGS_FOR_BUILD)
60
61 if test x"$LDFLAGS_FOR_BUILD" = x; then
62 if test ! x"$cross_compiling" = xyes; then
63 LDFLAGS_FOR_BUILD=${LDFLAGS}
64 fi
65 fi
66 AC_SUBST(LDFLAGS_FOR_BUILD)
67
68 if test x"$EXEEXT_FOR_BUILD" = x; then
69 if test x"$cross_compiling" = xno; then
70 EXEEXT_FOR_BUILD=${EXEEXT}
71 fi
72 # If cross-compiling and not provided, assume EXEEXT_FOR_BUILD is empty
73 fi
74 AC_SUBST([EXEEXT_FOR_BUILD])
75
76 # Checks for pkg-config packages
77
78 # Always required
79 X11_REQUIRES='nx-xproto nx-xextproto nx-xtrans'
80 X11_EXTRA_DEPS=""
81
82 X11_REQUIRES="${X11_REQUIRES} xau xcmiscproto bigreqsproto"
83 X11_EXTRA_DEPS="xau"
84 PKG_CHECK_MODULES(XDMCP, xdmcp,
85 AC_CHECK_LIB(Xdmcp, XdmcpWrap,
86 [
87 AC_CHECK_LIB(Xdmcp, XdmcpWrap, [xdmauth="yes"], [xdmauth="no"], [$XDMCP_LIBS])
88 X11_EXTRA_DEPS="$X11_EXTRA_DEPS xdmcp"
89 ],
90 [
91 XDMCP_CFLAGS=
92 XDMCP_LIBS=
93 ], [$XDMCP_LIBS]),
94 [AC_MSG_RESULT(no)])
95 AC_SUBST(X11_EXTRA_DEPS)
96
97 # Silence warning: ar: 'u' modifier ignored since 'D' is the default
98 AC_SUBST(AR_FLAGS, [cr])
99
100 # Issue an error if nx-xtrans.m4 was not found and NX_XTRANS_CONNECTION_FLAGS macro
101 # was not expanded, since libNX_X11 with no transport types is rather useless.
102 #
103 # If you're seeing an error here, be sure you installed the nx-xtrans module
104 # first and if it's not in the default location, that you set the ACLOCAL
105 # environment variable to find it, such as:
106 # ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
107 m4_pattern_forbid([^NX_XTRANS_CONNECTION_FLAGS$])
108
109 # Transport selection macro from nx-xtrans.m4
110 NX_XTRANS_CONNECTION_FLAGS
111
112 # Secure RPC detection macro from xtrans.m4
113 NX_XTRANS_SECURE_RPC_FLAGS
114
115 # Original comments regarding FAIL_HARD from libxtrans:
116 # "fail hard if socket directories cannot be chowned to root or
117 # chmod'ed to the requested mode if 'sticky' bit is requested for this
118 # directory instead of just print a warning that will remain unnoticed
119 # most of the times.
120 # Set the define XtransFailSoft to restore the old
121 # behavior to fail softly when socket directory cannot chowned/chmod
122 # to correct user/group."
123 #
124 # -> we want to always fail in that scenario.
125 AC_DEFINE(FAIL_HARD,1,[Fail if the xtrans socket directory cannot be chowned/chmod'ed])
126
127 # Actually disable all of the FD passing code, NX does not support it.
128 AC_DEFINE(XTRANS_SEND_FDS,0,[Disable xtrans FD passing code.])
129
130 # Check for dlopen
131 AC_MSG_CHECKING([if run-time linking is supported])
132 AC_SEARCH_LIBS(dlopen,[dl svld])
133 if test "x$ac_cv_search_dlopen" = xno; then
134 AC_SEARCH_LIBS(shl_load,[dld])
135 if test "x$ac_cv_search_shl_load" != xno; then
136 AC_DEFINE(HAVE_SHL_LOAD,1,
137 [Use shl_load to load shared libraries])
138 AC_CHECK_HEADERS([dl.h])
139 fi
140 else
141 AC_DEFINE(HAVE_DLOPEN,1,[Use dlopen to load shared libraries])
142 AC_CHECK_HEADERS([dlfcn.h])
143 fi
144 if test "x$ac_cv_header_dlfcn_h" = xyes -o "x$ac_cv_header_dl_h" = xyes; then
145 HAVE_LOADABLE_MODULES=yes
146 else
147 HAVE_LOADABLE_MODULES=no
148 fi
149 AC_MSG_RESULT($HAVE_LOADABLE_MODULES)
150
151 AC_MSG_CHECKING([if loadable Xcursor library support should be enabled])
152 AC_ARG_ENABLE(loadable-xcursor,
153 AS_HELP_STRING([--disable-loadable-xcursor],
154 [Controls loadable xcursor library support]),
155 [XLIB_LOADABLE_XCURSOR=$enableval],
156 [XLIB_LOADABLE_XCURSOR=$HAVE_LOADABLE_MODULES])
157 if test x$XLIB_LOADABLE_XCURSOR = xyes; then
158 AC_DEFINE(USE_DYNAMIC_XCURSOR,1,
159 [Use the X cursor library to load cursors])
160 fi
161 AC_MSG_RESULT($XLIB_LOADABLE_XCURSOR)
162
163 # Checks for header files.
164 AC_CHECK_HEADERS([sys/filio.h sys/select.h sys/ioctl.h sys/socket.h])
165
166 # Checks for typedefs, structures, and compiler characteristics.
167 AX_GCC_BUILTIN([__builtin_popcountl])
168
169 # Checks for library functions.
170 AC_CHECK_FUNCS([strtol seteuid])
171 AC_REPLACE_FUNCS([reallocarray])
172 # Used in lcFile.c (see also --enable-xlocaledir settings below)
173 XLOCALEDIR_IS_SAFE="no"
174 AC_CHECK_DECL([issetugid])
175 AC_CHECK_FUNC([issetugid])
176 if test "$ac_cv_have_decl_issetugid" = yes && test "$ac_cv_func_issetugid" = yes; then
177 XLOCALEDIR_IS_SAFE="yes"
178 AC_DEFINE(HASSETUGID,1,[Has issetugid() function])
179 fi
180 AC_CHECK_FUNC([getresuid], [XLOCALEDIR_IS_SAFE="yes"]
181 AC_DEFINE(HASGETRESUID,1,[Has getresuid() & getresgid() functions]))
182 # Used in Font.c
183 AC_CHECK_FUNC([shmat], AC_DEFINE(HAS_SHM,1,[Has shm*() functions]))
184
185 # Checks for system services
186 # AC_PATH_XTRA
187
188 # Threading support...
189
190 AC_ARG_ENABLE(xthreads,
191 AS_HELP_STRING([--disable-xthreads],
192 [Disable Xlib support for Multithreading]),
193 [xthreads=$enableval],[xthreads=yes])
194
195 AC_CHECK_LIB(c, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"])
196
197 case x$xthreads in
198 xyes)
199 AC_DEFINE(XTHREADS,1,[Whether libNX_X11 is compiled with thread support])
200 if test x$mtsafeapi = xyes
201 then
202 AC_DEFINE(XUSE_MTSAFE_API,1,[Whether libNX_X11 needs to use MT safe API's])
203 fi
204 ;;
205 *)
206 ;;
207 esac
208
209 AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"])
210 AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes)
211
212 # XXX incomplete, please fill this in
213 if test x$xthreads = xyes ; then
214 case $host_os in
215 linux*|gnu*|k*bsd*-gnu)
216 XTHREADLIB=-lpthread ;;
217 netbsd*)
218 XTHREAD_CFLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS"
219 XTHREADLIB="-lpthread" ;;
220 freebsd*)
221 XTHREAD_CFLAGS="-D_THREAD_SAFE"
222 XTHREADLIB="-pthread" ;;
223 dragonfly*|openbsd*)
224 XTHREADLIB="-pthread" ;;
225 solaris*)
226 XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;;
227 esac
228 fi
229 AC_SUBST(XTHREADLIB)
230 AC_SUBST(XTHREAD_CFLAGS)
231
232 case x$xdmauth in
233 xyes)
234 XDMCP_CFLAGS="$XDMCP_CFLAGS -DHASXDMAUTH"
235 ;;
236 xno)
237 XDMCP_LIBS=""
238 ;;
239 esac
240 AC_SUBST(XDMCP_CFLAGS)
241 AC_SUBST(XDMCP_LIBS)
242
243 AC_CHECK_FUNC(poll, [has_poll="yes"], [has_poll="no"])
244
245 AC_ARG_ENABLE([poll],
246 AS_HELP_STRING([--disable-poll],
247 [Disable poll() usage in XlibInt]),
248 AS_IF([test "x$enable_poll" = "xno"],
249 [want_poll="no"], [want_poll="yes"]),
250 [want_poll="yes"])
251
252 if test x"$has_poll" = "xyes" && test x"$want_poll" = "xyes"; then
253 use_poll="yes"
254 AC_DEFINE(USE_POLL,1,[Enable using the poll() function in XlibInt])
255 else
256 use_poll="no"
257 fi
258
259 #
260 # Find keysymdef.h
261 #
262 AC_MSG_CHECKING([keysym definitions])
263 AC_ARG_WITH([keysymdefdir],
264 [AC_HELP_STRING([--with-keysymdefdir=DIR], [The location of keysymdef.h (defaults to xproto include dir)])],
265 [KEYSYMDEFDIR=$withval],
266 [KEYSYMDEFDIR=`pwd`/../include])
267
268 if test ! -d "$KEYSYMDEFDIR"; then
269 AC_MSG_ERROR([$KEYSYMDEFDIR doesn't exist or isn't a directory])
270 fi
271
272 FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h"
273 for i in $FILES; do
274 if test -f "$KEYSYMDEFDIR/$i"; then
275 KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i"
276 elif test "x$i" = "xkeysymdef.h"; then
277 AC_MSG_ERROR([Cannot find keysymdef.h])
278 fi
279 done
280 AC_MSG_RESULT([$KEYSYMDEFS])
281 AC_SUBST(KEYSYMDEFS)
282
283 AC_ARG_ENABLE(xcms,
284 AS_HELP_STRING([--disable-xcms],
285 [Disable Xlib support for CMS *EXPERIMENTAL*]),
286 [XCMS=$enableval],[XCMS=yes])
287 AM_CONDITIONAL(XCMS, [test x$XCMS = xyes ])
288 if test x"$XCMS" = "xyes"; then
289 AC_DEFINE(XCMS,1,[Include support for XCMS])
290 fi
291
292 AC_ARG_ENABLE(xlocale,
293 AS_HELP_STRING([--disable-xlocale],
294 [Disable Xlib locale implementation *EXPERIMENTAL*]),
295 [XLOCALE=$enableval],[XLOCALE=yes])
296
297 AM_CONDITIONAL(XLOCALE, [ test x$XLOCALE = xyes ])
298 if test x"$XLOCALE" = "xyes"; then
299 AC_DEFINE(XLOCALE,1,[support for X Locales])
300 fi
301
302 # This disables XLOCALEDIR. Set it if you're using BuildLoadableXlibI18n,
303 # don't have either issetugid() or getresuid(), and you need to protect
304 # clients that are setgid or setuid to an id other than 0.
305 AC_MSG_CHECKING([if XLOCALEDIR support should be enabled])
306 AC_ARG_ENABLE(xlocaledir,
307 AS_HELP_STRING([--enable-xlocaledir],
308 [Enable XLOCALEDIR environment variable support]),
309 [ENABLE_XLOCALEDIR=$enableval],[ENABLE_XLOCALEDIR=$XLOCALEDIR_IS_SAFE])
310 if test "x$ENABLE_XLOCALEDIR" = "xno"; then
311 AC_DEFINE(NO_XLOCALEDIR,1,[Disable XLOCALEDIR environment variable])
312 fi
313 AC_MSG_RESULT($ENABLE_XLOCALEDIR)
314
315 AC_ARG_ENABLE(xf86bigfont,
316 AS_HELP_STRING([--disable-xf86bigfont],
317 [Disable XF86BigFont extension support]),
318 [XF86BIGFONT=$enableval],[XF86BIGFONT="yes"])
319 if test "x$XF86BIGFONT" = "xyes"; then
320 # FIXME: Skip check for proto headers for now... Requires .pc files for all the proto
321 # header packages we have. Keeping that in mind for later...
322 # PKG_CHECK_MODULES(BIGFONT, [xf86bigfontproto >= 1.2.0],
323 AC_DEFINE(XF86BIGFONT,1,[Enable XF86BIGFONT extension])
324 # ,XF86BIGFONT="no")
325 fi
326
327 AC_ARG_ENABLE(xkb,
328 AS_HELP_STRING([--disable-xkb],
329 [Disable XKB support *EXPERIMENTAL*]),
330 [XKB=$enableval],[XKB=yes])
331
332 AM_CONDITIONAL(XKB, [ test x$XKB = xyes ])
333 if test x"$XKB" = "xyes"; then
334 XKBPROTO_REQUIRES="kbproto"
335 X11_REQUIRES="${X11_REQUIRES} kbproto inputproto"
336 AC_DEFINE(XKB,1,[Use XKB])
337 else
338 XKBPROTO_REQUIRES=""
339 fi
340 AC_SUBST(XKBPROTO_REQUIRES)
341
342 AC_FUNC_MMAP()
343 composecache_default=$ac_cv_func_mmap_fixed_mapped
344 AC_CHECK_FUNC(nl_langinfo, , [composecache_default=no])
345 AC_ARG_ENABLE(composecache,
346 AS_HELP_STRING([--disable-composecache],
347 [Disable compose table cache support]),
348 [COMPOSECACHE=$enableval],[COMPOSECACHE=$composecache_default])
349 if test x"$COMPOSECACHE" = "xyes"; then
350 AC_DEFINE(COMPOSECACHE,1,[Include compose table cache support])
351 fi
352
353 X11_DATADIR="${datadir}/nx/X11"
354 AX_DEFINE_DIR(X11_DATADIR, X11_DATADIR, [Location of libNX_X11 data])
355 AC_SUBST(X11_DATADIR)
356
357 X11_LIBDIR="${libdir}"
358 AX_DEFINE_DIR(X11_LIBDIR, X11_LIBDIR, [Location of libNX_X11 library data])
359 AC_SUBST(X11_LIBDIR)
360
361 # FIXME: Skip check for proto headers for now... Requires .pc files for all the proto
362 # header packages we have. Keeping that in mind for later...
363 #PKG_CHECK_MODULES(X11, [$X11_REQUIRES])
364 X11_CFLAGS="$X11_CFLAGS $XTHREAD_CFLAGS $BASE_CFLAGS"
365
366 #
367 # Yes, it would be nice to put the locale data in
368 # /usr/share, but the locale stuff includes loadable
369 # libraries which must be located in the same directory
370 # as the other locale data, so for now, everything lives
371 # in ${libdir}
372 #
373
374 AC_ARG_WITH(locale-lib-dir, AS_HELP_STRING([--with-locale-lib-dir=DIR],
375 [Directory where locale libraries files are installed (default: $libdir/X11/locale)]),
376 [ X11_LOCALELIBDIR="$withval" ],
377 [ X11_LOCALELIBDIR="${X11_LIBDIR}/locale" ])
378 AX_DEFINE_DIR(XLOCALELIBDIR, X11_LOCALELIBDIR, [Location of libNX_X11 locale libraries])
379 AC_SUBST(X11_LOCALELIBDIR)
380
381 AC_ARG_WITH(locale-data-dir, AS_HELP_STRING([--with-locale-data-dir=DIR],
382 [Directory where locale data files are installed (default: /usr/share/X11/locale)]),
383 [ X11_LOCALEDATADIR="$withval" ],
384 [ X11_LOCALEDATADIR="/usr/share/X11/locale" ])
385 AX_DEFINE_DIR(XLOCALEDATADIR, X11_LOCALEDATADIR, [Location of libNX_X11 locale data files])
386 AC_SUBST(X11_LOCALEDATADIR)
387
388 X11_LOCALEDIR="${X11_LOCALEDATADIR}"
389 AX_DEFINE_DIR(XLOCALEDIR, X11_LOCALEDIR, [Location of libNX_X11 locale data])
390 AC_SUBST(X11_LOCALEDIR)
391
392 XERRORDB="${X11_DATADIR}/XErrorDB"
393 AX_DEFINE_DIR(XERRORDB, XERRORDB, [Location of error message database])
394
395 NX_CHECK_MALLOC_ZERO
396
397 AC_CONFIG_FILES([include/Makefile
398 modules/im/ximcp/Makefile
399 modules/im/Makefile
400 modules/lc/gen/Makefile
401 modules/lc/def/Makefile
402 modules/lc/Utf8/Makefile
403 modules/lc/Makefile
404 modules/om/generic/Makefile
405 modules/om/Makefile
406 modules/Makefile
407 src/util/Makefile
408 src/xcms/Makefile
409 src/xkb/Makefile
410 src/xlibi18n/Makefile
411 src/Makefile
412 Makefile
413 nx-x11.pc])
414 AC_OUTPUT
415
416 echo ""
417 echo "NX_X11 will be built with the following settings:"
418 echo " Loadable xcursor library support: "$XLIB_LOADABLE_XCURSOR
419 echo " Threading support: "$xthreads
420 echo " Use Threads safe API: "$mtsafeapi
421 echo " Threads stubs in libNX_X11: "$thrstubs
422 echo " USE_POLL: "$use_poll
423 echo " XCMS: "$XCMS
424 echo " Internationalization support: "$XLOCALE
425 echo " XF86BigFont support: "$XF86BIGFONT
426 echo " XKB support: "$XKB
427 echo " XLOCALEDIR environment variable support: "$ENABLE_XLOCALEDIR
428 echo " Compose table cache enabled: "$COMPOSECACHE
429 echo ""