Debian Codegraph @

configure.ac

raw ◀ ▶
Source reconstructed at patch state 1 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.63])
5 AC_INIT([HIME], [0.10.1], [BUG-REPORT-ADDRESS])
6 AC_PROG_CC()
7 AC_PROG_CXX()
8
9 AM_INIT_AUTOMAKE([foreign])
10
11 AC_DEFUN(
12 [LIBRARY_CHECK_MESSAGE],
13 [
14 AS_IF(
15 [$1],
16 [
17 AS_IF(
18 [$2],
19 [AC_MSG_NOTICE([$3 is used])],
20 [AC_MSG_NOTICE([$3 is installed but not used])]
21 )
22 ],
23 [
24 AS_IF(
25 [$2],
26 [AC_MSG_ERROR([$3 should be installed])],
27 [AC_MSG_NOTICE([$3 is not installed and not used])]
28 )
29 ]
30 )
31 ]
32 )
33
34 AC_SUBST([CCLD], [$CC])
35 AC_SUBST([CCX], [$CC])
36 # Set CFLAGS to empty string since AC_PROG_CC() would set it with the default value "-g -O2"
37 AC_SUBST([CFLAGS], [""])
38 AS_IF(
39 [test -z "$CFLAGS"],
40 [
41 AC_SUBST([CFLAGS], ["-std=gnu17"])
42 AC_SUBST([CXXFLAGS], ["-std=gnu++17"])
43 AC_SUBST([OPTFLAGS], ["-Wall"])
44 ],
45 [AC_SUBST([OPTFLAGS], ["$CFLAGS"])]
46 )
47 AC_SUBST([CFLAGS], ["$CFLAGS $CPPFLAGS"])
48 AC_SUBST([CXXFLAGS], ["$CXXFLAGS $CPPFLAGS"])
49 AC_SUBST([DOC_DIR], ["\${datadir}/doc/hime"])
50 AS_IF(
51 [test "x$ECHO" = "x"],
52 [
53 AC_SUBST([ECHO], ["$(whereis -b echo | awk "{print \$2}")"])
54 AS_IF(
55 [test "x$ECHO" = "x"],
56 [AC_SUBST([ECHO], ["echo"])]
57 )
58 ]
59 )
60 AC_SUBST([FREEBSD], ["0"])
61 AS_IF(
62 [uname | grep FreeBSD | grep -v GNU/kFreeBSD >/dev/null 2>/dev/null],
63 [AC_SUBST([FREEBSD], ["1"])]
64 )
65 AS_IF(
66 [uname | grep OpenBSD >/dev/null 2>/dev/null],
67 [AC_SUBST([FREEBSD], ["1"])]
68 )
69 AM_CONDITIONAL([FREEBSD], [test "x$FREEBSD" = "x1"])
70 AC_SUBST([HIME_BIN_DIR], ["\${bindir}"])
71 AC_SUBST([HIME_DEFAULT_ICON_DIR], ["\${datadir}/pixmaps/hime"])
72 AC_SUBST([HIME_OGG_DIR], ["\${datadir}/hime/ogg"])
73 AC_SUBST([HIME_SCRIPT_DIR], ["\${datadir}/hime/script"])
74 AC_SUBST([HIME_TABLE_DIR], ["\${datadir}/hime/table"])
75 AC_SUBST([HIME_VERSION], ["$(head -n 1 ChangeLog)"])
76 AC_SUBST([SO_FLAGS], ["$LDFLAGS -shared -Wl,--as-needed"])
77 AC_SUBST([LDFLAGS_ENV], ["$LDFLAGS"])
78 AC_SUBST([LDFLAGS], ["$LDFLAGS -Wl,--as-needed -lX11 -lm"])
79 AC_SUBST([MAKE], ["make"])
80 AS_IF(
81 [command -v gmake > /dev/null 2> /dev/null],
82 [AC_SUBST([MAKE], ["gmake"])]
83 )
84 AC_SUBST([SYS_ICON_DIR], ["\${datadir}/pixmaps"])
85 AC_SUBST([bindir], ["\${DESTDIR}$bindir"])
86 AC_SUBST([datadir], ["\${DESTDIR}$datadir"])
87 AC_SUBST([filterdir], ["\${datadir}/hime/filter"])
88 AC_SUBST([includedir], ["\${DESTDIR}$includedir"])
89 AC_SUBST([mandir], ["\${DESTDIR}$mandir"])
90 AC_SUBST([man1dir], ["\${mandir}/man1"])
91
92 # USE_XIM
93 AC_ARG_ENABLE(
94 [xim],
95 [AS_HELP_STRING([--enable-xim], [Enable XIM, default is yes])],
96 [enable_xim=$enableval],
97 [enable_xim=yes]
98 )
99 AM_CONDITIONAL([USE_XIM], [test "x$enable_xim" = "xyes"])
100 # USE_SYSTEM_TRAY
101 AC_ARG_ENABLE(
102 [system-tray],
103 [AS_HELP_STRING([--enable-system-tray], [Enable System Tray, default is yes])],
104 [enable_system_tray=$enableval],
105 [enable_system_tray=yes]
106 )
107 AM_CONDITIONAL([USE_SYSTEM_TRAY], [test "x$enable_system_tray" = "xyes"])
108 # LIB
109 AC_SUBST([LIB], ["lib"])
110 AS_IF(
111 [test -d /usr/lib64 -a -d /lib64],
112 [AC_SUBST([LIB], ["lib64"])]
113 )
114 AS_IF(
115 [test "x$(uname -s)" = "xLinux"],
116 [AS_IF(
117 [command -v lsb_release >/dev/null],
118 [
119 distid=$(lsb_release -is 2>/dev/null)
120 AS_IF(
121 [test "x$distid" = "xUbuntu" -o "x$distid" = "xDebian" -o "x$distid" = "xArch" -o "x$distid" = "xarchlinux"],
122 [AC_SUBST([LIB], ["lib"])]
123 )
124 ],
125 [
126 DEBIAN_LD=$(ld -v 2>&1 | grep -i debian)
127 UBUNTU_LD=$(ld -v 2>&1 | grep -i ubuntu)
128 if [ test "x$DEBIAN_LD" != "x" -o "x$UBUNTU_LD" != "x"]; then
129 AC_SUBST([LIB], ["lib"])
130 elif [ test -e /etc/arch-release ]; then
131 AC_SUBST([LIB], ["lib"])
132 fi
133 ]
134 )]
135 )
136 # use_lib
137 AC_SUBST([use_lib], [""])
138 AC_ARG_ENABLE(
139 [lib64],
140 [AS_HELP_STRING([--enable-lib64], [Use lib64 directory, default is auto-detect])],
141 [enable_lib64=$enableval],
142 [enable_lib64=""]
143 )
144 if [ test "x$enable_lib64" = "xyes"]; then
145 AC_SUBST([use_lib], ["lib64"])
146 elif [ test "x$enable_lib64" = "xno"]; then
147 AC_SUBST([use_lib], ["lib"])
148 elif [ test -n "$enable_lib64"]; then
149 AC_SUBST([use_lib], ["$enable_lib64"])
150 fi
151 AS_IF(
152 [test -n "$use_lib"],
153 [AC_SUBST([LIB], ["$use_lib"])]
154 )
155 AC_SUBST([libdir], ["\${DESTDIR}$libdir"])
156 AC_SUBST([himelibdir], ["\${libdir}/hime"])
157 AC_SUBST([hime_ld_run_path], ["\${himelibdir}"])
158 AC_SUBST([gcc_ld_run_path], ["-Wl,-rpath,\${hime_ld_run_path}"])
159 # GIT_HAVE
160 # GIT_HASH
161 AS_IF(
162 [test -d .git],
163 [
164 AC_SUBST([git_have], ["yes"])
165 AC_SUBST([GIT_HASH], ["$(git log 2>/dev/null | head -n 1 | cut -d ' ' -f 2 | head -c 7)"])
166 ]
167 )
168 AM_CONDITIONAL([GIT_HAVE], [test "x$git_have" = "xyes"])
169
170 # Checks for programs.
171 # pkg-config
172 PKG_PROG_PKG_CONFIG()
173
174 # Checks for libraries.
175 # Xtst
176 PKG_CHECK_MODULES(
177 [XTST],
178 [xtst],
179 [],
180 [AC_MSG_ERROR([Please install Xtst])]
181 )
182 # GTK
183 PKG_CHECK_MODULES(
184 [GTK2],
185 [gtk+-2.0 >= 2.24.31],
186 [gtk2_is_installed=yes],
187 [gtk2_is_installed=no]
188 )
189 PKG_CHECK_MODULES(
190 [GTK3],
191 [gtk+-3.0 >= 3.22.30],
192 [gtk3_is_installed=yes],
193 [gtk3_is_installed=no]
194 )
195 AS_IF(
196 [test "x$gtk2_is_installed" = "xno" -a "x$gtk3_is_installed" = "xno"],
197 [AC_MSG_ERROR([Please install GTK 2 or GTK 3])]
198 )
199 AC_ARG_WITH(
200 [gtk],
201 [AS_HELP_STRING(
202 [--with-gtk],
203 [Select GTK version, default is GTK 2. [ARG: 2.0|3.0]]
204 )],
205 [
206 with_gtk=$withval
207 AS_IF(
208 [test "x$with_gtk" != "x3.0"],
209 [with_gtk=2.0]
210 )
211 ],
212 [with_gtk=2.0]
213 )
214 AS_IF(
215 [test "x$with_gtk" = "x2.0"],
216 [
217 AC_SUBST([GTK], ["gtk+-2.0"])
218 AC_SUBST([GTK_IM], ["Y"])
219 AC_SUBST([GTK3_IM], ["N"])
220 AC_SUBST([GTKINC], ["$GTK2_CFLAGS"])
221 AC_SUBST([GTKLDFLAGS], ["$GTK2_LIBS"])
222 AC_SUBST([APPINDICATOR], ["appindicator-0.1"])
223 ],
224 [
225 AC_SUBST([GTK], ["gtk+-3.0"])
226 AC_SUBST([GTK_IM], ["N"])
227 AC_SUBST([GTK3_IM], ["Y"])
228 AC_SUBST([GTKINC], ["$GTK3_CFLAGS"])
229 AC_SUBST([GTKLDFLAGS], ["$GTK3_LIBS"])
230 AC_SUBST([APPINDICATOR], ["appindicator3-0.1"])
231 ]
232 )
233 AM_CONDITIONAL([GTK2], [test "x$with_gtk" = "x2.0"])
234 # Qt
235 # QT5_IM
236 # QT6_IM
237 AC_SUBST([QT5_IM], ["N"])
238 AC_SUBST([QT6_IM], ["N"])
239 QT5_IM_DIR_CUSTOM=
240 QT6_IM_DIR_CUSTOM=
241 # debian fedora fedora freebsd slackware arch
242 qt5_moc_path_list="/usr/share/qt5/bin/moc /usr/lib/qt5/bin/moc /usr/bin/moc-qt5 /usr/local/bin/moc-qt5 /usr/local/bin/moc /usr/bin/moc"
243 qt6_moc_path_list="/usr/share/qt6/bin/moc /usr/lib/qt6/bin/moc /usr/bin/moc-qt6 /usr/local/bin/moc-qt6 /usr/local/bin/moc /usr/lib/qt6/moc"
244 # QT5
245 PKG_CHECK_MODULES(
246 [QT5],
247 [Qt5Core Qt5Gui],
248 [
249 qt5_is_installed=yes
250 AC_SUBST([QT5_IM], ["Y"])
251 ],
252 [qt5_is_installed=no]
253 )
254 AC_ARG_ENABLE(
255 [qt5_immodule],
256 [AS_HELP_STRING([--enable-qt5-immodule], [Enable QT5 im-module, default is auto-detect])],
257 [enable_qt5_immodule=$enableval],
258 [enable_qt5_immodule=yes]
259 )
260 AC_ARG_WITH(
261 [qt5_moc_path],
262 [AS_HELP_STRING([--with-qt5-moc-path=PATH], [Specify the path of 'moc' command for QT5])],
263 [QT5_MOC_PATH=$withval],
264 [QT5_MOC_PATH=]
265 )
266 AC_ARG_WITH(
267 [qt5_im_module_path],
268 [AS_HELP_STRING([--with-qt5-im-module-path=PATH], [Specify the install path for QT5 im-module])],
269 [QT5_IM_DIR_CUSTOM=$withval],
270 [QT5_IM_DIR_CUSTOM=]
271 )
272 AS_IF(
273 [test "x$qt5_is_installed" = "xno" -a "x$enable_qt5_immodule" = "xyes"],
274 [AC_MSG_ERROR([Require QT5 installed])]
275 )
276 AS_IF(
277 [test "x$enable_qt5_immodule" = "xno"],
278 [AC_SUBST([QT5_IM], ["N"])]
279 )
280 AS_IF(
281 [test "x$QT5_IM" = "xY"],
282 [
283 if test ! -x "$QT5_MOC_PATH"; then
284 mocs="$(pkg-config --variable=host_bins Qt5Core)/moc $qt5_moc_path_list"
285 for moc in ${mocs}; do
286 if test -x "$moc"; then
287 AC_SUBST([QT5_MOC_PATH], ["$moc"])
288 break
289 fi
290 done
291 fi
292 AS_IF(
293 [test ! -x "$QT5_MOC_PATH"],
294 [AC_MSG_ERROR(["Can not find moc for QT5"])]
295 )
296 ]
297 )
298 AS_IF(
299 [test -z "$QT5_IM_DIR"],
300 [AC_SUBST([QT5_IM_DIR], ["/qt5/plugins/platforminputcontexts"])]
301 )
302 AS_IF(
303 [test -z "$QT5_IM_DIR_CUSTOM"],
304 [AC_SUBST([QT5_IM_DIR], ["$(pkg-config --define-variable=prefix=\$\(DESTDIR\)/\$\(prefix\) --variable=libdir Qt5Core)$QT5_IM_DIR"])],
305 [AC_SUBST([QT5_IM_DIR], ["\$(DESTDIR)$QT5_IM_DIR_CUSTOM"])]
306 )
307 AC_SUBST([QT5_MOC_PATH], ["$QT5_MOC_PATH"])
308 AC_SUBST([QT5_QMAKE_PATH], ["$(echo $QT5_MOC_PATH | sed 's/moc/qmake/')"])
309 # QT6
310 # TODO(xatier): Qt6 doesn't provide pkg-config, we need to hardcode things manually.
311 AC_SUBST([QT6_IM], ["Y"])
312 AC_ARG_ENABLE(
313 [qt6_immodule],
314 [AS_HELP_STRING([--enable-qt6-immodule], [Enable QT6 im-module, default is auto-detect])],
315 [enable_qt6_immodule=$enableval],
316 [enable_qt6_immodule=yes]
317 )
318 AC_ARG_WITH(
319 [qt6_moc_path],
320 [AS_HELP_STRING([--with-qt6-moc-path=PATH], [Specify the path of 'moc' command for QT6])],
321 [QT6_MOC_PATH=$withval],
322 [QT6_MOC_PATH=]
323 )
324 AC_ARG_WITH(
325 [qt6_im_module_path],
326 [AS_HELP_STRING([--with-qt6-im-module-path=PATH], [Specify the install path for QT6 im-module])],
327 [QT6_IM_DIR_CUSTOM=$withval],
328 [QT6_IM_DIR_CUSTOM=]
329 )
330 AS_IF(
331 [test "x$enable_qt6_immodule" = "xno"],
332 [AC_SUBST([QT6_IM], ["N"])]
333 )
334 AS_IF(
335 [test "x$QT6_IM" = "xY"],
336 [
337 if test ! -x "$QT6_MOC_PATH"; then
338 # TODO(xatier): hardcode moc path for now.
339 mocs="/usr/lib/qt6/moc $qt6_moc_path_list"
340 for moc in ${mocs}; do
341 if test -x "$moc"; then
342 AC_SUBST([QT6_MOC_PATH], ["$moc"])
343 break
344 fi
345 done
346 fi
347 AS_IF(
348 [test ! -x "$QT6_MOC_PATH"],
349 [AC_MSG_ERROR(["Can not find moc for QT6"])]
350 )
351 ]
352 )
353 AS_IF(
354 [test -z "$QT6_IM_DIR"],
355 [AC_SUBST([QT6_IM_DIR], ["/qt6/plugins/platforminputcontexts"])]
356 )
357 AS_IF(
358 [test -z "$QT6_IM_DIR_CUSTOM"],
359 [AC_SUBST([QT6_IM_DIR], ["\$(DESTDIR)/\$(prefix)/lib$QT6_IM_DIR"])],
360 [AC_SUBST([QT6_IM_DIR], ["\$(DESTDIR)$QT6_IM_DIR_CUSTOM"])]
361 )
362 AC_SUBST([QT6_MOC_PATH], ["$QT6_MOC_PATH"])
363 AC_SUBST([QT6_QMAKE_PATH], ["$(echo $QT6_MOC_PATH | sed 's/moc/qmake/')"])
364 # USE_ANTHY
365 PKG_CHECK_MODULES(
366 [ANTHY],
367 [anthy],
368 [anthy_is_installed=yes],
369 [anthy_is_installed=no]
370 )
371 AC_ARG_ENABLE(
372 [anthy],
373 [AS_HELP_STRING([--enable-anthy], [Enable Anthy, default is auto-detect])],
374 [enable_anthy=$enableval],
375 [
376 AS_IF(
377 [test "x$anthy_is_installed" = "yes"],
378 [enable_anthy=yes],
379 [enable_anthy=no]
380 )
381 ]
382 )
383 AS_IF(
384 [test "x$anthy_is_installed" = "xyes" -a "x$enable_anthy" == "xyes"],
385 [AC_SUBST([ANTHY_INC], ["-I$(pkg-config --variable=includedir anthy) $(pkg-config --libs anthy)"])]
386 )
387 AM_CONDITIONAL([USE_ANTHY], [test "x$anthy_is_installed" = "xyes" -a "x$enable_anthy" == "xyes"])
388 # USE_CHEWING
389 PKG_CHECK_MODULES(
390 [CHEWING],
391 [chewing >= 0.3.4],
392 [chewing_is_installed=yes],
393 [chewing_is_installed=no]
394 )
395 AC_ARG_ENABLE(
396 [chewing],
397 [AS_HELP_STRING([--enable-chewing], [Enable Chewing, default is auto-detect])],
398 [enable_chewing=$enableval],
399 [
400 AS_IF(
401 [test "x$chewing_is_installed" = "yes"],
402 [enable_chewing=yes],
403 [enable_chewing=no]
404 )
405 ]
406 )
407 AM_CONDITIONAL([USE_CHEWING], [test "x$chewing_is_installed" = "xyes" -a "x$enable_chewing" == "xyes"])
408 # USE_UNITY_TRAY
409 PKG_CHECK_MODULES(
410 [APPINDICATOR],
411 [$APPINDICATOR >= 0.4.0],
412 [appindicator_is_installed=yes],
413 [appindicator_is_installed=no]
414 )
415 AC_ARG_ENABLE(
416 [appindicator],
417 [AS_HELP_STRING([--enable-appindicator], [Enable Ubuntu Unity Tray, default is auto-detect])],
418 [enable_appindicator=$enableval],
419 [
420 AS_IF(
421 [test "x$appindicator_is_installed" = "yes"],
422 [enable_appindicator=yes],
423 [enable_appindicator=no]
424 )
425 ]
426 )
427 AS_IF(
428 [test "x$appindicator_is_installed" = "xyes" -a "x$enable_appindicator" == "xyes"],
429 [
430 AC_SUBST([GTKINC], ["$GTKINC $APPINDICATORINC"])
431 AC_SUBST([GTKLDFLAGS], ["$GTKLDFLAGS $APPINDICATORLDFLAGS"])
432 ]
433 )
434 AM_CONDITIONAL([USE_UNITY_TRAY], [test "x$appindicator_is_installed" = "xyes" -a "x$enable_appindicator" == "xyes"])
435 LDFLAGS+=" $GTKLDFLAGS"
436 AS_IF(
437 [test "x$FREEBSD" = "x0"],
438 [AC_SUBST([LDFLAGS], ["$LDFLAGS -ldl"])]
439 )
440
441 LIBRARY_CHECK_MESSAGE(
442 [test "x$gtk2_is_installed" = "xyes"],
443 [test "x$with_gtk" = "x2.0"],
444 [GTK 2]
445 )
446 LIBRARY_CHECK_MESSAGE(
447 [test "x$gtk3_is_installed" = "xyes"],
448 [test "x$with_gtk" = "x3.0"],
449 [GTK 3]
450 )
451 LIBRARY_CHECK_MESSAGE(
452 [test "x$anthy_is_installed" = "xyes"],
453 [test "x$enable_anthy" = "xyes"],
454 [Anthy]
455 )
456 LIBRARY_CHECK_MESSAGE(
457 [test "x$chewing_is_installed" = "xyes"],
458 [test "x$enable_chewing" = "xyes"],
459 [Chewing]
460 )
461
462 # Checks for header files.
463
464 # Checks for typedefs, structures, and compiler characteristics.
465
466 # Checks for library functions.
467
468 AC_CONFIG_FILES([
469 Makefile
470 data/Makefile
471 filter/Makefile
472 icons/Makefile
473 man/Makefile
474 menu/Makefile
475 po/Makefile
476 scripts/Makefile
477 src/Makefile
478 src/gtk-im/Makefile
479 src/gtk3-im/Makefile
480 src/im-client/Makefile
481 src/IMdkit/Makefile
482 src/IMdkit/lib/Makefile
483 src/modules/Makefile
484 src/qt5-im/Makefile
485 src/qt6-im/Makefile
486 ])
487 AC_OUTPUT