1dnl Process this file with autoconf to produce a configure script.
2
3AC_PREREQ(2.64)
4
5# Package version of the form 'major.minor.micro'.
6m4_define(gspell_package_version, 1.9.1)
7
8AC_INIT([gspell],
9	[gspell_package_version],
10	[https://gitlab.gnome.org/GNOME/gspell/issues],
11	[gspell],
12	[https://wiki.gnome.org/Projects/gspell])
13
14AX_REQUIRE_DEFINED([AX_IS_RELEASE])
15AX_IS_RELEASE([git-directory])
16
17# Libtool versioning
18#
19# For development releases (if the minor package version is odd), keep the same
20# Libtool version.
21#
22# For a new minor stable release (when incrementing the minor package version
23# to an even number), apply the following algorithm step by step:
24# 1. If the library source code has changed at all since the last
25#    update, then increment REVISION.
26# 2. If any exported functions or data have been added, removed, or
27#    changed since the last update, increment CURRENT and set REVISION
28#    to 0.
29# 3. If any exported functions or data have been added since the last
30#    public release, increment AGE.
31# 4. If any exported functions or data have been removed since the last
32#    public release, set AGE to 0.
33#
34# When incrementing the API version (usually for a new major package version),
35# set CURRENT, REVISION and AGE to 0 since it's like a new library.
36
37GSPELL_LT_CURRENT=5
38GSPELL_LT_REVISION=0
39GSPELL_LT_AGE=3
40GSPELL_LT_VERSION="$GSPELL_LT_CURRENT:$GSPELL_LT_REVISION:$GSPELL_LT_AGE"
41AC_SUBST(GSPELL_LT_VERSION)
42
43# API version, used for parallel installability.
44# Not used in:
45# - po/Makevars
46# - the docs/reference/gspell-1.0-sections.txt filename
47# Because as far as I've tested, it is not easily feasible to not hardcode the
48# API version in those places (swilmet).
49GSPELL_API_VERSION=1
50AC_SUBST(GSPELL_API_VERSION)
51
52# Dependencies
53enchant_req=2.1.3
54glib_req=2.44
55gtk_req=3.20
56
57AC_CONFIG_SRCDIR([gspell/gspell-checker.c])
58AC_CONFIG_HEADER([config.h])
59AC_CONFIG_MACRO_DIR([m4])
60
61# gnu strictness to generate the INSTALL file
62AM_INIT_AUTOMAKE([1.11 tar-ustar dist-xz no-dist-gzip gnu -Wno-portability])
63
64m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
65
66# Check for programs
67AC_PROG_CC
68AC_PROG_INSTALL
69
70AX_REQUIRE_DEFINED([PKG_PROG_PKG_CONFIG])
71AX_REQUIRE_DEFINED([PKG_INSTALLDIR])
72PKG_PROG_PKG_CONFIG
73PKG_INSTALLDIR
74
75AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])
76AC_PATH_PROG([GLIB_COMPILE_RESOURCES], [glib-compile-resources])
77
78# Needed on Mac OS X
79AC_PROG_OBJC
80
81# Initialize libtool
82LT_PREREQ([2.2.6])
83LT_INIT([disable-static])
84
85# Compile warnings. There can be deprecation warnings at any time, so disable
86# -Werror by default with the [yes] argument.
87AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS])
88AX_COMPILER_FLAGS([WARN_CFLAGS], [WARN_LDFLAGS], [yes])
89
90# Dynamic linking dependencies
91AX_REQUIRE_DEFINED([AX_PKG_CHECK_MODULES])
92AX_PKG_CHECK_MODULES([DEP],
93		     [glib-2.0 >= $glib_req  gtk+-3.0 >= $gtk_req  enchant-2 >= $enchant_req],
94		     [icu-uc])
95
96# i18n
97AM_GNU_GETTEXT([external])
98# FIXME: Remove AM_GNU_GETTEXT_VERSION once autoreconf supports AM_GNU_GETTEXT_REQUIRE_VERSION.
99AM_GNU_GETTEXT_VERSION([0.19.6])
100AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6])
101AC_SUBST([GETTEXT_PACKAGE], [gspell-$GSPELL_API_VERSION])
102AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Define to the gettext package name.])
103
104# Documentation
105AX_REQUIRE_DEFINED([GTK_DOC_CHECK])
106GTK_DOC_CHECK([1.25], [--flavour=no-tmpl])
107
108# Installed Tests for gnome continuous integration
109AC_ARG_ENABLE(installed_tests,
110	      AS_HELP_STRING([--enable-installed-tests],
111			     [Install test programs (default: no)]),,
112	      [enable_installed_tests=no])
113
114AM_CONDITIONAL(INSTALLED_TESTS, test "x$enable_installed_tests" = "xyes")
115
116# Introspection
117AX_REQUIRE_DEFINED([GOBJECT_INTROSPECTION_CHECK])
118GOBJECT_INTROSPECTION_CHECK([1.42.0])
119
120# Vala
121AX_REQUIRE_DEFINED([VAPIGEN_CHECK])
122VAPIGEN_CHECK
123
124# Code coverage for unit tests
125AX_REQUIRE_DEFINED([AX_CODE_COVERAGE])
126AX_CODE_COVERAGE
127
128# Valgrind check
129AX_REQUIRE_DEFINED([AX_VALGRIND_CHECK])
130AX_VALGRIND_CHECK
131
132# Symbol visibility handling.
133#
134# This requires to #include config.h in every *.c file where there is a public
135# symbol. As a simpler rule, it's easier to #include config.h in all gspell/*.c
136# files, to be sure that we don't miss any public symbol.
137GSPELL_HIDDEN_VISIBILITY_CFLAGS=""
138case "$host" in
139    *-*-mingw*)
140        dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
141        AC_DEFINE([_GSPELL_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
142                  [defines how to decorate public symbols while building])
143        GSPELL_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
144        ;;
145    *)
146        dnl on other compilers, check if we can do -fvisibility=hidden
147        SAVED_CFLAGS="${CFLAGS}"
148        CFLAGS="-fvisibility=hidden"
149        AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
150        AC_TRY_COMPILE([], [return 0],
151                       AC_MSG_RESULT(yes)
152                       enable_fvisibility_hidden=yes,
153                       AC_MSG_RESULT(no)
154                       enable_fvisibility_hidden=no)
155        CFLAGS="${SAVED_CFLAGS}"
156
157        AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
158            AC_DEFINE([_GSPELL_EXTERN], [__attribute__((visibility("default"))) extern],
159                      [defines how to decorate public symbols while building])
160            GSPELL_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
161        ])
162        ;;
163esac
164AC_SUBST(GSPELL_HIDDEN_VISIBILITY_CFLAGS)
165
166# Check for Mac OS X platform
167AC_MSG_CHECKING([for Mac OS X platform])
168case "$host" in
169  *-*-darwin*)
170    platform_osx=yes
171    ;;
172  *)
173    platform_osx=no
174    ;;
175esac
176AC_MSG_RESULT([$platform_osx])
177AM_CONDITIONAL(PLATFORM_OSX, test "$platform_osx" = "yes")
178
179# Check for native Mac OS X
180gdk_targets=`$PKG_CONFIG --variable=targets gdk-3.0`
181
182gdk_windowing="x11"
183
184for target in $gdk_targets;
185do
186	case "$target" in
187		quartz)
188			gdk_windowing=quartz
189			;;
190		win32)
191			gdk_windowing=win32
192			;;
193	esac
194done
195
196AC_MSG_CHECKING([for native Mac OS X])
197if test "$gdk_windowing" = "quartz"; then
198	os_osx=yes
199else
200	os_osx=no
201fi
202AC_MSG_RESULT([$os_osx])
203AM_CONDITIONAL(OS_OSX, test "$os_osx" = "yes")
204
205if test "$os_osx" = "yes"; then
206	AC_DEFINE([OS_OSX], [1], [Defined if OS is Mac OSX])
207
208	AX_PKG_CHECK_MODULES([GTK_MAC],
209			     [],
210			     [gtk-mac-integration-gtk3 >= 2.0.8])
211
212	AC_SUBST(GTK_MAC_CFLAGS)
213	AC_SUBST(GTK_MAC_LIBS)
214fi
215
216# Output files
217AC_CONFIG_FILES([
218	gspell-${GSPELL_API_VERSION}.pc:gspell.pc.in
219	Makefile
220	docs/Makefile
221	docs/reference/gspell-docs.xml
222	docs/reference/intro.xml
223	docs/reference/Makefile
224	gspell/Makefile
225	gspell/resources/Makefile
226	gspell-app/Makefile
227	po/Makefile.in
228	tests/Makefile
229	testsuite/Makefile
230])
231
232AC_OUTPUT
233
234echo "
235Configuration:
236
237	${PACKAGE_NAME} version ${PACKAGE_VERSION}
238
239	Source code location:	${srcdir}
240	Prefix:			${prefix}
241	Compiler:		${CC}
242	Documentation:		${enable_gtk_doc}
243	GObject introspection:	${found_introspection}
244	Vala:			${enable_vala}
245	Code coverage:		${enable_code_coverage}
246	Valgrind check:		${enable_valgrind}
247	Installed tests:	${enable_installed_tests}
248"
249