summaryrefslogtreecommitdiff
path: root/dviware/mdvi/configure.in
blob: 9d6d5a4b8f198269b4cc0e4cde78d72f89a37bc2 (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
dnl
dnl Copyright (C) 2000, Matias Atria
dnl 
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl 
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl 
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
dnl

AC_INIT(./config/VERSION)
AC_CONFIG_AUX_DIR(./config)
AC_CONFIG_HEADER(config.h)

. $srcdir/config/VERSION
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",
  [Name of this package (don't change)])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION",
  [Version of this package (don't change)])
AC_SUBST(PACKAGE)
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(PATCH)
AC_SUBST(VERSION)

TOPDIR=`pwd`
TOPSRCDIR=`cd $srcdir && pwd`
AC_SUBST(TOPDIR)
AC_SUBST(TOPSRCDIR)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PATH_PROG(MD5SUM, md5sum, :)
AC_SUBST(MD5SUM)

ALL_LINGUAS="es"

AM_GNU_GETTEXT

dnl Checks for libraries.
AC_CHECK_LIB(m, floor)

dnl Checks for header files.
AC_PATH_XTRA
AC_HEADER_STDC
AC_CHECK_HEADERS(strings.h fcntl.h unistd.h locale.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(void *, 4)
AC_CHECK_BYTE_ORDER

dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strchr memcpy getopt getopt_long)

AC_ARG_ENABLE_BOOL(regex-specials, yes, 
  [disable regular expressions in \\special handlers])
AC_ARG_WITH_BOOL(omega, yes, 
  [disable Omega-specific file formats])
AC_ARG_WITH_BOOL(type1-fonts, no, 
  [add support for type1 fonts (requires t1lib)])
AC_ARG_WITH_BOOL(truetype-fonts, no,
  [add support for TrueType fonts (required Freetype 1.x)])
AC_ARG_ENABLE_BOOL(cheap-trick, yes,
  [disable cheap X transparency trick])
AC_ARG_ENABLE_BOOL(afm-files, yes,
  [disable support for AFM metric files])
AC_ARG_WITHX(frontends,
  [frontends to compile (only \`x11' for now)], , , [=LIST])
AC_CHECK_TEXMF

dnl#################################################################
dnl Now examine the --with and --enable options
dnl#################################################################

if test "$ac_cv_func_getopt" = no; then
  LIBOBJS="$LIBOBJS getopt.o"
fi
if test "$ac_cv_func_getopt_long" = no; then
  LIBOBJS="$LIBOBJS getopt1.o"
fi

if test -n "$LIBOBJS"; then
  SUPPORTLIB='$(TOPDIR)/support/support.a'
  SUPPORTHDR='-I$(TOPDIR)/support'
fi
AC_SUBST(SUPPORTLIB)
AC_SUBST(SUPPORTHDR)

if test "$USE_INCLUDED_LIBINTL" = yes; then
  INTLSUB=intl
fi
AC_SUBST(INTLSUB)

if test "$enable_regex_specials" = yes; then
  AC_CHECK_HEADERS(regex.h)
  AC_CHECK_FUNCS(regexec)
  if test "$ac_cv_func_regexec" = no; then
    AC_MSG_WARN([support for POSIX regular expressions disabled])
    enable_regex_specials=no
  else
    AC_DEFINE(WITH_REGEX_SPECIALS, 1, 
      [Define to use POSIX regular expressions to match TeX \\specials])
  fi
fi

if test "$texmf_is_web2c" = yes; then
  AC_PATH_PROG(MKTEXLSR, mktexlsr, :)
  MDVIMAPDIR="$texmf/mdvi"
  POST_INSTALL='echo "Updating ls-R database..."; $(MKTEXLSR)'
else
  AC_MSG_WARN([\
kpathsea does not seem to be installed properly.
Continue at your own risk])
  MDVIMAPDIR='${datadir}/mdvi'
  POST_INSTALL=:
fi
AC_SUBST(MDVIMAPDIR)
AC_SUBST(MKTEXLSR)
AC_SUBST(POST_INSTALL)

# Check front ends
. $srcdir/config/FRONTENDS
AC_MSG_CHECKING([which frontends to compile])
case "$with_frontends" in
  yes) user_frontends="$ALL_FRONTENDS" ;;
  no)  user_frontends= ;;
  *)   user_frontends=`echo $with_frontends | sed -e 's/,/ /g'` ;;
esac
FRONTENDS=
DISABLED=
for i in $user_frontends; do
  if echo "$ALL_FRONTENDS" | grep $i >/dev/null 2>&1; then
    # Don't add it more than once
    FRONTENDS="`echo $FRONTENDS | sed -e 's/[[ \t]]*'$i'[[ \t]]*//'` $i"
  else
    DISABLED="$DISABLED
  $i"
  fi
done
user_frontends=
AC_MSG_RESULT($FRONTENDS)
AC_SUBST(ALL_FRONTENDS)
AC_SUBST(FRONTENDS)
if test -n "$DISABLED"; then
  AC_MSG_WARN([\
The following unknown frontends have been disabled: $DISABLED])
fi  

if test "$enable_cheap_trick" = yes; then
  AC_DEFINE(CHEAP_X_TRICK, 1,
    [Define to simulate transparent glyphs on white backgrounds])
fi

if test "$enable_afm_files" = yes; then
  AC_DEFINE(WITH_AFM_FILES, 1,
    [Define to add support for AFM files])
fi

if test "$with_omega" = yes; then
  AC_DEFINE(WITH_OMEGA, 1,
    [Define to add support for Omega-specific file formats])
fi

if test "$with_truetype_fonts" = yes; then
  AC_CHECK_LIBOPTIONS(FreeType, ttf, 
    [#include <freetype.h>], [TT_Init_FreeType(0)])
dnl This code is for freetype 2.x
dnl
dnl We only use the freetype-config script if the user did not specify
dnl the location of the headers or the library itself.
dnl  if test -z "$with_freetype_headers" -a -z "$with_freetype_library"; then
dnl    if test "$cross_compiling" = yes; then
dnl      AC_MSG_WARN([\
dnl You must use --with-freetype-headers and --with-freetype-library 
dnl when cross-compiling. I will pretend that you said --without-freetype])
dnl      have_freetype_library=no
dnl      FREETYPE_LDFLAGS="$FREETYPE_LDFLAGS $FREETYPE_LIBS"
dnl      FREETYPE_LIBS=
dnl    else
dnl      AC_PATH_PROG(FREETYPE, freetype-config, no)
dnl      if test "$ac_cv_prog_freetype_config" = no; then
dnl        have_freetype_library=no
dnl        FREETYPE_CFLAGS=
dnl        FREETYEP_LDFLAGS=
dnl      else
dnl        FREETYPE_CFLAGS=`$FREETYPE --cflags`
dnl        FREETYPE_LDFLAGS=`$FREETYPE --libs`
dnl        AC_MSG_CHECKING([if the FreeType configuration works])
dnl        AC_CHANGE_FLAGS([$FREETYPE_CFLAGS], [$FREETYPE_LDFLAGS])
dnl        AC_TRY_COMPILE([#include <freetype/freetype.h>], 
dnl          [FT_Init_FreeType(0)],
dnl          [have_freetype_headers=yes; have_freetype_library=yes],
dnl          [have_freetype_library=no])
dnl        AC_RESTORE_FLAGS
dnl        AC_MSG_RESULT($have_freetype_library)
dnl      fi
dnl    fi
dnl  fi
fi

if test "$with_truetype_fonts" = yes; then
  case "${have_freetype_headers}-${have_freetype_library}" in
    yes-yes)
       FREETYPE_LIBS="$FRETYPE_LDFLAGS $FREETYPE_LIBS"
       AC_DEFINE(WITH_TRUETYPE_FONTS, 1, 
         [Define to add support for TrueType fonts])
       ;;
    *) AC_MSG_WARN([TrueType font support disabled])
       with_truetype_fonts=no
       ;;
  esac
fi

if test "$with_type1_fonts" = yes; then
  AC_CHECK_LIBOPTIONS(t1lib, t1, [#include <t1lib.h>], [T1_InitLib(0)])
  case "${have_t1lib_headers}-${have_t1lib_library}" in
    yes-yes)
       AC_MSG_CHECKING([if we can compile a trivial t1lib program])
       AC_CHANGE_FLAGS([$T1LIB_CFLAGS], [$T1LIB_LDFLAGS], [-lt1])
       AC_TRY_RUN([#include <stdio.h>
         #include <t1lib.h>
         int main() {
           FILE *f;
           f = fopen("conftestval", "w");
           if(!f) exit(1);
           fprintf(f, "%s\n", T1_GetLibIdent());
           fclose(f);
           exit(0);
         }], t1version=`cat conftestval`, t1version=, t1version=unknown)
       AC_RESTORE_FLAGS
       if test -z "$t1version"; then
         AC_MSG_RESULT(no)
       else
         AC_MSG_RESULT(yes)
       fi
       if test -z "$t1version"; then
         AC_MSG_WARN([Type1 font support disabled])
         with_type1_fonts=no
       else
         AC_DEFINE(WITH_TYPE1_FONTS, 1, 
           [Define to add support for Type1 fonts])
         AC_DEFINE_UNQUOTED(T1LIB_VERSION, "$t1version", 
           [Version of T1lib used to build MDVI])
       fi
       ;;
    [*]) AC_MSG_WARN([Type1 font support disabled])
       with_type1_fonts=no
       ;;
  esac
fi

AC_CHECK_LIBOPTIONS(kpathsea, kpathsea,
  [#include <stdio.h>
  #include <kpathsea/progname.h>],
  [kpse_set_program_name("conftest", "conftest")])

if test "$have_kpathsea_headers" = no -o "$have_kpathsea_library" = no; then
  AC_MSG_ERROR([I could not find the kpathsea library on this system.
This library is required to build this package. Please install it and use
the --with-kpathsea-headers and --with-kpathsea-library options to tell
configure the location of its header files and the library itself.])
  exit 1
fi

AC_MSG_CHECKING([if we can compile a trivial kpathsea program])
AC_CHANGE_FLAGS([$KPATHSEA_CFLAGS], [$KPATHSEA_LDFLAGS], [-lkpathsea])
AC_TRY_RUN([#include <stdio.h>
  #include <kpathsea/c-auto.h>
  extern char *kpathsea_version_string;
  int main() {
    FILE *f;
    f = fopen("conftestval", "w");
    if(!f) exit(1);
    fprintf(f, "%s\n", kpathsea_version_string);
    fclose(f);
    exit(0);
  }], kpseversion=`cat conftestval`, kpseversion=, kpseversion=unknown)
AC_RESTORE_FLAGS
if test -z "$kpseversion"; then
  AC_MSG_RESULT(no)
else
  AC_MSG_RESULT(yes)
fi
if test -z "$kpseversion"; then
  AC_MSG_ERROR([Could not compile a simple kpathsea program -- check your installation])
fi
AC_DEFINE_UNQUOTED(KPSE_VERSION, "$kpseversion", 
  [Version of kpathsea used to build MDVI])

dnl if X is disabled, let the makefile know
if test "$no_x" = yes; then
  X11LIB=
else
  X11LIB=-lX11
fi
AC_SUBST(X11LIB)

AC_OUTPUT(Makefile \
	lib/Makefile \
	lib/po/Makefile \
	support/Makefile \
	x11/Makefile \
	version.h \
	config.mk:config/config.mk.in \
	nls.mk:config/nls.mk.in \
	intl/Makefile)

if test -z "$FRONTENDS"; then
  FRONTENDS="NONE!"
fi

cat <<EOF

Selected options:

   Support for Type1 fonts              : $with_type1_fonts
   Support for TrueType fonts           : $with_truetype_fonts
   Support for Omega-specific formats   : $with_omega
   Support for AFM files                : $enable_afm_files
   Support for internationalization     : $USE_NLS
   Apply regular expressions to specials: $enable_regex_specials

   Frontends that will be compiled:
     $FRONTENDS
   Installation directories (prefix is \`$prefix'):
     Programs               : $bindir
     Fontmaps and encodings : $MDVIMAPDIR

To change these parameters, edit the files \`config.h' and \`config.mk'
You may also want to edit \`include/defaults.h' and the Makefiles.
Otherwise, just type \`make'.

EOF