1dnl  Copyright 2005 Red Hat, Inc.
2dnl 
3dnl  Permission to use, copy, modify, distribute, and sell this software and its
4dnl  documentation for any purpose is hereby granted without fee, provided that
5dnl  the above copyright notice appear in all copies and that both that
6dnl  copyright notice and this permission notice appear in supporting
7dnl  documentation, and that the name of Red Hat not be used in
8dnl  advertising or publicity pertaining to distribution of the software without
9dnl  specific, written prior permission.  Red Hat makes no
10dnl  representations about the suitability of this software for any purpose.  It
11dnl  is provided "as is" without express or implied warranty.
12dnl 
13dnl  RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15dnl  EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19dnl  PERFORMANCE OF THIS SOFTWARE.
20dnl
21dnl Process this file with autoconf to create configure.
22
23# Initialize Autoconf
24AC_PREREQ([2.60])
25AC_INIT([xfs],
26        [1.2.2],
27        [https://gitlab.freedesktop.org/xorg/app/xfs/-/issues],
28        [xfs])
29# Set common system defines for POSIX extensions, such as _GNU_SOURCE
30# Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
31AC_USE_SYSTEM_EXTENSIONS
32AC_CONFIG_HEADERS([config.h])
33AC_CONFIG_MACRO_DIR([m4])
34
35# Initialize Automake
36AM_INIT_AUTOMAKE([foreign dist-xz subdir-objects])
37
38# Require xorg-macros minimum of 1.10 for HAVE_STYLESHEETS in XORG_CHECK_SGML_DOCTOOLS
39m4_ifndef([XORG_MACROS_VERSION],
40	  [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
41XORG_MACROS_VERSION(1.10)
42XORG_DEFAULT_OPTIONS
43XORG_ENABLE_DEVEL_DOCS
44XORG_WITH_XMLTO(0.0.20)
45XORG_WITH_FOP
46XORG_CHECK_SGML_DOCTOOLS(1.5)
47XORG_WITH_LINT
48
49# Checks for typedefs, structures, and compiler characteristics.
50AC_SYS_LARGEFILE
51
52AC_CHECK_HEADERS([stdint.h])
53
54AC_ARG_WITH(default-config-file,
55	AS_HELP_STRING([--with-default-config-file=PATH],
56   [comma-separated list of paths to look for config file when not specified (default: ${sysconfdir}/X11/fs/config)]),
57	[CONFIG_FILE="$withval"], [CONFIG_FILE="${sysconfdir}/X11/fs/config"])
58
59DEFAULT_CONFIG_FILE=`echo ${CONFIG_FILE} | sed 's/,/\\\\\\\\\\\",\\\\\\\\\\\"/'g`
60AX_DEFINE_DIR([DEFAULT_CONFIG_FILE], DEFAULT_CONFIG_FILE,
61    [comma-separated list of strings for config file paths when not specified])
62
63# generate text for the man page
64case $CONFIG_FILE in
65    *,*)
66	CONFIG_FILE_DESC="the first file found from the list:"
67	CONFIG_FILE_PATH=`echo ${CONFIG_FILE} | sed 's/,/\\\\\\\\fR, \\\\\\\\fI/g'`
68	;;
69    *)
70	CONFIG_FILE_DESC="the default file,"
71	CONFIG_FILE_PATH="${CONFIG_FILE}"
72	;;
73esac
74AC_SUBST([CONFIG_FILE_DESC])
75AC_SUBST([CONFIG_FILE_PATH])
76
77# Require X.Org's font util macros 1.1 or later for XORG_FONTROOTDIR
78m4_ifndef([XORG_FONT_MACROS_VERSION],
79	  [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
80XORG_FONT_MACROS_VERSION(1.1)
81
82XORG_FONTROOTDIR
83XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
84XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
85XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
86XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
87XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
88XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)
89
90# Determine font path to put in config file
91# Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
92# otherwise uses standard subdirectories of FONTROOTDIR. When cross
93# compiling, assume default font path uses standard FONTROOTDIR directories.
94DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
95if test "$cross_compiling" != yes; then
96	AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
97		[DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'],
98		[case $host_os in
99			darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
100		esac])
101fi
102AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
103				[ FONTPATH="$withval" ],
104				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
105
106AC_MSG_CHECKING([for default font path])
107AC_MSG_RESULT([$FONTPATH])
108
109AC_SUBST([FONTPATH])
110
111# Option to enable support for starting from inetd
112AC_ARG_ENABLE(inetd,
113	AS_HELP_STRING([--enable-inetd],
114	    [Support -inetd flag for starting from inetd (default: enabled)]),
115	    [INETD=$enableval], [INETD=yes])
116if test "x$INETD" = xyes; then
117        AC_DEFINE(XFS_INETD, 1, [Build support for starting from inetd])
118fi
119
120# Option to enable support for logging to syslog
121AC_ARG_ENABLE(syslog,
122	AS_HELP_STRING([--enable-syslog],
123	    [Support option for logging via syslog (default: enabled)]),
124	    [SYSLOG=$enableval], [SYSLOG=yes])
125if test "x$SYSLOG" = xyes; then
126        AC_DEFINE(USE_SYSLOG, 1, [Build support for logging via syslog])
127fi
128
129
130# Checks for system functions / libraries
131AC_CHECK_FUNCS([daemon])
132
133# Checks for pkg-config packages
134#  - xproto >= 7.0.25 required for _X_COLD in <X11/Xfuncproto.h>
135#  - xfont >= 2.0.1 for new server API
136PKG_CHECK_MODULES(XFS, xproto >= 7.0.25 xfont2 >= 2.0.1 xtrans)
137
138case "$host_os" in
139  cygwin*|mingw*)
140    CFLAGS="$CFLAGS -DFD_SETSIZE=256"
141    LDFLAGS="$LDFLAGS -Wl,--export-all" ;;
142esac
143
144# Transport selection macro from xtrans.m4
145XTRANS_CONNECTION_FLAGS
146
147AC_CONFIG_FILES([Makefile
148                 config/Makefile
149                 doc/Makefile
150                 man/Makefile])
151AC_OUTPUT
152