13544ea2eSmrgdnl Process this file with autoconf to create configure.
264ce7165Smrg
33544ea2eSmrg# Initialize Autoconf
4169a0819SmrgAC_PREREQ([2.60])
5b71ad168SmrgAC_INIT([xhost], [1.0.9],
6b71ad168Smrg        [https://gitlab.freedesktop.org/xorg/app/xhost/-/issues], [xhost])
73544ea2eSmrgAC_CONFIG_SRCDIR([Makefile.am])
83544ea2eSmrgAC_CONFIG_HEADERS([config.h])
93544ea2eSmrg
103544ea2eSmrg# Initialize Automake
11b71ad168SmrgAM_INIT_AUTOMAKE([foreign dist-xz])
1295fdd44cSmrg
1395fdd44cSmrg# Set common system defines for POSIX extensions, such as _GNU_SOURCE
1495fdd44cSmrg# Must be called before any macros that run the compiler (like
1595fdd44cSmrg# XORG_DEFAULT_OPTIONS) to avoid autoconf errors.
1695fdd44cSmrgAC_USE_SYSTEM_EXTENSIONS
1764ce7165Smrg
18169a0819Smrg# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
19fb23d3a8Smrgm4_ifndef([XORG_MACROS_VERSION],
20169a0819Smrg	  [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
21169a0819SmrgXORG_MACROS_VERSION(1.8)
223544ea2eSmrgXORG_DEFAULT_OPTIONS
2364ce7165Smrg
2464ce7165Smrg# Checks for pkg-config packages
253544ea2eSmrg# - Both CFLAGS & LIBS needed:
2681440437SmrgPKG_CHECK_MODULES(XHOST, [xproto >= 7.0.22 x11 xmuu])
273544ea2eSmrg# - Only CFLAGS needed, not libs:
283544ea2eSmrgPKG_CHECK_MODULES(XAU, xau)
2964ce7165Smrg
3064ce7165Smrg# Transport selection macro from xtrans.m4
3164ce7165SmrgXTRANS_CONNECTION_FLAGS
3264ce7165Smrg
3364ce7165Smrg# Secure RPC detection macro from xtrans.m4
3464ce7165SmrgXTRANS_SECURE_RPC_FLAGS
3564ce7165Smrg
3681440437Smrg# Link with winsock if mingw target
3781440437Smrgcase $host_os in
3881440437Smrg *mingw*)
3981440437Smrg  AC_CHECK_LIB([ws2_32],[main])
4081440437Smrg  ;;
4181440437Smrg *)
4281440437Smrg  ;;
4381440437Smrgesac
4481440437Smrg
45aadd013eSmrg# Checks for library functions.
46aadd013eSmrgAC_CHECK_FUNCS([inet_aton])
47aadd013eSmrg
48b71ad168Smrg# Internationalization & localization support
49b71ad168SmrgAC_SEARCH_LIBS([gettext], [intl], [USE_GETTEXT="yes"], [USE_GETTEXT="no"])
50b71ad168SmrgAC_MSG_CHECKING([where to install localized messages])
51b71ad168SmrgAC_ARG_WITH([localedir], AS_HELP_STRING([--with-localedir=<path>],
52b71ad168Smrg	[Path to install message files in (default: datadir/locale)]),
53b71ad168Smrg	[LOCALEDIR=${withval}], [LOCALEDIR=${datadir}/locale])
54b71ad168Smrgif test "x$LOCALEDIR" = "xno" -o "x$USE_GETTEXT" = "xno" ; then
55b71ad168Smrg	AC_MSG_RESULT([nowhere])
56b71ad168Smrg	USE_GETTEXT="no"
57b71ad168Smrgelse
58b71ad168Smrg	AC_SUBST([LOCALEDIR])
59b71ad168Smrg	AC_MSG_RESULT([$LOCALEDIR])
60b71ad168Smrgfi
61b71ad168Smrg
62b71ad168Smrgif test "x$USE_GETTEXT" = "xyes" ; then
63b71ad168Smrg	AC_DEFINE([USE_GETTEXT], 1,
64b71ad168Smrg		  [Define to 1 if you want to use the gettext() function.])
65b71ad168Smrgfi
66b71ad168SmrgAM_CONDITIONAL(USE_GETTEXT, test "x$USE_GETTEXT" = "xyes")
67b71ad168Smrg
68b71ad168Smrg
693544ea2eSmrgAC_CONFIG_FILES([
703544ea2eSmrg	Makefile
713544ea2eSmrg	man/Makefile])
723544ea2eSmrgAC_OUTPUT
73