]> git.draconx.ca Git - dxcommon.git/blob - m4/gob2.m4
Update some copyright years.
[dxcommon.git] / m4 / gob2.m4
1 dnl Copyright © 2020-2021 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What the Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 dnl DX_PROG_GOB2([min-version], [action-if-found], [action-if-not-found])
8 dnl
9 dnl Search PATH for a working gob2 utility with the given minimum version,
10 dnl which may be empty to accept any version.  If found, the GOB2 variable
11 dnl (which is substituted with AC_SUBST) is set with the result, and
12 dnl action-if-found is executed.  Otherwise, action-if-not-found is
13 dnl executed if nonempty, else configure will exit with a fatal error.
14
15 AC_DEFUN([DX_PROG_GOB2], [AC_ARG_VAR([GOB2], [GOBject Builder command])dnl
16 AC_PREREQ([2.62])dnl
17 cat >conftest.gob <<'EOF'
18 m4_ifnblank([$1], [requires $1
19 ])dnl
20 class :Conftest from G:Object
21 {
22 }
23 EOF
24 AC_CACHE_CHECK([for GObject Builder], [ac_cv_path_GOB2],
25 [dx_cv_gob_found=:
26 AC_PATH_PROGS_FEATURE_CHECK([GOB2], [gob2],
27 [rm -f conftest.c
28 $ac_path_GOB2 conftest.gob >&AS_MESSAGE_LOG_FD 2>&1 && test -f conftest.c && {
29   DX_BASENAME([gob_relcmd], ["$ac_path_GOB2"])
30   gob_bypath=`{ command -v "$gob_relcmd"; } 2>/dev/null` # ''
31   ac_cv_path_GOB2=$ac_path_GOB2
32   test x"$gob_bypath" = x"$ac_path_GOB2" && ac_cv_path_GOB2=$gob_relcmd
33   ac_path_GOB2_found=:
34   dx_cv_gob_works=yes
35 }], [ac_cv_path_GOB2=no dx_cv_gob_found=false])
36 ])
37 AS_IF([$dx_cv_gob_found],
38 [GOB2=$ac_cv_path_GOB2
39 AC_CACHE_CHECK([whether $GOB2 works], [dx_cv_gob_works],
40 [rm -f conftest.c
41 if $GOB2 conftest.gob >&AS_MESSAGE_LOG_FD 2>&1 && test -f conftest.c; then
42   dx_cv_gob_works=yes
43 else
44   dx_cv_gob_works=no
45 fi])])
46 AS_IF([test x"$dx_cv_gob_works" = x"yes"],
47   [$2], [m4_default([$3], [AC_MSG_FAILURE(
48 [GObject Builder m4_ifnblank([$1], [version at least $1 ])is required.
49
50 The latest version may be found at <https://draconx.ca/projects/gob-dx/>.
51 ])])])
52 rm -f conftest.c conftest.gob
53 ])