1313a12fdSmrg#
2313a12fdSmrg#  Copyright © 2003 Keith Packard, Noah Levitt
3313a12fdSmrg#
4313a12fdSmrg#  Permission to use, copy, modify, distribute, and sell this software and its
5313a12fdSmrg#  documentation for any purpose is hereby granted without fee, provided that
6313a12fdSmrg#  the above copyright notice appear in all copies and that both that
7313a12fdSmrg#  copyright notice and this permission notice appear in supporting
8313a12fdSmrg#  documentation, and that the name of Keith Packard not be used in
9313a12fdSmrg#  advertising or publicity pertaining to distribution of the software without
10313a12fdSmrg#  specific, written prior permission.  Keith Packard makes no
11313a12fdSmrg#  representations about the suitability of this software for any purpose.  It
12313a12fdSmrg#  is provided "as is" without express or implied warranty.
13313a12fdSmrg#
14313a12fdSmrg#  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15313a12fdSmrg#  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16313a12fdSmrg#  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17313a12fdSmrg#  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18313a12fdSmrg#  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19313a12fdSmrg#  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20313a12fdSmrg#  PERFORMANCE OF THIS SOFTWARE.
21313a12fdSmrg#
2227702724Smrg
23313a12fdSmrg# Initialize Autoconf
2400084f2cSmrgAC_PREREQ([2.60])
25ae545d91SmrgAC_INIT([libXau], [1.0.12],
2695b7a5c8Smrg	[https://gitlab.freedesktop.org/xorg/lib/libxau/-/issues], [libXau])
27313a12fdSmrgAC_CONFIG_SRCDIR([Makefile.am])
28313a12fdSmrgAC_CONFIG_HEADERS([config.h])
29ae545d91SmrgAC_CONFIG_MACRO_DIRS([m4])
30313a12fdSmrgAC_USE_SYSTEM_EXTENSIONS
31313a12fdSmrg
32313a12fdSmrg# Initialize Automake
3395b7a5c8SmrgAM_INIT_AUTOMAKE([foreign dist-xz])
3427702724Smrg
35313a12fdSmrg# Initialize libtool
36ae545d91SmrgLT_INIT([win32-dll])
3727702724Smrg
38313a12fdSmrg# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
3900084f2cSmrgm4_ifndef([XORG_MACROS_VERSION],
40313a12fdSmrg          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
41313a12fdSmrgXORG_MACROS_VERSION(1.8)
4200084f2cSmrgXORG_DEFAULT_OPTIONS
4327702724Smrg
44313a12fdSmrg# Checks for programs.
4527702724SmrgAC_PROG_LN_S
4627702724Smrg
47313a12fdSmrg# Checks for library functions.
48ae545d91SmrgAC_CHECK_FUNCS([explicit_bzero explicit_memset pathconf])
49313a12fdSmrg
5095b7a5c8Smrg# Obtain compiler/linker options for dependencies
5127702724SmrgPKG_CHECK_MODULES(XAU, xproto)
5227702724Smrg
53630e437aSmrg# Checks for typedefs, structures, and compiler characteristics.
54630e437aSmrgAC_SYS_LARGEFILE
55630e437aSmrg
5627702724SmrgAC_ARG_ENABLE(xthreads,
57313a12fdSmrg              AS_HELP_STRING([--disable-xthreads],
5827702724Smrg                [Disable libXau support for Multithreading]),
5927702724Smrg              [xthreads=$enableval],[xthreads=yes])
6027702724Smrg
6127702724Smrgif test "x$xthreads" = "xyes" ; then
6227702724Smrg    AC_DEFINE(XTHREADS,1,[Whether libXau is compiled with thread support])
63e19dfac4Smrg    AC_CHECK_LIB(c, gethostbyname_r, [mtsafe=yes])
64e19dfac4Smrg    if test "x$mtsafe" = "x" ; then
65e19dfac4Smrg	AC_CHECK_LIB(nsl, gethostbyname_r, [mtsafe=yes])
66e19dfac4Smrg    fi
67e19dfac4Smrg    if test "x$mtsafe" = "xyes" ; then
68313a12fdSmrg	AC_DEFINE(XUSE_MTSAFE_API, 1,
69e19dfac4Smrg		  [Whether libXau needs to use MT safe API's])
70e19dfac4Smrg    fi
7127702724Smrg
72313a12fdSmrg# XXX incomplete, please fill this in
7327702724Smrg    case $host_os in
7427702724Smrg    solaris*)
7527702724Smrg	XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;;
7627702724Smrg    esac
7727702724Smrg    XAU_CFLAGS="$XAU_CFLAGS $XTHREAD_CFLAGS"
7827702724Smrgfi
7927702724Smrg
80313a12fdSmrg# Allow checking code with lint, sparse, etc.
8127702724SmrgXORG_WITH_LINT
8227702724SmrgXORG_LINT_LIBRARY([Xau])
8327702724SmrgLINT_FLAGS="${LINT_FLAGS} ${XAU_CFLAGS}"
8427702724Smrg
85313a12fdSmrgAC_CONFIG_FILES([Makefile
86313a12fdSmrg		man/Makefile
87313a12fdSmrg		xau.pc])
88313a12fdSmrgAC_OUTPUT
89