3 dnl Autoconf machinery for packages using Sod
5 dnl (c) 2019 Straylight/Edgeware
8 dnl ----- Licensing notice --------------------------------------------------
10 dnl This file is part of the Sensible Object Design, an object system for C.
12 dnl SOD is free software: you can redistribute it and/or modify it under
13 dnl the terms of the GNU General Public License as published by the Free
14 dnl Software Foundation; either version 2 of the License, or (at your
15 dnl option) any later version.
17 dnl SOD is distributed in the hope that it will be useful, but WITHOUT ANY
18 dnl WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 dnl You should have received a copy of the GNU General Public License
23 dnl along with SOD. If not, write to the Free Software Foundation, Inc.,
24 dnl 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 ### SOD_CHECK([ACTION-IF-LIBRARY-FOUND], [ACTION-IF-LIBRARY-NOT-FOUND])
30 ### Check that (a) the sod(1) translator and (b) the `libsod' library are
33 ### If sod(1) can't be found, this isn't a problem: we assume that the
34 ### generated output files are included in the distribution, and use a fake
35 ### definition which will report an error if the files need rebuilding, as a
36 ### poor person's version of the `missing' script.
38 ### If the library can't be found, we have a more serious problem. The
39 ### default behaviour is to (let `PKG_CHECK_MODULES') report a fatal error,
40 ### but packages can override this behaviour by setting ACTION-IF-LIBRARY-
41 ### NOT-FOUND to something non-empty. If the library /is/ found then do
42 ### ACTION-IF-LIBRARY-FOUND; the default is to add the necessary compiler
43 ### flags to `AM_CFLAGS'. (You are expected to make your own arrangements to
44 ### link against `$SOD_LIBS'.)
46 [AC_CHECK_PROGS([SOD], [sod], [none])
47 if test "$SOD" = "none"; then
48 AC_MSG_WARN([Sod translator not found: relying on distributed output files!])
49 SOD="echo >&2 \"Sod translator not found! Can't rebuild \\\`\$[]@'.\" && exit 2; \\#"
51 PKG_CHECK_MODULES([SOD], [sod],
52 [m4_default([$1], [AM_CFLAGS="$AM_CFLAGS $SOD_CFLAGS"])],
55 dnl ----- That's all, folks -------------------------------------------------