]> git.draconx.ca Git - dxcommon.git/blob - m4/libgerbv.m4
Add simple detection macros for libcneartree and libgerbv.
[dxcommon.git] / m4 / libgerbv.m4
1 dnl Copyright © 2018 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_LIB_LIBGERBV([min-version], [action-if-ok], [action-if-failed])
8 dnl
9 dnl Search for a working libgerbv installation.  If such a library is found,
10 dnl appropriate compiler and linker flags are stored in LIBGERBV_CFLAGS and
11 dnl LIBGERBV_LIBS, respectively, and the action-if-ok is performed (may be
12 dnl empty).  If no suitable library is found, then action-if-failed is
13 dnl performed if non-empty, otherwise configure will stop with a fatal error.
14 AC_DEFUN([DX_LIB_LIBGERBV],
15 [DX_LIB_SETUP([libgerbv])DX_LIB_PKGCONFIG_FLAGS([libgerbv])
16 AC_MSG_CHECKING([for libgerbv])
17 DX_LIB_SEARCH_LINK([libgerbv],
18   [m4_apply([_DX_LIB_LIBGERBV_TEST], m4_split([$1], [\.]))],
19   [ [[$LIBGERBV_CFLAGS], [$LIBGERBV_LIBS]],
20     [[$dx_cv_libgerbv_pkg_cflags], [$dx_cv_libgerbv_pkg_libs],
21       [test x"$dx_cv_libgerbv_pkg_found" = x"yes"]],
22     [[], [-lgerbv]] ])
23 AS_IF([test x"$dx_cv_libgerbv_lib_found" = x"yes"], [$2],
24   [m4_default([$3], [AC_MSG_FAILURE([dnl
25 libgerbv is required.  The latest
26 version may be found at <http://gerbv.geda-project.org/>.
27 m4_newline([DX_LIB_USERFLAG_BLURB([libgerbv])])
28 m4_newline([DX_LIB_PKGCONFIG_BLURB([libgerbv])])
29 ])])])])
30
31 dnl Internal test program for libgerbv.  The version test is currently
32 dnl unimplemented.
33 m4_define([_DX_LIB_LIBGERBV_TEST], [AC_LANG_PROGRAM([dnl
34 #include <gerbv.h>
35 ], [dnl
36 gerbv_project_t *gp = gerbv_create_project();
37 gerbv_destroy_project(gp);
38 ])])