-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathconfigure.ac
422 lines (338 loc) · 15 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
dnl Process this file with autoconf to produce a configure script.
AC_INIT(nimf, 1.3.8)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror])
AM_MAINTAINER_MODE([disable])
AM_SILENT_RULES([yes])
AM_PROG_AR
AC_PROG_CC
AC_PROG_CXX
AS_IF([test "$CXX" = "g++"],
[AS_IF([test "$GXX" != "yes"],
AC_MSG_ERROR([C++ compiler is not found.]))])
AC_ARG_ENABLE([hardening],
AS_HELP_STRING([--disable-hardening], [Disable hardening]))
# EXTRA_CFLAGS="-Wall -Werror"
EXTRA_CFLAGS="-Wall"
AS_IF([test "x$enable_hardening" != "xno"],
[AS_IF([echo "$EXTRA_CFLAGS" | grep -vq '\-D_FORTIFY_SOURCE'],
[EXTRA_CFLAGS+=" -D_FORTIFY_SOURCE=2"])])
AC_SUBST(EXTRA_CFLAGS)
dnl ***************************************************************************
dnl Internationalization
dnl ***************************************************************************
IT_PROG_INTLTOOL(0.50.1)
GETTEXT_PACKAGE=nimf
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [gettext package name])
AC_SUBST(GETTEXT_PACKAGE)
AM_GLIB_GNU_GETTEXT
AM_GLIB_DEFINE_LOCALEDIR(NIMF_LOCALE_DIR)
LT_INIT([disable-static])
dnl ***************************************************************************
dnl libnimf
dnl ***************************************************************************
LIBNIMF_LT_VERSION=1:0:0
AC_SUBST(LIBNIMF_LT_VERSION)
LIBNIMF_REQUIRES="glib-2.0 gio-2.0 gio-unix-2.0 gmodule-2.0"
AC_SUBST(LIBNIMF_REQUIRES)
PKG_CHECK_MODULES(LIBNIMF_DEPS, [$LIBNIMF_REQUIRES])
dnl ***************************************************************************
dnl nimf-libhangul nimf-system-keyboard
dnl ***************************************************************************
PKG_CHECK_MODULES(NIMF_LIBHANGUL_DEPS, [libhangul >= 0.0.12 $LIBNIMF_REQUIRES])
PKG_CHECK_MODULES(NIMF_SYSTEM_KEYBOARD_DEPS,
[xkbcommon >= 0.5.0 $LIBNIMF_REQUIRES])
dnl ***************************************************************************
dnl nimf-m17n
dnl ***************************************************************************
AC_ARG_ENABLE([nimf-m17n],
AS_HELP_STRING([--disable-nimf-m17n], [Disable nimf-m17n]))
AS_IF([test "x$enable_nimf_m17n" != "xno"],
[PKG_CHECK_MODULES(NIMF_M17N_DEPS, [m17n-shell >= 1.7.0 m17n-db >= 1.7.0
$LIBNIMF_REQUIRES])])
AM_CONDITIONAL([ENABLE_NIMF_M17N], [test "x$enable_nimf_m17n" != "xno"])
PKG_CHECK_EXISTS([m17n-db >= 1.8.0], [m17n_1_8_0_available="yes"])
AM_CONDITIONAL([M17N_1_8_0_AVAILABLE], [test "x$m17n_1_8_0_available" = "xyes"])
dnl ***************************************************************************
dnl nimf-rime
dnl ***************************************************************************
AC_ARG_ENABLE([nimf-rime],
AS_HELP_STRING([--disable-nimf-rime], [Disable nimf-rime]))
AS_IF([test "x$enable_nimf_rime" != "xno"],
[PKG_CHECK_MODULES(NIMF_RIME_DEPS, [rime >= 1.2.9 $LIBNIMF_REQUIRES])])
AM_CONDITIONAL([ENABLE_NIMF_RIME], [test "x$enable_nimf_rime" != "xno"])
dnl ***************************************************************************
dnl nimf-anthy
dnl ***************************************************************************
AC_ARG_ENABLE([nimf-anthy],
AS_HELP_STRING([--disable-nimf-anthy], [Disable nimf-anthy]))
AS_IF([test "x$enable_nimf_anthy" != "xno"],
[PKG_CHECK_MODULES(NIMF_ANTHY_DEPS, [anthy $LIBNIMF_REQUIRES])])
AS_IF([test "x$enable_nimf_anthy" != "xno"],
[AC_CHECK_FILE([/var/lib/anthy/anthy.dic], [HAVE_ANTHY_DIC="yes"])])
AS_IF([test "x$enable_nimf_anthy" != "xno"],
[AC_CHECK_FILE([/usr/share/anthy/anthy.dic], [HAVE_ANTHY_DIC="yes"])])
AS_IF([test "x$enable_nimf_anthy" != "xno" -a "x$HAVE_ANTHY_DIC" != "xyes"],
[AC_MSG_ERROR([anthy.dic is not found.])])
AM_CONDITIONAL([ENABLE_NIMF_ANTHY], [test "x$enable_nimf_anthy" != "xno"])
dnl ***************************************************************************
dnl im-nimf-qt5
dnl ***************************************************************************
# Check for Qt5
PKG_CHECK_MODULES(IM_NIMF_QT5_DEPS, [Qt5Core Qt5Gui Qt5Widgets], [has_qt5=yes], [has_qt5=no])
AS_IF([test "x$has_qt5" = "xyes"], [
QT5_VERSION=`pkg-config --modversion Qt5Core`
QT5_INCLUDE_DIR=`pkg-config --variable=includedir Qt5Core`
QT5_CORE_PRIVATE_INCLUDE_PATH=$QT5_INCLUDE_DIR/QtCore/$QT5_VERSION
QT5_GUI_PRIVATE_INCLUDE_PATH=$QT5_INCLUDE_DIR/QtGui/$QT5_VERSION
AC_CHECK_FILES(
[$QT5_GUI_PRIVATE_INCLUDE_PATH/QtGui/qpa/qplatforminputcontext.h
$QT5_GUI_PRIVATE_INCLUDE_PATH/QtGui/qpa/qplatforminputcontextplugin_p.h], [],
AC_MSG_ERROR([Qt 5 base private development files are not found.]))
AC_SUBST(QT5_CORE_PRIVATE_INCLUDE_PATH)
AC_SUBST(QT5_GUI_PRIVATE_INCLUDE_PATH)
AC_PATH_PROGS([QT5_MOC], [moc-qt5 moc], [no],
[`pkg-config --variable=host_bins Qt5Core`])
if test "x$QT5_MOC" = "xno"; then
AC_MSG_ERROR([moc for qt5 not found])
fi
QT5_LIB_DIR=`pkg-config --variable=libdir Qt5Core`
case `pkg-config --variable=includedir Qt5Core` in
*/qt5)
QT5_IM_MODULE_DIR=$QT5_LIB_DIR/qt5/plugins/platforminputcontexts
;;
*/qt)
QT5_IM_MODULE_DIR=$QT5_LIB_DIR/qt/plugins/platforminputcontexts
;;
*)
AC_MSG_ERROR(Can not determine Qt5 plugins/platforminputcontexts directory)
;;
esac
AC_SUBST(QT5_IM_MODULE_DIR)
])
AM_CONDITIONAL([HAVE_QT5], [test "x$has_qt5" = "xyes"])
dnl ***************************************************************************
dnl im-nimf-qt6
dnl ***************************************************************************
PKG_CHECK_MODULES(IM_NIMF_QT6_DEPS, [Qt6Core Qt6Gui Qt6Widgets], [has_qt6=yes], [has_qt6=no])
AS_IF([test "x$has_qt6" = "xyes"], [
QT6_VERSION=`pkg-config --modversion Qt6Core`
QT6_INCLUDE_DIR=`pkg-config --variable=includedir Qt6Core`
QT6_CORE_PRIVATE_INCLUDE_PATH=$QT6_INCLUDE_DIR/QtCore/$QT6_VERSION
QT6_GUI_PRIVATE_INCLUDE_PATH=$QT6_INCLUDE_DIR/QtGui/$QT6_VERSION
QT6_CFLAGS=`$PKG_CONFIG --cflags Qt6Core Qt6Gui Qt6Widgets`
QT6_LIBS=`$PKG_CONFIG --libs Qt6Core Qt6Gui Qt6Widgets`
AC_CHECK_FILES(
[$QT6_GUI_PRIVATE_INCLUDE_PATH/QtGui/qpa/qplatforminputcontext.h
$QT6_GUI_PRIVATE_INCLUDE_PATH/QtGui/qpa/qplatforminputcontextplugin_p.h], [],
AC_MSG_ERROR([Qt 6 base private development files are not found.]))
AC_SUBST(QT6_CORE_PRIVATE_INCLUDE_PATH)
AC_SUBST(QT6_GUI_PRIVATE_INCLUDE_PATH)
AC_SUBST(QT6_CFLAGS)
AC_SUBST(QT6_LIBS)
AC_PATH_PROGS([QT6_MOC], [moc-qt6 moc], [no],
[`pkg-config --variable=host_bins Qt6Core`])
if test "x$QT6_MOC" = "xno"; then
AC_MSG_CHECKING([for moc-qt6 using find])
QT6_MOC=`find /usr/ -name moc -type f 2>/dev/null | grep qt6`
if test "x$QT6_MOC" = "x"; then
AC_MSG_ERROR([moc for qt6 not found])
else
AC_MSG_RESULT([$QT6_MOC])
fi
fi
# Detect distribution
AC_MSG_CHECKING([distribution])
if test -f /etc/os-release; then
. /etc/os-release
DISTRIB_ID=$ID
DISTRIB_RELEASE=$VERSION_ID
else
DISTRIB_ID=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
DISTRIB_RELEASE=$(lsb_release -rs | tr '[:upper:]' '[:lower:]')
fi
AC_MSG_RESULT([$DISTRIB_ID $DISTRIB_RELEASE])
QT6_LIB_DIR=`pkg-config --variable=libdir Qt6Core`
case `pkg-config --variable=includedir Qt6Core` in
*/qt6)
if test "x$DISTRIB_ID$DISTRIB_RELEASE" = "xubuntu22.04"; then
AC_MSG_NOTICE("Found Ubuntu 22.04")
QT6_IM_MODULE_DIR=/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts
elif test "x$DISTRIB_ID$DISTRIB_RELEASE" = "xhamonikr7.0"; then
AC_MSG_NOTICE("Found HamoniKR 7.0")
QT6_IM_MODULE_DIR=/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts
else
QT6_IM_MODULE_DIR=$QT6_LIB_DIR/qt6/plugins/platforminputcontexts
fi
;;
*/qt)
QT6_IM_MODULE_DIR=$QT6_LIB_DIR/qt/plugins/platforminputcontexts
;;
*)
AC_MSG_ERROR(Can not determine Qt6 plugins/platforminputcontexts directory)
;;
esac
AC_SUBST(QT6_IM_MODULE_DIR)
])
AM_CONDITIONAL([HAVE_QT6], [test "x$has_qt6" = "xyes"])
dnl ***************************************************************************
dnl Check for im-nimf-gtk
dnl ***************************************************************************
PKG_CHECK_MODULES(IM_NIMF_GTK3_DEPS, [gtk+-3.0 gdk-x11-3.0])
PKG_CHECK_MODULES(IM_NIMF_GTK2_DEPS, [gtk+-2.0])
case `uname -m` in
x86_64)
BITS=64
;;
*)
BITS=32
;;
esac
GTK3_LIBDIR=`pkg-config --variable=libdir gtk+-3.0`
GTK3_BINARY_VERSION=`pkg-config --variable=gtk_binary_version gtk+-3.0`
AC_SUBST(GTK3_LIBDIR)
AC_SUBST(GTK3_BINARY_VERSION)
AC_PATH_PROGS([GTK_QUERY_IMMODULES3],
[gtk-query-immodules-3.0 gtk-query-immodules-3.0-$BITS], [no],
[/usr/bin:/snap/gnome-42-2204/176/usr/lib/x86_64-linux-gnu/libgtk-3-0:\
/usr/lib/x86_64-linux-gnu/libgtk-3-0t64:/usr/lib/x86_64-linux-gnu/libgtk-3-0:\
/usr/lib/aarch64-linux-gnu/libgtk-3-0t64:/usr/lib/aarch64-linux-gnu/libgtk-3-0])
if test "x$GTK_QUERY_IMMODULES3" = "xno"; then
AC_MSG_ERROR([gtk-query-immodules-3.0 or gtk-query-immodules-3.0-$BITS not found])
fi
GTK2_LIBDIR=`pkg-config --variable=libdir gtk+-2.0`
GTK2_BINARY_VERSION=`pkg-config --variable=gtk_binary_version gtk+-2.0`
AC_SUBST(GTK2_LIBDIR)
AC_SUBST(GTK2_BINARY_VERSION)
AC_PATH_PROGS([GTK_QUERY_IMMODULES2],
[gtk-query-immodules-2.0 gtk-query-immodules-2.0-$BITS], [no],
[/usr/bin:/snap/gnome-42-2204/176/usr/lib/x86_64-linux-gnu/libgtk2.0-0:\
/usr/lib/x86_64-linux-gnu/libgtk2.0-0t64:/usr/lib/x86_64-linux-gnu/libgtk2.0-0:\
/usr/lib/aarch64-linux-gnu/libgtk2.0-0t64:/usr/lib/aarch64-linux-gnu/libgtk2.0-0])
if test "x$GTK_QUERY_IMMODULES2" = "xno"; then
AC_MSG_ERROR([gtk-query-immodules-2.0 or gtk-query-immodules-2.0-$BITS not found])
fi
dnl ***************************************************************************
dnl icon cache
dnl ***************************************************************************
AC_PATH_PROGS([GTK_UPDATE_ICON_CACHE],
[gtk-update-icon-cache-3.0 gtk-update-icon-cache], [no],
[/usr/bin:$GTK3_LIBDIR/libgtk-3-0:$GTK2_LIBDIR/libgtk2.0-0])
if test "x$GTK_UPDATE_ICON_CACHE" = "xno"; then
AC_MSG_ERROR([gtk-update-icon-cache-3.0 or gtk-update-icon-cache not found])
fi
AC_PATH_PROGS([RSVG_CONVERT], [rsvg-convert rsvg], [no])
if test "x$RSVG_CONVERT" = "xno"; then
AC_MSG_ERROR([rsvg-convert or rsvg is not found, please install librsvg2-bin])
fi
dnl ***************************************************************************
dnl nimf-wayland
dnl ***************************************************************************
PKG_CHECK_MODULES(NIMF_WAYLAND_DEPS, [$LIBNIMF_REQUIRES]
wayland-client wayland-server
wayland-protocols xkbcommon)
dnl ***************************************************************************
dnl nimf-xim
dnl ***************************************************************************
PKG_CHECK_MODULES(NIMF_XIM_DEPS, [$LIBNIMF_REQUIRES] x11)
dnl ***************************************************************************
dnl nimf-nim
dnl ***************************************************************************
PKG_CHECK_MODULES(NIMF_NIM_DEPS, [$LIBNIMF_REQUIRES] glib-2.0 gio-2.0)
dnl ***************************************************************************
dnl nimf server
dnl ***************************************************************************
PKG_CHECK_MODULES(NIMF_DEPS, [glib-2.0 gio-2.0 gobject-2.0 gmodule-2.0])
dnl ***************************************************************************
dnl nimf-indicator
dnl ***************************************************************************
# Detect OS using /etc/os-release
OS_ID=""
if test -f /etc/os-release; then
. /etc/os-release
OS_ID=$ID
fi
AC_MSG_NOTICE([Detected OS: $OS_ID])
case $OS_ID in
fedora)
AC_MSG_NOTICE([Fedora detected, using ayatana-appindicator3-0.1])
PKG_CHECK_MODULES(NIMF_INDICATOR_DEPS,
[glib-2.0 x11 gtk+-3.0 ayatana-appindicator3-0.1 libxklavier gdk-3.0
gdk-x11-3.0 gmodule-2.0])
;;
*)
AC_MSG_NOTICE([Non-Fedora OS detected, using ayatana-appindicator3-0.1])
PKG_CHECK_MODULES(NIMF_INDICATOR_DEPS,
[glib-2.0 x11 gtk+-3.0 ayatana-appindicator3-0.1 libxklavier gdk-3.0
gdk-x11-3.0 gmodule-2.0])
;;
esac
dnl ***************************************************************************
dnl nimf-preedit-window nimf-candidate
dnl ***************************************************************************
PKG_CHECK_MODULES(NIMF_PREEDIT_WINDOW_DEPS, [glib-2.0 gtk+-3.0])
PKG_CHECK_MODULES(NIMF_CANDIDATE_DEPS, [glib-2.0 gtk+-3.0])
dnl ***************************************************************************
dnl nimf-settings
dnl ***************************************************************************
PKG_CHECK_MODULES(NIMF_SETTINGS_DEPS,
[gtk+-3.0 glib-2.0 >= 2.54 gio-2.0 gmodule-2.0 libxklavier
gdk-3.0 gdk-x11-3.0])
dnl ***************************************************************************
dnl im-config data
dnl ***************************************************************************
AC_ARG_WITH([im-config-data],
AS_HELP_STRING([--with-im-config-data], [Install im-config data]),
[with_im_config_data=yes])
AM_CONDITIONAL([WITH_IM_CONFIG_DATA],
[test "$with_im_config_data" = "yes"])
dnl ***************************************************************************
dnl imsettings data
dnl ***************************************************************************
AC_ARG_WITH([imsettings-data],
AS_HELP_STRING([--with-imsettings-data], [Install imsettings data]),
[with_imsettings_data=yes])
AM_CONDITIONAL([WITH_IMSETTINGS_DATA],
[test "$with_imsettings_data" = "yes"])
dnl ***************************************************************************
dnl Check for gtk-doc
dnl ***************************************************************************
GTK_DOC_CHECK([1.26],[--flavour no-tmpl])
dnl ***************************************************************************
GLIB_GSETTINGS
AC_OUTPUT([
Makefile
bin/Makefile
bin/nimf/Makefile
bin/nimf-settings/Makefile
data/Makefile
data/apparmor-abstractions/Makefile
data/icons/Makefile
data/im-config/Makefile
data/imsettings/Makefile
docs/Makefile
libnimf/Makefile
libnimf/nimf.pc
modules/Makefile
modules/clients/Makefile
modules/clients/gtk/Makefile
modules/clients/qt5/Makefile
modules/clients/qt6/Makefile
modules/engines/Makefile
modules/engines/nimf-anthy/Makefile
modules/engines/nimf-libhangul/Makefile
modules/engines/nimf-m17n/Makefile
modules/engines/nimf-m17n/icons/Makefile
modules/engines/nimf-rime/Makefile
modules/engines/nimf-system-keyboard/Makefile
modules/services/Makefile
modules/services/candidate/Makefile
modules/services/indicator/Makefile
modules/services/nim/Makefile
modules/services/preedit-window/Makefile
modules/services/wayland/Makefile
modules/services/xim/Makefile
po/Makefile.in
])