summaryrefslogtreecommitdiff
path: root/configure.in
blob: c4ac9fc862e34374214c89485d1cdb5dfc8baf7f (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
351
352
353
354
355
dnl Process this file with autoconf to create configure.

PANGO_MAJOR_VERSION=0
PANGO_MINOR_VERSION=13

AC_SUBST(PANGO_MAJOR_VERSION)
AC_SUBST(PANGO_MINOR_VERSION)

AC_INIT(ChangeLog)
AM_INIT_AUTOMAKE(pango, 0.13)

AM_CONFIG_HEADER(config.h)

AC_PROG_CC
AM_PROG_LIBTOOL

changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl

AC_PATH_XTRA

AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)

# define a MAINT-like variable REBUILD which is set if Perl
# is found, so autogenerated sources can be rebuilt

AC_CHECK_PROGS(PERL, perl5 perl)

REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
     test -n "$PERL" && \
     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
  REBUILD=
fi
AC_SUBST(REBUILD)

if test x$no_x = xyes ; then
  AC_MSG_ERROR([X development libraries not found])
fi

X_LIBS="$X_LIBS -lX11"

#
# Checks for FreeType
#
FREETYPE_LIBS=
FREETYPE_CFLAGS=
have_freetype=false
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
if test "x$FREE_CONFIG" != "xno" ; then
  FREETYPE_CFLAGS=`freetype-config --cflags`
  FREETYPE_LIBS=`freetype-config --libs`

  AC_CHECK_LIB(freetype, FT_New_Face, have_freetype=true
	       ,:,$FREETYPE_LIBS)
fi
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS)
AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype) 

#
# Checks for Xft/XRender
#
have_xft=false
XFT_LIBS=""
XFT_CFLAGS=""
if test $have_freetype = true ; then
  AC_CHECK_LIB(Xrender, XRenderFindFormat, 
    AC_CHECK_LIB(Xft, XftFontOpen, have_xft=true, :, -lXrender -lXext $X_LIBS $FREETYPE_LIBS)
  ,:,-lXext $X_LIBS)

  if $have_xft = 'true' ; then
    XFT_LIBS="-lXft -lXrender -lXext $X_LIBS $FREETYPE_LIBS"
  fi
fi

AC_SUBST(XFT_LIBS)
AM_CONDITIONAL(HAVE_XFT, $have_xft) 

#
# Checks for GLib
#
AM_PATH_GLIB_2_0(1.3.1,,
                 AC_MSG_ERROR([GLib 1.3.1 is required for building Pango]),
	         gmodule gobject)

AC_PATH_PROG(GLIB_CONFIG, glib-config-2.0, no)
if test x$GLIB_CONFIG = xno ; then
  AC_MSG_ERROR([*** glib-config-2.0 not found])
fi
GLIB_CFLAGS="`$GLIB_CONFIG --cflags gmodule gobject`"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
GLIB_LIBS="`$GLIB_CONFIG --libs gmodule gobject`"
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_CFLAGS)

#
# Checks for fribidi
#
AC_ARG_WITH(fribidi, [ --with-fribidi     Use external fribidi library ],,with_fribidi=no)

FRIBIDI_LIBS=""
FRIBIDI_CFLAGS=""
FRIBIDI_PC=""
have_fribidi=no

if test "x$with_fribidi" = "xyes" ; then
   AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config, no)
   if test x$FRIBIDI_CONFIG = xno ; then
     AC_MSG_ERROR([*** fribidi-config not found])
   fi

   if $FRIBIDI_CONFIG --cflags | grep lib/glib/include > /dev/null ; then
     AC_MSG_ERROR([*** fribidi appears to be compiled against GLib-1.2.x.
     *** You must compile fribidi with GLib-1.3.1 or better.])
   fi
 
   FRIBIDI_CFLAGS="`$FRIBIDI_CONFIG --cflags`"
   CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
   FRIBIDI_LIBS="`$FRIBIDI_CONFIG --libs`"
   FRIBIDI_PC="fribidi,"	

   AC_CHECK_LIB(fribidi, fribidi_get_mirror_char, :,
	        AC_MSG_ERROR([*** libfribidi not found.]), $FRIBIDI_LIBS)

   AC_DEFINE(HAVE_FRIBIDI)
   have_fribidi=yes
fi

AC_SUBST(FRIBIDI_LIBS)
AC_SUBST(FRIBIDI_CFLAGS)
AC_SUBST(FRIBIDI_PC)
AM_CONDITIONAL(HAVE_FRIBIDI, test x$have_fribidi = xyes)

#
# Allow building some or all modules included
#
AC_MSG_CHECKING(modules to link statically)

AC_ARG_WITH(included_modules, [ --with-included-modules=MODULE1,MODULE2,...     Build the given modules into Pango])

indic_modules="gurmukhi,bengali,gujarati,devanagari,myanmar"

included_modules=""
if test "x$with_included_modules" != xno || test "x$with_included_modules" = x ; then

   # If no modules specified, include all modules
   if test "x$with_included_modules" = xyes ; then
     included_modules="arabic,basic,hangul,tamil,thai,$indic_modules"
   else
     included_modules="$with_included_modules"
   fi
fi

AC_MSG_RESULT($included_modules)

INCLUDED_MODULES=
IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
  if echo $indic_modules | grep "\(^\| \)$module\(\$\| \)" > /dev/null; then
    INCLUDED_MODULES="$INCLUDED_MODULES \$(top_builddir)/modules/indic/libpango-$module.la"
  else
    INCLUDED_MODULES="$INCLUDED_MODULES \$(top_builddir)/modules/$module/libpango-$module.la"
  fi
