summaryrefslogtreecommitdiff
path: root/Build/source/configure.in
blob: 4394ec96eea6b94fa42242a22bacb8388d8b49d7 (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
dnl Top-level configure for TeX Live build.  Public domain.

AC_INIT(texk/make/common.mk)

AC_CONFIG_AUX_DIR(config)
AC_SET_MAKE
AC_PROG_CC
AC_PROG_CXX

AC_PROG_LEX
case $LEX in
  lex)
    OLDIFS=$IFS; IFS=:
    foundLEX=false
    for p in $PATH; do
      if test -f "$p/lex"; then
        foundLEX=true
        break
      fi
    done
    IFS=$OLDIFS
  ;;
esac
if $foundLEX; then :; else
  AC_MSG_ERROR(no working lexical scanner (lex/flex) found)
fi

AC_PROG_YACC
case $YACC in
  yacc)
    OLDIFS=$IFS; IFS=:
    foundYACC=false
    for p in $PATH; do
      if test -f "$p/yacc"; then
        foundYACC=true
        break
      fi
    done
    IFS=$OLDIFS
  ;;
esac
if $foundYACC; then :; else
  AC_MSG_ERROR(no working parser generator (yacc/bison) found)
fi

AC_CANONICAL_SYSTEM

dnl Various compiler directives
dnl Various compiler directives
AC_MSG_CHECKING(whether to define additional compiler specific flags)
case "$target" in
    alpha*-dec*)
        if test "$CC" = "cc"; then
          CFLAGS="$CFLAGS -Olimit 1000 -std1"; export CFLAGS
          AC_MSG_WARN(Digital Unix's cc)
        fi
        ;;
    hp*hpux*)
        if test "$CC" = "cc"; then
          CFLAGS="$CFLAGS -Aa +e -D_HPUX_SOURCE"; export CFLAGS
          AC_MSG_WARN(HP-UX's cc)
        fi
        ;;
    *-darwin*)
        : ${INSTALL='/usr/bin/install -c -p'}; export INSTALL
        : ${NCURSES_CPP_FIX=true}; export NCURSES_CPP_FIX
        AC_MSG_RESULT([no, but using other fixes for Darwin])
        ;;
    *)
        AC_MSG_RESULT(no)
        ;;
esac

dnl We check this here, because otherwise some worse check (from ncurses?)
dnl is used instead for the cached value.
AC_HEADER_SYS_WAIT

AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_FUNC_ALLOCA
AC_PROG_RANLIB
AC_PATH_X

dnl These are included for compilation with either teTeX or standalone xdvik
dnl (tetex will only provide tetex.ac, xdvik only xdvik.ac)    
sinclude(tetex.ac)
sinclude(texlive.ac)
sinclude(xdvik.ac)
sinclude(withenable.ac)
sinclude(utils/dialog/withenable.ac)
sinclude(texk/withenable.ac)
sinclude(texk/kpathsea/xt.ac)
sinclude(texk/kpathsea/withenable.ac)
sinclude(texk/web2c/withenable.ac)
sinclude(texk/web2c/xetexdir/withenable.ac)
sinclude(texk/xdvik/withenable.ac)
sinclude(libs/ncurses/withenable.ac)
sinclude(libs/libpng/withenable.ac)
sinclude(libs/t1lib/withenable.ac)
sinclude(libs/zlib/withenable.ac)
sinclude(libs/gd/withenable.ac)
sinclude(libs/freetype/withenable.ac)
sinclude(libs/freetype2/withenable.ac)
sinclude(libs/icu-xetex/withenable.ac)
sinclude(libs/teckit/withenable.ac)

NCURSESDIR=libs/ncurses
LIBT1DIR=libs/t1lib
LIBTYPE1DIR=libs/type1
LIBPNGDIR=libs/libpng
ZLIBDIR=libs/zlib
LIBXPDFDIR=libs/xpdf
FREETYPEDIR=libs/freetype
FREETYPE2DIR=libs/freetype2
ICUDIR=libs/icu-xetex
GRAPHITEDIR=libs/graphite-engine
TECKITDIR=libs/teckit
GDDIR=libs/gd
LIBOBSDCOMPATDIR=libs/obsdcompat

test "$no_x" = yes && { with_xdvik=no; with_oxdvik=no; }
export with_xdvik with_oxdvik

