configure.ac revision 1c235774
1
2# Initialize Autoconf
3AC_PREREQ([2.60])
4AC_INIT([libXpm], [3.5.15],
5        [https://gitlab.freedesktop.org/xorg/lib/libxpm/-/issues], [libXpm])
6AC_CONFIG_SRCDIR([Makefile.am])
7AC_CONFIG_HEADERS([config.h])
8AC_CONFIG_MACRO_DIR([m4])
9
10# Initialize Automake
11AM_INIT_AUTOMAKE([foreign dist-xz])
12
13# Initialize libtool
14AC_PROG_LIBTOOL
15
16# Require X.Org macros 1.16 or later for XORG_MEMORY_CHECK_FLAGS
17m4_ifndef([XORG_MACROS_VERSION],
18          [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
19XORG_MACROS_VERSION(1.16)
20XORG_DEFAULT_OPTIONS
21
22# Checks for library functions
23AC_CHECK_FUNCS([strlcat])
24AC_CHECK_FUNC([fork],[], AC_DEFINE(NO_ZPIPE))
25
26# Obtain compiler/linker options for dependencies
27PKG_CHECK_MODULES(XPM, xproto x11)
28PKG_CHECK_MODULES(SXPM, [x11 xt xext xextproto xproto >= 7.0.17],
29                  [build_sxpm=true], [build_sxpm=false])
30AM_CONDITIONAL(BUILD_SXPM, test x$build_sxpm = xtrue)
31
32# Internationalization & localization support
33AC_SEARCH_LIBS([gettext], [intl], [USE_GETTEXT="yes"], [USE_GETTEXT="no"])
34AC_MSG_CHECKING([where to install localized messages])
35AC_ARG_WITH([localedir], AS_HELP_STRING([--with-localedir=<path>],
36	[Path to install message files in (default: datadir/locale)]),
37	[LOCALEDIR=${withval}], [LOCALEDIR=${datadir}/locale])
38AX_DEFINE_DIR([LOCALEDIR], [LOCALEDIR], [Location of translated messages])
39if test "x$LOCALEDIR" = "xno" -o "x$USE_GETTEXT" = "xno" ; then
40	AC_MSG_RESULT([nowhere])
41	USE_GETTEXT="no"
42else
43	AC_MSG_RESULT([$LOCALEDIR])
44fi
45
46if test "x$USE_GETTEXT" = "xyes" ; then
47	AC_DEFINE([USE_GETTEXT], 1,
48		  [Define to 1 if you want to use the gettext() function.])
49fi
50AM_CONDITIONAL(USE_GETTEXT, test "x$USE_GETTEXT" = "xyes")
51
52dnl Helper macro to find absolute path to program and add a #define for it
53AC_DEFUN([XPM_PATH_PROG],[
54AC_PATH_PROG([$1], [$2], [])
55AS_IF([test "x$$1" = "x"],
56      [AC_MSG_ERROR([$2 not found, set $1 or use --disable-stat-zfile])])
57AC_DEFINE_UNQUOTED([$1], ["$$1"], [Path to $2])
58]) dnl End of AC_DEFUN([XPM_PATH_PROG]...
59
60# Optional feature: When a filename ending in .Z or .gz is requested,
61# open a pipe to a newly forked compress/uncompress/gzip command to
62# handle it.
63AC_MSG_CHECKING([whether to handle compressed pixmaps])
64case $host_os in
65        *mingw*)        zpipe_default="no" ;;
66        *)              zpipe_default="yes" ;;
67esac
68AC_ARG_ENABLE(open-zfile,
69        AS_HELP_STRING([--enable-open-zfile],
70                        [Search for files with .Z & .gz extensions automatically @<:@default=auto@:>@]),
71              [OPEN_ZFILE=$enableval], [OPEN_ZFILE=yes])
72AC_MSG_RESULT([$OPEN_ZFILE])
73AM_CONDITIONAL(COMPRESSED_PIXMAPS, test "x$OPEN_ZFILE" = "xyes")
74if test x$OPEN_ZFILE = xno ; then
75        AC_DEFINE(NO_ZPIPE, 1, [Define to 1 to disable decompression via pipes])
76else
77        XPM_PATH_PROG([XPM_PATH_COMPRESS], [compress])
78        XPM_PATH_PROG([XPM_PATH_UNCOMPRESS], [uncompress])
79        XPM_PATH_PROG([XPM_PATH_GZIP], [gzip])
80        AC_CHECK_FUNCS([closefrom close_range], [break])
81fi
82
83# Optional feature: When ___.xpm is requested, also look for ___.xpm.Z & .gz
84# Replaces ZFILEDEF = -DSTAT_ZFILE in old Imakefile
85AC_MSG_CHECKING([whether to search for compressed pixmaps])
86AC_ARG_ENABLE(stat-zfile,
87        AS_HELP_STRING([--enable-stat-zfile],
88                        [Search for files with .Z & .gz extensions automatically @<:@default=auto@:>@]),
89              [STAT_ZFILE=$enableval], [STAT_ZFILE=$OPEN_ZFILE])
90AC_MSG_RESULT([$STAT_ZFILE])
91if test x$STAT_ZFILE = xyes ; then
92        AC_DEFINE(STAT_ZFILE, 1, [Define to 1 to automatically look for files with .Z & .gz extensions])
93fi
94
95# --enable-unit-tests
96AC_REQUIRE_AUX_FILE([tap-driver.sh])
97XORG_ENABLE_UNIT_TESTS
98XORG_WITH_GLIB([2.46])
99XORG_MEMORY_CHECK_FLAGS
100
101AC_CONFIG_FILES([Makefile
102                 doc/Makefile
103                 include/Makefile
104                 man/Makefile
105                 src/Makefile
106                 sxpm/Makefile
107                 cxpm/Makefile
108                 test/Makefile
109                 xpm.pc])
110AC_OUTPUT
111