1dnl This file is part of the FreeType project.
2dnl
3dnl Process this file with autoconf to produce a configure script.
4
5AC_INIT(lib/freetype.h)
6
7dnl Due to a bug in autoconf we must set $srcdir explicitly to an absolute
8dnl path.
9srcdir=`cd $srcdir; pwd`
10
11AM_DISABLE_STATIC
12AM_PROG_LIBTOOL
13
14dnl FreeType version
15freetype_version='1.2.0'
16
17dnl libttf.so version
18version_info='4:0:2'
19
20AC_ARG_ENABLE(nls,
21              [  --disable-nls           don't use NLS],
22              USE_NLS=no, USE_NLS=yes)
23AC_SUBST(USE_NLS)
24
25dnl Checks for system type.
26AC_CANONICAL_SYSTEM
27
28dnl Checks for programs.
29AC_PROG_CC
30AC_PROG_CPP
31
32dnl get Compiler flags right.
33
34if test "x$CC" = xgcc; then
35  XX_CFLAGS="-Wall -pedantic -ansi"
36else
37  case "$host" in
38    *-dec-osf*)
39      XX_CFLAGS="-std1 -O2 -g3"
40      ;;
41    *)
42      XX_CFLAGS=
43      ;;
44  esac
45fi
46AC_SUBST(XX_CFLAGS)
47
48dnl at least Digital UNIX 4.0d needs this due to a strange make program
49
50case "$host" in
51  *-dec-osf*)
52    ln -s ../../MakeSub lib/arch
53    ln -s ../../MakeSub test/arch
54    ;;
55esac
56
57AC_SUBST(freetype_version)
58AC_SUBST(version_info)
59
60dnl gettext support
61if test "$USE_NLS" = "yes"; then
62  AC_REQUIRE([AC_PROG_MAKE_SET])
63  AC_CHECK_HEADERS(locale.h)
64  AC_CHECK_FUNCS(setlocale)
65  AC_SUBST(HAVE_LOCALE_H)
66
67  ALL_LINGUAS="de fr cs nl es"
68  AC_CHECK_HEADERS(libintl.h)
69  AC_CHECK_LIB(intl,gettext)
70  AC_SUBST(HAVE_LIBINTL_H)
71  AC_SUBST(HAVE_LIBINTL)
72
73  dnl Handle localedir
74  LOCALEDIR='${prefix}/share/locale'
75  AC_ARG_WITH(locale-dir,
76  [  --with-locale-dir=DIR   Location of the locale file(s)
77                          [PREFIX/share/locale]],[
78    if test x$withval = xyes; then
79      AC_MSG_WARN(Usage is: --with-locale-dir=basedir)
80    else
81      if test x$withval = xno; then
82        AC_MSG_WARN(Usage is: --with-locale-dir=basedir)
83      else
84        LOCALEDIR=$withval
85      fi
86    fi
87  ])
88  AC_SUBST(LOCALEDIR)
89
90  AC_PATH_PROG(MSGFMT, msgfmt, $MSGFMT)
91  if test -n "$MSGFMT"; then
92    AC_CHECK_FUNCS(dcgettext)
93    AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
94    AC_PATH_PROG(XGETTEXT, xgettext, $XGETTEXT)
95    AC_PATH_PROG(MSGMERGE, msgmerge, $MSGMERGE)
96
97    dnl Test whether we really found GNU xgettext.
98    if test -n "$XGETTEXT"; then
99      if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
100        : ;
101      else
102        AC_MSG_RESULT(
103          [found xgettext program is not GNU xgettext; ignore it])
104        XGETTEXT=""
105      fi
106    fi
107
108    dnl We add another test for comparing GNU xgettext with openwin xgettext
109    if test -n "$XGETTEXT"; then
110      if $XGETTEXT --help > /dev/null 2> /dev/null; then
111        : ;
112      else
113        AC_MSG_RESULT(
114          [found xgettext program is not GNU xgettext; ignore it])
115        XGETTEXT=""
116      fi
117    fi
118
119    dnl Test whether we really found GNU msgfmt.
120    if test -n "$MSGFMT"; then
121      if $MSGFMT < /dev/null 2> /dev/null; then
122        AC_MSG_RESULT(
123          [found msgfmt program is not GNU msgfmt; NLS won't be installed])
124        MSGFMT=""
125      fi
126    fi
127
128    AC_TRY_LINK(,
129                [extern int _nl_msg_cat_cntr;
130                 return _nl_msg_cat_cntr],
131                [CATOBJEXT=.gmo
132                 DATADIRNAME=share],
133                [CATOBJEXT=.mo
134                 DATADIRNAME=lib])
135    INSTOBJEXT=.mo
136  fi
137
138  if test -n "$ALL_LINGUAS"; then
139    for lang in $ALL_LINGUAS; do
140      CATALOGS="$CATALOGS $lang$CATOBJEXT"
141    done
142  fi
143  AC_SUBST(CATALOGS)
144  AC_SUBST(CATOBJEXT)
145  AC_SUBST(INSTOBJEXT)
146  AC_SUBST(DATADIRNAME)
147fi
148
149dnl don't use NLS, when there is no gettext installed
150if test x"$MSGFMT" = x; then
151  USE_NLS=no
152fi
153
154
155AC_CHECK_PROG(RM, rm, rm)
156AC_CHECK_PROG(RMDIR, rmdir, rmdir)
157AC_PROG_INSTALL
158AC_PROG_LN_S
159
160dnl Checks for libraries.
161sinclude(net.m4)
162AC_LIBRARY_NET
163AC_CHECK_LIB(m, cos)
164
165dnl Checks for header files.
166AC_PATH_XTRA
167AC_CHECK_HEADERS(stdlib.h fcntl.h unistd.h)
168
169dnl Checks for typedefs, structures, and compiler characteristics.
170AC_C_CONST
171AC_CHECK_SIZEOF(int)
172AC_CHECK_SIZEOF(long)
173
174dnl Checks for library functions.
175
176dnl Here we check whether we can use our mmap file component.
177AC_FUNC_MMAP
178if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
179  TT_FILE_COMPONENT=ttfile.c
180else
181  TT_FILE_COMPONENT=arch/unix/ttmmap.c
182fi
183AC_SUBST(TT_FILE_COMPONENT)
184
185AC_CHECK_FUNCS(memcpy memmove)
186
187AC_CONFIG_HEADER(ft_conf.h)
188
189dnl Another bug: to make --srcdir work correctly we have to create the
190dnl directory hierarchy first since autoconf only uses mkdir.
191$srcdir/mkinstalldirs lib/arch/unix test/arch/unix
192
193AC_OUTPUT(Makefile
194           MakeSub
195           lib/arch/unix/Makefile
196           test/arch/unix/Makefile
197           po/Makefile.in,
198          [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
199
200
201dnl end of configure.in
202