# we need libt1 for dvipng, xdvik, oxdvik
test ! -d $srcdir/$LIBT1DIR   && : ${needs_libt1=no}
test "$with_dvipng"  != no    && : ${needs_libt1=yes}
test "$with_xdvik"   != no    && : ${needs_libt1=yes}
test "$with_oxdvik"  != no    && : ${needs_libt1=yes}
: ${needs_libt1=no}
export needs_libt1

# we need ncurses for dialog
test ! -d $srcdir/$NCURSESDIR && : ${needs_ncurses=no}
test "$with_dialog"  != no    && : ${needs_ncurses=yes}
: ${needs_ncurses=no}
export needs_ncurses

# we need pnglib for dvipng, pdf[ex]tex, xetex, dvipdfm, dvipdfmx, xdvipdfmx
test ! -d $srcdir/$LIBPNGDIR  && : ${needs_pnglib=no}
test "$with_dvipng"  != no    && : ${needs_pnglib=yes}
test "$with_pdftex"  != no    && : ${needs_pnglib=yes}
test "$with_pdfetex" != no    && : ${needs_pnglib=yes}
test "$with_xetex"   != no    && : ${needs_pnglib=yes}
test "$with_dvipdfm" != no    && : ${needs_pnglib=yes}
test "$with_dvipdfmx" != no   && : ${needs_pnglib=yes}
test "$with_xdvipdfmx" != no  && : ${needs_pnglib=yes}
: ${needs_pnglib=no}
export needs_pnglib

# we need zlib for dvipng, texinfo, pdf[ex]tex, xetex, dvipdfm, dvipdfmx, xdvipdfmx
test ! -d $srcdir/$ZLIBDIR    && : ${needs_zlib=no}
test "$with_dvipng"  != no    && : ${needs_zlib=yes}
test "$with_pdftex"  != no    && : ${needs_zlib=yes}
test "$with_pdfetex" != no    && : ${needs_zlib=yes}
test "$with_xetex"   != no    && : ${needs_zlib=yes}
test "$with_dvipdfm" != no    && : ${needs_zlib=yes}
test "$with_dvipdfmx" != no   && : ${needs_zlib=yes}
test "$with_xdvipdfmx" != no  && : ${needs_zlib=yes}
test "$with_texinfo" != no    && : ${needs_zlib=yes}
: ${needs_zlib=no}
export needs_zlib

# we need libxpdf for pdf[ex]tex, xetex
test ! -d $srcdir/$LIBXPDFDIR && : ${needs_libxpdf=no}
test "$with_pdftex"  != no    && : ${needs_libxpdf=yes}
test "$with_pdfetex" != no    && : ${needs_libxpdf=yes}
test "$with_xetex"   != no    && : ${needs_libxpdf=yes}
: ${needs_libxpdf=no}
export needs_libxpdf

# we need libobsdcompat for pdftex
test ! -d $srcdir/$LIBOBSDCOMPATDIR && : ${needs_obsdcompat=no}
test "$with_pdftex"  != no    && : ${needs_obsdcompat=yes}
test "$with_pdfetex" != no    && : ${needs_obsdcompat=yes}
: ${needs_obsdcompat=no}
export needs_obsdcompat

# we need gd for dvipng
test ! -d $srcdir/$GDDIR && : ${needs_gd=no}
test "$with_dvipng"  != no    && : ${needs_gd=yes}
: ${needs_gd=no}
export needs_gd

# we need freetype for ttf2pk
test ! -d $srcdir/$FREETYPEDIR  && : ${needs_freetype=no}
test ! -d $srcdir/texk/ttf2pk   && : ${needs_freetype=no}
test "$with_ttf2pk" = no        && : ${needs_freetype=no}
: ${needs_freetype=yes}
export needs_freetype

# we need freetype2 for xetex, xdvipdfmx, dvipng
test ! -d $srcdir/$FREETYPE2DIR && : ${needs_freetype2=no}
test "$with_xetex"   != no      && : ${needs_freetype2=yes}
test "$with_xdvipdfmx" != no    && : ${needs_freetype2=yes}
test "$with_dvipng" != no       && : ${needs_freetype2=yes}
: ${needs_freetype2=no}
export needs_freetype2

# we need icu for xetex
test ! -d $srcdir/$ICUDIR && : ${needs_icu=no}
test "$with_xetex" != no  && : ${needs_icu=yes}
: ${needs_icu=no}
export needs_icu

# we need graphite for xetex
test ! -d $srcdir/$GRAPHITEDIR && : ${needs_graphite=no}
test "$with_xetex"   != no     && : ${needs_graphite=yes}
: ${needs_graphite=no}
export needs_graphite

