summaryrefslogtreecommitdiff
path: root/Build/source/m4/cho-libs.m4
blob: fa3d6f812f299ea923996ff7360f8819bb7e2895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Public macros for the teTeX / TeX Live (TL) tree.
# Copyright (C) 1998 - 2008 Jin-Hwan Cho <chofchof@ktug.or.kr>
# Copyright (C) 2008 - 2009 Peter Breitenlohner <tex-live@tug.org>
#
# This file is free software; the copyright holders
# give unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# serial 2

# CHO_CHECK_ZLIB
# --------------
# Check for zlib
AC_DEFUN([CHO_CHECK_ZLIB],
[AC_CACHE_CHECK([for zlib header files and library],
                [cho_cv_have_zlib],
                [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]],
                                                 [[z_stream p;]])],
                                [cho_cv_have_zlib=yes],
                                [cho_cv_have_zlib=no])])
AS_IF([test "x$cho_cv_have_zlib" = xyes],
      [AC_CHECK_FUNCS([compress],
                      [AC_DEFINE([HAVE_ZLIB], 1,
                                 [Define if you have zlib and its headers.])
                       AC_CHECK_FUNCS([compress2],
                                      [AC_DEFINE([HAVE_ZLIB_COMPRESS2], 1,
                                                 [Define if your zlib has the compress2 function.])])])])
])# CHO_CHECK_ZLIB

# CHO_CHECK_LIBPNG
# ----------------
# Check for libpng
AC_DEFUN([CHO_CHECK_LIBPNG],
[AC_CACHE_CHECK([for libpng header files and library],
                [cho_cv_have_png],
                [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <png.h>]],
                                                 [[png_infop p;]])],
                                [cho_cv_have_png=yes],
                                [cho_cv_have_png=no])])
AS_IF([test "x$cho_cv_have_png" = xyes],
      [AC_CHECK_FUNCS([png_get_image_width],
                      [AC_DEFINE([HAVE_LIBPNG], 1,
                                 [Define if you have libpng and its headers.])])])
])# CHO_CHECK_LIBPNG

# CHO_CHECK_LIBPAPER
# ------------------
# Check for libpaper
AC_DEFUN([CHO_CHECK_LIBPAPER],
[_cppflags=$CPPFLAGS _ldflags=$LDFLAGS
 AC_ARG_WITH([paper],
  [AS_HELP_STRING([--with-paper=DIR], [use paper include/library files from DIR])],
  [if test -d "$withval"; then
     CPPFLAGS="$CPPFLAGS -I$withval/include"
     LDFLAGS="$LDFLAGS -L$withval/lib"
   fi])
 AC_MSG_CHECKING([for paper header files])
 AC_TRY_COMPILE(
  [#include <paper.h>],
  [struct paper *p;],
  [AC_MSG_RESULT(yes)
   AC_SEARCH_LIBS([paperpswidth], [paper],
    [AC_DEFINE(HAVE_LIBPAPER, 1, [Define if you have libpaper])])],
  [CPPFLAGS=$_cppflags
   LDDFLAGS=$_ldflags
   AC_MSG_RESULT(no)])
])# CHO_CHECK_LIBPAPER

# CHO_CHECK_LIBFONTCONFIG
# -----------------------
# Check for libfontconfig
AC_DEFUN([CHO_CHECK_LIBFONTCONFIG],
[_cppflags=$CPPFLAGS _ldflags=$LDFLAGS
 have_libfontconfig=no
 AC_ARG_WITH([fontconfig],
  [AS_HELP_STRING([--with-fontconfig=DIR],[use fontconfig include/library files from DIR])],
  [if test -d "$withval"; then
     CPPFLAGS="$CPPFLAGS -I$withval/include"
     LDFLAGS="$LDFLAGS -L$withval/lib"
     FONTCONFIGLDFLAGS="-L$withval/lib"
   fi])
 AC_MSG_CHECKING([for fontconfig header files])
 AC_TRY_COMPILE(
  [#include <fontconfig/fontconfig.h>],
  [FcObjectSet *os;],
  [AC_MSG_RESULT(yes)
   AC_SEARCH_LIBS([FcInit], [fontconfig],
    [AC_DEFINE([HAVE_LIBFONTCONFIG], 1, [Define if you have libfontconfig])
     have_libfontconfig=yes])],
  [CPPFLAGS=$_cppflags
   LDDFLAGS=$_ldflags
   AC_MSG_RESULT(no)])
])# CHO_CHECK_LIBFONTCONFIG

# CHO_CHECK_LIBFREETYPE(PACKAGE-NAME)
# -----------------------------------
# Check for libfreetype, fail with error if not found
AC_DEFUN([CHO_CHECK_LIBFREETYPE],
[AC_CACHE_CHECK([for freetype2 header files and library],
                [cho_cv_have_freetype],
                [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ft2build.h>
#include FT_FREETYPE_H]],
                                                 [[FT_Face face;]])],
                [cho_cv_have_freetype=yes],
                [cho_cv_have_freetype=no])])
AS_IF([test "x$cho_cv_have_freetype" = xyes],
      [AC_CHECK_FUNCS([FT_Init_FreeType],
                      [AC_DEFINE([HAVE_LIBFREETYPE], 1,
                                 [Define if you have libfreetype and its headers.])])],
      [KPSE_MSG_ERROR([$1],
                      [This version of $1 requires that FreeType2 and its headers be available.
You can use the --with-freetype2-includes and/or --with-freetype2-libdir options
to indicate the location of the installed freetype2 library and headers.])])
])# CHO_CHECK_LIBFREETYPE