done
IFS="$pango_save_ifs"

AC_SUBST(INCLUDED_MODULES)

AM_CONDITIONAL(INCLUDE_ARABIC,echo $included_modules | grep '\(^\|,\)arabic\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC,echo $included_modules | grep '\(^\|,\)basic\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_HANGUL,echo $included_modules | grep '\(^\|,\)hangul\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_TAMIL,echo $included_modules | grep '\(^\|,\)tamil\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_THAI,echo $included_modules | grep '\(^\|,\)thai\($\|,\)' > /dev/null)

AM_CONDITIONAL(INCLUDE_MYANMAR,echo $included_modules | grep '\(^\|,\)myanmar\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_GURMUKHI,echo $included_modules | grep '\(^\|,\)gurmukhi\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BENGALI,echo $included_modules | grep '\(^\|,\)bengali\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_GUJARATI,echo $included_modules | grep '\(^\|,\)gujarati\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_DEVANAGARI,echo $included_modules | grep '\(^\|,\)devanagari\($\|,\)' > /dev/null)

have_indic_modules="no"
IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $indic_modules; do
  if echo $included_modules | grep "\(^\| \)$module\(\$\| \)" > /dev/null; then
    have_indic_modules="yes"
  fi
done
IFS="$pango_save_ifs"

AM_CONDITIONAL(INCLUDE_ANY_INDIC,test $have_indic_modules = yes)

#
# We use flockfile to implement pango_getline() - should be moved to GLib
#
AC_CHECK_FUNCS(flockfile)

#
# Check for Qt - which we use for building the viewer example, if
# present
#

AC_ARG_WITH(qt, [ --with-qt=DIR    Location where Qt is installed],,with_qt=yes)

QTDIR=
AC_MSG_CHECKING(For Qt location)
  
if test "x$with_qt" = xyes ; then         
# Search for Qt in various possibly standard ocations
   for dir in /usr/lib/qt-2.2.0 /usr/lib/qt-2.1.0 /usr/lib/qt-2.0.1 /usr/lib/qt-2.0.0 /usr/lib/qt2 ; do
      if test -x $dir/bin/moc ; then
         QTDIR=$dir
         break
      fi
   done

else
   if test "x$with_qt" != xno ; then
      if test -x $with_qt/bin/moc ; then
         QTDIR=$with_qt
      fi
   fi
fi

if test "x$QTDIR" = x ; then
  AC_MSG_RESULT(none)
else
  AC_MSG_RESULT($QTDIR)
  
  AC_PROG_CXX
fi

AM_CONDITIONAL(BUILD_QT_TEST, test "x$QTDIR" != x)
AC_SUBST(QTDIR)
  
dnl **************************
dnl *** Checks for gtk-doc ***
dnl **************************

AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])

if test "x$with_html_dir" = "x" ; then
  HTML_DIR='${datadir}/gtk-doc/html'
else
  HTML_DIR=$with_html_dir
fi

AC_SUBST(HTML_DIR)


AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
AC_SUBST(HAVE_GTK_DOC)

AC_CHECK_PROG(DB2HTML, db2html, true, false)
AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)

dnl Let people disable the gtk-doc stuff.
AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)

if test x$enable_gtk_doc = xauto ; then
  if test x$GTKDOC = xtrue ; then
    enable_gtk_doc=yes
  else
    enable_gtk_doc=no 
  fi
fi

dnl NOTE: We need to use a separate automake conditional for this
dnl       to make this work with the tarballs.
AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)


AC_OUTPUT_COMMANDS([
cat > pango/module-defs.c <<EOTEXT
/* Autogenerated by configure. Do not edit */

#include "modules.h"

EOTEXT

IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
  cat >> pango/module-defs.c <<EOTEXT
extern void         _pango_${module}_script_engine_list (PangoEngineInfo **engines, int *n_engines);
extern PangoEngine *_pango_${module}_script_engine_load (const char *id);
extern void         _pango_${module}_script_engine_unload (PangoEngine *engine);

EOTEXT
done 

IFS="$pango_save_ifs"

cat >> pango/module-defs.c <<EOTEXT

PangoIncludedModule _pango_included_modules[] = {
EOTEXT

IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
  cat >> pango/module-defs.c <<EOTEXT
 { _pango_${module}_script_engine_list, _pango_${module}_script_engine_load,_pango_${module}_script_engine_unload },
EOTEXT
done

IFS="$pango_save_ifs"

cat >> pango/module-defs.c <<EOTEXT
 { NULL, NULL, NULL },
};
EOTEXT

],[
included_modules=$included_modules
])

AC_HEADER_DIRENT
AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))

AC_OUTPUT([
Makefile 
pango/Makefile
pango/mini-fribidi/Makefile
pango/opentype/Makefile
pango/makefile.mingw
pango/pango.rc
pango/pangoft2.rc
modules/Makefile
modules/arabic/Makefile
modules/basic/Makefile
modules/basic/makefile.mingw
modules/hangul/Makefile
modules/indic/Makefile
modules/tamil/Makefile
modules/thai/Makefile
examples/Makefile
examples/makefile.mingw
docs/Makefile
tools/Makefile
fonts/Makefile
tests/Makefile
pango.spec
pango-config
pango.pc
pangox.pc
pangoxft.pc
],[case "$CONFIG_FILES" in
*pango-config*)chmod +x pango-config;;
esac])