Debian Codegraph @

configure.ac

raw ◀ ▶
Source reconstructed at patch state 0 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], ["\${prefix}/$LIB"])
156 AC_SUBST([libdir], ["\${DESTDIR}$libdir"])
157 AC_SUBST([himelibdir], ["\${libdir}/hime"])
158 AC_SUBST([hime_ld_run_path], ["\${himelibdir}"])
159 AC_SUBST([gcc_ld_run_path], ["-Wl,-rpath,\${hime_ld_run_path}"])
160 # GIT_HAVE
161 # GIT_HASH
162 AS_IF(
163 [test -d .git],
164 [
165 AC_SUBST([git_have], ["yes"])
166 AC_SUBST([GIT_HASH], ["$(git log 2>/dev/null | head -n 1 | cut -d ' ' -f 2 | head -c 7)"])
167 ]
168 )
169 AM_CONDITIONAL([GIT_HAVE], [test "x$git_have" = "xyes"])
170
171 # Checks for programs.
172 # pkg-config
173 PKG_PROG_PKG_CONFIG()
174
175 # Checks for libraries.
176 # Xtst
177 PKG_CHECK_MODULES(
178 [XTST],
179 [xtst],
180 [],
181 [AC_MSG_ERROR([Please install Xtst])]
182 )
183 # GTK
184 PKG_CHECK_MODULES(
185 [GTK2],
186 [gtk+-2.0 >= 2.24.31],
187 [gtk2_is_installed=yes],
188 [gtk2_is_installed=no]
189 )
190 PKG_CHECK_MODULES(
191 [GTK3],
192 [gtk+-3.0 >= 3.22.30],
193 [gtk3_is_installed=yes],
194 [gtk3_is_installed=no]
195 )
196 AS_IF(
197 [test "x$gtk2_is_installed" = "xno" -a "x$gtk3_is_installed" = "xno"],
198 [AC_MSG_ERROR([Please install GTK 2 or GTK 3])]
199 )
200 AC_ARG_WITH(
201 [gtk],
202 [AS_HELP_STRING(
203 [--with-gtk],
204 [Select GTK version, default is GTK 2. [ARG: 2.0|3.0]]
205 )],
206 [
207 with_gtk=$withval
208 AS_IF(
209 [test "x$with_gtk" != "x3.0"],
210 [with_gtk=2.0]
211 )
212 ],
213 [with_gtk=2.0]
214 )
215 AS_IF(
216 [test "x$with_gtk" = "x2.0"],
217 [
218 AC_SUBST([GTK], ["gtk+-2.0"])
219 AC_SUBST([GTK_IM], ["Y"])
220 AC_SUBST([GTK3_IM], ["N"])
221 AC_SUBST([GTKINC], ["$GTK2_CFLAGS"])
222 AC_SUBST([GTKLDFLAGS], ["$GTK2_LIBS"])
223 AC_SUBST([APPINDICATOR], ["appindicator-0.1"])
224 ],
225 [
226 AC_SUBST([GTK], ["gtk+-3.0"])
227 AC_SUBST([GTK_IM], ["N"])
228 AC_SUBST([GTK3_IM], ["Y"])
229 AC_SUBST([GTKINC], ["$GTK3_CFLAGS"])
230 AC_SUBST([GTKLDFLAGS], ["$GTK3_LIBS"])
231 AC_SUBST([APPINDICATOR], ["appindicator3-0.1"])
232 ]
233 )
234 AM_CONDITIONAL([GTK2], [test "x$with_gtk" = "x2.0"])
235 # Qt
236 # QT5_IM
237 # QT6_IM
238 AC_SUBST([QT5_IM], ["N"])
239 AC_SUBST([QT6_IM], ["N"])
240 QT5_IM_DIR_CUSTOM=
241 QT6_IM_DIR_CUSTOM=
242 # debian fedora fedora freebsd slackware arch
243 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"
244 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"
245 # QT5
246 PKG_CHECK_MODULES(
247 [QT5],
248 [Qt5Core Qt5Gui],
249 [
250 qt5_is_installed=yes
251 AC_SUBST([QT5_IM], ["Y"])
252 ],
253 [qt5_is_installed=no]
254 )
255 AC_ARG_ENABLE(
256 [qt5_immodule],
257 [AS_HELP_STRING([--enable-qt5-immodule], [Enable QT5 im-module, default is auto-detect])],
258 [enable_qt5_immodule=$enableval],
259 [enable_qt5_immodule=yes]
260 )
261 AC_ARG_WITH(
262 [qt5_moc_path],
263 [AS_HELP_STRING([--with-qt5-moc-path=PATH], [Specify the path of 'moc' command for QT5])],
264 [QT5_MOC_PATH=$withval],
265 [QT5_MOC_PATH=]
266 )
267 AC_ARG_WITH(
268 [qt5_im_module_path],
269 [AS_HELP_STRING([--with-qt5-im-module-path=PATH], [Specify the install path for QT5 im-module])],
270 [QT5_IM_DIR_CUSTOM=$withval],
271 [QT5_IM_DIR_CUSTOM=]
272 )
273 AS_IF(
274 [test "x$qt5_is_installed" = "xno" -a "x$enable_qt5_immodule" = "xyes"],
275 [AC_MSG_ERROR([Require QT5 installed])]
276 )
277 AS_IF(
278 [test "x$enable_qt5_immodule" = "xno"],
279 [AC_SUBST([QT5_IM], ["N"])]
280 )
281 AS_IF(
282 [test "x$QT5_IM" = "xY"],
283 [
284 if test ! -x "$QT5_MOC_PATH"; then
285 mocs="$(pkg-config --variable=host_bins Qt5Core)/moc $qt5_moc_path_list"
286 for moc in ${mocs}; do
287 if test -x "$moc"; then
288 AC_SUBST([QT5_MOC_PATH], ["$moc"])
289 break
290 fi
291 done
292 fi
293 AS_IF(
294 [test ! -x "$QT5_MOC_PATH"],
295 [AC_MSG_ERROR(["Can not find moc for QT5"])]
296 )
297 ]
298 )
299 AS_IF(
300 [test -z "$QT5_IM_DIR"],
301 [AC_SUBST([QT5_IM_DIR], ["/qt5/plugins/platforminputcontexts"])]
302 )
303 AS_IF(
304 [test -z "$QT5_IM_DIR_CUSTOM"],
305 [AC_SUBST([QT5_IM_DIR], ["$(pkg-config --define-variable=prefix=\$\(DESTDIR\)/\$\(prefix\) --variable=libdir Qt5Core)$QT5_IM_DIR"])],
306 [AC_SUBST([QT5_IM_DIR], ["\$(DESTDIR)$QT5_IM_DIR_CUSTOM"])]
307 )
308 AC_SUBST([QT5_MOC_PATH], ["$QT5_MOC_PATH"])
309 AC_SUBST([QT5_QMAKE_PATH], ["$(echo $QT5_MOC_PATH | sed 's/moc/qmake/')"])
310 # QT6
311 # TODO(xatier): Qt6 doesn't provide pkg-config, we need to hardcode things manually.
312 AC_SUBST([QT6_IM], ["Y"])
313 AC_ARG_ENABLE(
314 [qt6_immodule],
315 [AS_HELP_STRING([--enable-qt6-immodule], [Enable QT6 im-module, default is auto-detect])],
316 [enable_qt6_immodule=$enableval],
317 [enable_qt6_immodule=yes]
318 )
319 AC_ARG_WITH(
320 [qt6_moc_path],
321 [AS_HELP_STRING([--with-qt6-moc-path=PATH], [Specify the path of 'moc' command for QT6])],
322 [QT6_MOC_PATH=$withval],
323 [QT6_MOC_PATH=]
324 )
325 AC_ARG_WITH(
326 [qt6_im_module_path],
327 [AS_HELP_STRING([--with-qt6-im-module-path=PATH], [Specify the install path for QT6 im-module])],
328 [QT6_IM_DIR_CUSTOM=$withval],
329 [QT6_IM_DIR_CUSTOM=]
330 )
331 AS_IF(
332 [test "x$enable_qt6_immodule" = "xno"],
333 [AC_SUBST([QT6_IM], ["N"])]
334 )
335 AS_IF(
336 [test "x$QT6_IM" = "xY"],
337 [
338 if test ! -x "$QT6_MOC_PATH"; then
339 # TODO(xatier): hardcode moc path for now.
340 mocs="/usr/lib/qt6/moc $qt6_moc_path_list"
341 for moc in ${mocs}; do
342 if test -x "$moc"; then
343 AC_SUBST([QT6_MOC_PATH], ["$moc"])
344 break
345 fi
346 done
347 fi
348 AS_IF(
349 [test ! -x "$QT6_MOC_PATH"],
350 [AC_MSG_ERROR(["Can not find moc for QT6"])]
351 )
352 ]
353 )
354 AS_IF(
355 [test -z "$QT6_IM_DIR"],
356 [AC_SUBST([QT6_IM_DIR], ["/qt6/plugins/platforminputcontexts"])]
357 )
358 AS_IF(
359 [test -z "$QT6_IM_DIR_CUSTOM"],
360 [AC_SUBST([QT6_IM_DIR], ["\$(DESTDIR)/\$(prefix)/lib$QT6_IM_DIR"])],
361 [AC_SUBST([QT6_IM_DIR], ["\$(DESTDIR)$QT6_IM_DIR_CUSTOM"])]
362 )
363 AC_SUBST([QT6_MOC_PATH], ["$QT6_MOC_PATH"])
364 AC_SUBST([QT6_QMAKE_PATH], ["$(echo $QT6_MOC_PATH | sed 's/moc/qmake/')"])
365 # USE_ANTHY
366 PKG_CHECK_MODULES(
367 [ANTHY],
368 [anthy],
369 [anthy_is_installed=yes],
370 [anthy_is_installed=no]
371 )
372 AC_ARG_ENABLE(
373 [anthy],
374 [AS_HELP_STRING([--enable-anthy], [Enable Anthy, default is auto-detect])],
375 [enable_anthy=$enableval],
376 [
377 AS_IF(
378 [test "x$anthy_is_installed" = "yes"],
379 [enable_anthy=yes],
380 [enable_anthy=no]
381 )
382 ]
383 )
384 AS_IF(
385 [test "x$anthy_is_installed" = "xyes" -a "x$enable_anthy" == "xyes"],
386 [AC_SUBST([ANTHY_INC], ["-I$(pkg-config --variable=includedir anthy) $(pkg-config --libs anthy)"])]
387 )
388 AM_CONDITIONAL([USE_ANTHY], [test "x$anthy_is_installed" = "xyes" -a "x$enable_anthy" == "xyes"])
389 # USE_CHEWING
390 PKG_CHECK_MODULES(
391 [CHEWING],
392 [chewing >= 0.3.4],
393 [chewing_is_installed=yes],
394 [chewing_is_installed=no]
395 )
396 AC_ARG_ENABLE(
397 [chewing],
398 [AS_HELP_STRING([--enable-chewing], [Enable Chewing, default is auto-detect])],
399 [enable_chewing=$enableval],
400 [
401 AS_IF(
402 [test "x$chewing_is_installed" = "yes"],
403 [enable_chewing=yes],
404 [enable_chewing=no]
405 )
406 ]
407 )
408 AM_CONDITIONAL([USE_CHEWING], [test "x$chewing_is_installed" = "xyes" -a "x$enable_chewing" == "xyes"])
409 # USE_UNITY_TRAY
410 PKG_CHECK_MODULES(
411 [APPINDICATOR],
412 [$APPINDICATOR >= 0.4.0],
413 [appindicator_is_installed=yes],
414 [appindicator_is_installed=no]
415 )
416 AC_ARG_ENABLE(
417 [appindicator],
418 [AS_HELP_STRING([--enable-appindicator], [Enable Ubuntu Unity Tray, default is auto-detect])],
419 [enable_appindicator=$enableval],
420 [
421 AS_IF(
422 [test "x$appindicator_is_installed" = "yes"],
423 [enable_appindicator=yes],
424 [enable_appindicator=no]
425 )
426 ]
427 )
428 AS_IF(
429 [test "x$appindicator_is_installed" = "xyes" -a "x$enable_appindicator" == "xyes"],
430 [
431 AC_SUBST([GTKINC], ["$GTKINC $APPINDICATORINC"])
432 AC_SUBST([GTKLDFLAGS], ["$GTKLDFLAGS $APPINDICATORLDFLAGS"])
433 ]
434 )
435 AM_CONDITIONAL([USE_UNITY_TRAY], [test "x$appindicator_is_installed" = "xyes" -a "x$enable_appindicator" == "xyes"])
436 LDFLAGS+=" $GTKLDFLAGS"
437 AS_IF(
438 [test "x$FREEBSD" = "x0"],
439 [AC_SUBST([LDFLAGS], ["$LDFLAGS -ldl"])]
440 )
441
442 LIBRARY_CHECK_MESSAGE(
443 [test "x$gtk2_is_installed" = "xyes"],
444 [test "x$with_gtk" = "x2.0"],
445 [GTK 2]
446 )
447 LIBRARY_CHECK_MESSAGE(
448 [test "x$gtk3_is_installed" = "xyes"],
449 [test "x$with_gtk" = "x3.0"],
450 [GTK 3]
451 )
452 LIBRARY_CHECK_MESSAGE(
453 [test "x$anthy_is_installed" = "xyes"],
454 [test "x$enable_anthy" = "xyes"],
455 [Anthy]
456 )
457 LIBRARY_CHECK_MESSAGE(
458 [test "x$chewing_is_installed" = "xyes"],
459 [test "x$enable_chewing" = "xyes"],
460 [Chewing]
461 )
462
463 # Checks for header files.
464
465 # Checks for typedefs, structures, and compiler characteristics.
466
467 # Checks for library functions.
468
469 AC_CONFIG_FILES([
470 Makefile
471 data/Makefile
472 filter/Makefile
473 icons/Makefile
474 man/Makefile
475 menu/Makefile
476 po/Makefile
477 scripts/Makefile
478 src/Makefile
479 src/gtk-im/Makefile
480 src/gtk3-im/Makefile
481 src/im-client/Makefile
482 src/IMdkit/Makefile
483 src/IMdkit/lib/Makefile
484 src/modules/Makefile
485 src/qt5-im/Makefile
486 src/qt6-im/Makefile
487 ])
488 AC_OUTPUT