beta-0.89.2
[luatex.git] / source / m4 / kpse-kpathsea-flags.m4
blobf0bae6f8067290922df096395925cb9fc815a2a1
1 # Public macros for the TeX Live (TL) tree.
2 # Copyright (C) 2009-2015 Peter Breitenlohner <tex-live@tug.org>
4 # This file is free software; the copyright holder
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
8 # KPSE_KPATHSEA_FLAGS([OPTIONS])
9 # ------------------------------
10 # Provide the configure options '--with-system-kpathsea' (if in the TL tree).
11 # Options:
12 #          no-debug - add '-DNO_DEBUG' to KPATHSEA_INCLUDES even if not needed
14 # Set the make variables KPATHSEA_INCLUDES and KPATHSEA_LIBS to the CPPFLAGS and
15 # LIBS required for the `-lkpathsea' library in texk/kpathsea/ of the TL tree.
16 AC_DEFUN([KPSE_KPATHSEA_FLAGS], [dnl
17 AC_REQUIRE([KPSE_SAVE_FLAGS])[]dnl
18 _KPSE_TEXLIB_FLAGS([kpathsea], [kpathsea], [lt],
19                    [-IBLD/texk -ISRC/texk], [BLD/texk/kpathsea/libkpathsea.la], [],
20                    [${top_srcdir}/../kpathsea/*.[ch]],
21                    [${top_builddir}/../kpathsea/paths.h])
22 m4_if(m4_index([ $1 ], [ no-debug ]), [-1],
23       [_KPSE_CHECK_KPSE_DEBUG],
24       [KPATHSEA_INCLUDES="$KPATHSEA_INCLUDES -DNO_DEBUG"])
25 ]) # KPSE_KPATHSEA_FLAGS
27 # KPSE_KPATHSEA_OPTIONS([WITH-SYSTEM])
28 # ------------------------------------
29 AC_DEFUN([KPSE_KPATHSEA_OPTIONS], [_KPSE_LIB_OPTIONS([kpathsea], [$1], [pkg-config])])
31 # _KPSE_CHECK_KPSE_DEBUG
32 # ----------------------
33 # Internal subroutine to check if libkpathsea supports debugging.
34 m4_define([_KPSE_CHECK_KPSE_DEBUG], [dnl
35 AC_CACHE_CHECK([if libkpathsea supports debugging],
36                [kpse_cv_kpse_debug],
37                [KPSE_ADD_FLAGS([kpathsea])
38                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <kpathsea/kpathsea.h>]],
39                                                 [[FILE *f = fopen("f", "r")]])],
40                                [kpse_cv_kpse_debug=yes],
41                                [kpse_cv_kpse_debug=no])
42                 KPSE_RESTORE_FLAGS])
43 AS_IF([test "x$kpse_cv_kpse_debug" != xyes],
44       [KPATHSEA_INCLUDES="$KPATHSEA_INCLUDES -DNO_DEBUG"])[]dnl
45 ]) # _KPSE_CHECK_KPSE_DEBUG
47 # KPSE_KPATHSEA_SYSTEM_FLAGS
48 # --------------------------
49 AC_DEFUN([KPSE_KPATHSEA_SYSTEM_FLAGS], [dnl
50 _KPSE_PKG_CONFIG_FLAGS([kpathsea], [kpathsea])])
52 # KPSE_CHECK_KPSE_FORMAT(FORMAT,
53 #                        [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
54 # ----------------------------------------------------------------
55 # Check whether kpathsea declares the kpse_FORMAT_format.
56 AC_DEFUN([KPSE_CHECK_KPSE_FORMAT], [dnl
57 AC_CACHE_CHECK([whether kpathsea declares the kpse_$1_format],
58                [kpse_cv_have_$1_format],
59                [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <kpathsea/kpathsea.h>]],
60                                                 [[kpse_$1_format]])],
61                                [kpse_cv_have_$1_format=yes],
62                                [kpse_cv_have_$1_format=no])])
63 AS_IF([test "x$kpse_cv_have_$1_format" = xyes], [$2], [$3])
64 ]) # KPSE_CHECK_KPSE_FORMAT
66 # KPSE_CHECK_XBASENAME([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
67 # --------------------------------------------------------------
68 # Check whether kpathsea declares xbasename().
69 AC_DEFUN([KPSE_CHECK_XBASENAME], [dnl
70 AC_CHECK_DECL([xbasename], [$1], [$2], [[#include <kpathsea/kpathsea.h>]])
71 ]) # KPSE_CHECK_XBASENAME