# we need teckit for xetex
test ! -d $srcdir/$TECKITDIR && : ${needs_teckit=no}
test "$with_xetex" != no     && : ${needs_teckit=yes}
: ${needs_teckit=no}
export needs_teckit

dnl We cannot use variables (e.g. $LIBPNGDIR) for sinclude, so...
sinclude(libs/libpng/libpng.ac)
sinclude(libs/zlib/zlib.ac)
sinclude(libs/ncurses/ncurses.ac)
sinclude(libs/xpdf/libxpdf.ac)
sinclude(libs/t1lib/t1lib.ac)
sinclude(libs/gd/gd.ac)
sinclude(libs/freetype/freetype.ac)
sinclude(libs/freetype2/freetype2.ac)
sinclude(libs/icu-xetex/icu-xetex.ac)
sinclude(libs/graphite-engine/graphite-engine.ac)
sinclude(libs/teckit/teckit.ac)
sinclude(libs/obsdcompat/libobsd-compat.ac)

LIBSDEP="$CURSESDEP $ZLIBDEP $LIBPNGDEP $LIBXPDFDEP $LIBT1DEP $GDDEP $FREETYPEDEP $FREETYPE2DEP $ICUDEP $GRAPHITEDEP $TECKITDEP $LIBOBSDDEP"

LIBSDIRS=
test "$needs_teckit" = yes \
  && LIBSDIRS="$TECKITDIR $LIBSDIRS"
test "$needs_ncurses" = yes && test "$using_system_ncurses" != yes \
  && LIBSDIRS="$NCURSESDIR $LIBSDIRS"
test "$needs_pnglib" = yes && test "$using_system_pnglib" != yes \
  && LIBSDIRS="$LIBPNGDIR $LIBSDIRS"
test "$needs_zlib" = yes && test "$using_system_zlib" != yes \
  && LIBSDIRS="$ZLIBDIR $LIBSDIRS"
test "$needs_libxpdf" = yes \
  && LIBSDIRS="$LIBXPDFDIR $LIBSDIRS"
test "$needs_libt1" = yes && test "$using_system_t1lib" != yes \
  && LIBSDIRS="$LIBT1DIR $LIBTYPE1DIR $LIBSDIRS"
test "$needs_gd" = yes && test "$using_system_gd" != yes \
  && LIBSDIRS="$GDDIR $LIBSDIRS"
test "$needs_freetype" = yes && test "$using_system_freetype" != yes \
  && LIBSDIRS="$FREETYPEDIR $LIBSDIRS"
test "$needs_freetype2" = yes && test "$using_system_freetype2" != yes \
  && LIBSDIRS="$FREETYPE2DIR $LIBSDIRS"
test "$needs_icu" = yes && test "$using_system_icu" != yes \
  && LIBSDIRS="$ICUDIR $LIBSDIRS"
test "$needs_graphite" = yes \
  && LIBSDIRS="$GRAPHITEDIR $LIBSDIRS"
test "$needs_obsdcompat" = yes \
  && LIBSDIRS="$LIBOBSDCOMPATDIR $LIBSDIRS"

AC_CONFIG_SUBDIRS([libs])

PKGS='dialog lcdf-typetools lzma-utils mkjobtexmf pdfopen ps2eps psutils t1utils texi2html texinfo tpic2pdftex'
ESUBDIRS=
test -d utils || mkdir utils
for pkg in $PKGS; do
  if test -d $srcdir/utils/$pkg; then
    if eval "test \"`echo '$with_'${pkg}|sed 's/-/_/g'`\" != no"; then
      ESUBDIRS="$ESUBDIRS utils/$pkg"
      AC_CONFIG_SUBDIRS([utils/$pkg])
    fi
  fi
done

AC_SUBST(ESUBDIRS)
AC_SUBST(LIBSDEP)
AC_SUBST(LIBSDIRS)

# initialize texmf tree with fmtutil only for teTeX and TeX Live
if test ! -d $srcdir/texk/tetex || test -n "$xdvik_standalone" || test "x$cross_compiling" = xyes; then
  FMU=
else
  FMU='# '
fi
AC_SUBST(FMU)

# more customizations for standalone xdvik
if test -z "$xdvik_standalone"; then
  INSTDIRS='$(ESUBDIRS)'
else
  INSTDIRS=texk/xdvik
fi
AC_SUBST(INSTDIRS)

AC_CONFIG_SUBDIRS([texk])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT