1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
AC_INIT |
3 |
AC_CONFIG_SRCDIR([lib/psiconv]) |
4 |
AM_INIT_AUTOMAKE(psiconv,0.9.0) |
5 |
|
6 |
AM_CONFIG_HEADER(config.h) |
7 |
|
8 |
dnl Checks for programs. |
9 |
AM_PROG_LIBTOOL |
10 |
|
11 |
dnl This is stolen from gnome-libs-1.0.14 |
12 |
AC_ARG_ENABLE(compile-warnings, |
13 |
[ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.], |
14 |
,enable_compile_warnings=minimum) |
15 |
|
16 |
AC_MSG_CHECKING(what warning flags to pass to the C compiler) |
17 |
warnCFLAGS= |
18 |
if test "x$GCC" != xyes; then |
19 |
enable_compile_warnings=no |
20 |
fi |
21 |
if test "x$enable_compile_warnings" != "xno"; then |
22 |
if test "x$GCC" = "xyes"; then |
23 |
case " $CFLAGS " in |
24 |
*[\ \ ]-Wall[\ \ ]*) ;; |
25 |
*) warnCFLAGS="-Wall -Wunused" ;; |
26 |
esac |
27 |
|
28 |
## -W is not all that useful. And it cannot be controlled |
29 |
## with individual -Wno-xxx flags, unlike -Wall |
30 |
if test "x$enable_compile_warnings" = "xyes"; then |
31 |
warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith" |
32 |
fi |
33 |
fi |
34 |
fi |
35 |
AC_MSG_RESULT($warnCFLAGS) |
36 |
|
37 |
AC_ARG_ENABLE(iso-c, |
38 |
[ --enable-iso-c Try to warn if code is not ISO C ],, |
39 |
enable_iso_c=no) |
40 |
|
41 |
AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) |
42 |
complCFLAGS= |
43 |
if test "x$enable_iso_c" != "xno"; then |
44 |
if test "x$GCC" = "xyes"; then |
45 |
case " $CFLAGS " in |
46 |
*[\ \ ]-ansi[\ \ ]*) ;; |
47 |
*) complCFLAGS="$complCFLAGS -ansi" ;; |
48 |
esac |
49 |
|
50 |
case " $CFLAGS " in |
51 |
*[\ \ ]-pedantic[\ \ ]*) ;; |
52 |
*) complCFLAGS="$complCFLAGS -pedantic" ;; |
53 |
esac |
54 |
fi |
55 |
fi |
56 |
AC_MSG_RESULT($complCFLAGS) |
57 |
if test "x$cflags_set" != "xyes"; then |
58 |
CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" |
59 |
cflags_set=yes |
60 |
AC_SUBST(cflags_set) |
61 |
fi |
62 |
|
63 |
|
64 |
dnl Checks for libraries. |
65 |
AC_ARG_WITH(imagemagick, |
66 |
[ --with-imagemagick enable ImageMagick (default = yes)], |
67 |
[IMAGEMAGICK=$withval], |
68 |
[IMAGEMAGICK='yes']) |
69 |
if test x"$IMAGEMAGICK" != xno ; then |
70 |
AC_CHECK_PROG(IMAGEMAGICK,Magick-config,yes,no) |
71 |
if test x"$IMAGEMAGICK" != xno ; then |
72 |
CFLAGS_OLD="$CFLAGS" |
73 |
CPPFLAGS_OLD="$CPPFLAGS" |
74 |
LDFLAGS_OLD="$LDFLAGS" |
75 |
LIBS_OLD="$LIBS" |
76 |
CFLAGS="$CFLAGS `Magick-config --cflags`" |
77 |
CPPFLAGS="$CPPFLAGS `Magick-config --cppflags`" |
78 |
LDFLAGS="$LDFLAGS `Magick-config --ldflags`" |
79 |
LIBS="$LIBS `Magick-config --libs`" |
80 |
|
81 |
|
82 |
AC_MSG_CHECKING(whether GetMagickInfo works and which API to use) |
83 |
AC_TRY_RUN([ #include <stdio.h> |
84 |
#include <magick/api.h> |
85 |
int main(void) { ExceptionInfo exception; |
86 |
GetExceptionInfo(&exception); |
87 |
OpenModules(&exception); |
88 |
return (NULL == GetMagickInfo(NULL,&exception)); }], |
89 |
IMAGEMAGICK=new,IMAGEMAGICK=no,IMAGEMAGICK=no) |
90 |
if test x"$IMAGEMAGICK" = xno ; then |
91 |
AC_TRY_RUN([ #include <magick/magick.h> |
92 |
int main(void) { ExceptionInfo exception; |
93 |
GetExceptionInfo(&exception); |
94 |
OpenModules(&exception); |
95 |
return (NULL == GetMagickInfo(NULL,&exception)); }], |
96 |
IMAGEMAGICK=old,IMAGEMAGICK=no,IMAGEMAGICK=no) |
97 |
fi |
98 |
AC_MSG_RESULT($IMAGEMAGICK) |
99 |
LDFLAGS="$LDFLAGS_OLD" |
100 |
LIBS="$LIBS_OLD" |
101 |
dnl Note: CFLAGS can't be set for single directories, so we propagate them |
102 |
if test x"$IMAGEMAGICK" = xno ; then |
103 |
CFLAGS="$CFLAGS_OLD" |
104 |
CPPFLAGS="$CPPFLAGS_OLD" |
105 |
fi |
106 |
fi |
107 |
fi |
108 |
if test x"$IMAGEMAGICK" != xno ; then |
109 |
LIB_MAGICK="`Magick-config --libs` `Magick-config --ldflags`" |
110 |
AC_DEFINE(IMAGEMAGICK,1,[ImageMagick availability]) |
111 |
if test x"$IMAGEMAGICK" = xold ; then |
112 |
AC_DEFINE(IMAGEMAGICK_OLD,1,[ImageMagick old API version]) |
113 |
fi |
114 |
else |
115 |
LIB_MAGICK= |
116 |
fi |
117 |
AC_SUBST(LIB_MAGICK) |
118 |
|
119 |
dnl Checks for header files. |
120 |
AC_HEADER_STDC |
121 |
AC_CHECK_HEADERS(unistd.h) |
122 |
|
123 |
dnl Checks for typedefs, structures, and compiler characteristics. |
124 |
AC_C_CONST |
125 |
AC_TYPE_SIZE_T |
126 |
|
127 |
dnl Here we check for large enough integer types. This is not quite |
128 |
dnl good enough, but it should work almost always. |
129 |
|
130 |
AC_CHECK_SIZEOF(char,1) |
131 |
AC_CHECK_SIZEOF(short,1) |
132 |
AC_CHECK_SIZEOF(int,2) |
133 |
AC_CHECK_SIZEOF(long,4) |
134 |
|
135 |
AC_MSG_CHECKING(for an 8 bit integer type) |
136 |
if test $ac_cv_sizeof_char -ge 1 ; then |
137 |
INT_8_BIT=char |
138 |
AC_MSG_RESULT(char) |
139 |
elif test $ac_cv_sizeof_short -ge 1 ; then |
140 |
INT_8_BIT=short |
141 |
AC_MSG_RESULT(short) |
142 |
elif test $ac_cv_sizeof_int -ge 1 ; then |
143 |
AC_MSG_RESULT(int) |
144 |
elif test $ac_cv_sizeof_long -ge 1 ; then |
145 |
INT_8_BIT=long |
146 |
AC_MSG_RESULT(long) |
147 |
else |
148 |
AC_MSG_ERROR(No integer type of at least 8 bits found) |
149 |
fi |
150 |
|
151 |
AC_MSG_CHECKING(for a 16 bit integer type) |
152 |
if test $ac_cv_sizeof_char -ge 2 ; then |
153 |
INT_16_BIT=char |
154 |
AC_MSG_RESULT(char) |
155 |
elif test $ac_cv_sizeof_short -ge 2 ; then |
156 |
INT_16_BIT=short |
157 |
AC_MSG_RESULT(short) |
158 |
elif test $ac_cv_sizeof_int -ge 2 ; then |
159 |
INT_16_BIT=int |
160 |
AC_MSG_RESULT(int) |
161 |
elif test $ac_cv_sizeof_long -ge 2 ; then |
162 |
INT_16_BIT=long |
163 |
AC_MSG_RESULT(long) |
164 |
else |
165 |
AC_MSG_ERROR(No integer type of at least 16 bits found) |
166 |
fi |
167 |
|
168 |
AC_MSG_CHECKING(for a 32 bit integer type) |
169 |
if test $ac_cv_sizeof_char -ge 4 ; then |
170 |
INT_32_BIT=char |
171 |
AC_MSG_RESULT(char) |
172 |
elif test $ac_cv_sizeof_short -ge 4 ; then |
173 |
INT_32_BIT=short |
174 |
AC_MSG_RESULT(short) |
175 |
elif test $ac_cv_sizeof_int -ge 4 ; then |
176 |
INT_32_BIT=int |
177 |
AC_MSG_RESULT(int) |
178 |
elif test $ac_cv_sizeof_long -ge 4 ; then |
179 |
INT_32_BIT=long |
180 |
AC_MSG_RESULT(long) |
181 |
else |
182 |
AC_MSG_ERROR(No integer type of at least 32 bits found) |
183 |
fi |
184 |
|
185 |
AC_SUBST(INT_8_BIT) |
186 |
AC_SUBST(INT_16_BIT) |
187 |
AC_SUBST(INT_32_BIT) |
188 |
|
189 |
dnl Checks for library functions. |
190 |
AC_FUNC_VPRINTF |
191 |
AC_REPLACE_FUNCS(strdup) |
192 |
AC_CHECK_FUNC(getopt_long,getopt=yes,getopt=no) |
193 |
if test $getopt = no; then |
194 |
AC_LIBOBJ([getopt]) |
195 |
AC_LIBOBJ([getopt1]) |
196 |
fi |
197 |
|
198 |
AC_ARG_ENABLE(dmalloc, |
199 |
[ --enable-dmalloc Enable dmalloc for developers (default:off)], |
200 |
[case "${enableval}" in |
201 |
yes) dmalloc=yes ;; |
202 |
no) dmalloc=no ;; |
203 |
*) AC_MSG_ERROR(bad value ${enableval} for --enable-dmalloc) ;; |
204 |
esac],[dmalloc=false]) |
205 |
if test x"$dmalloc" = xyes; then |
206 |
AC_CHECK_LIB(dmalloc,malloc,dmalloc=yes,dmalloc=no) |
207 |
fi |
208 |
if test x"$dmalloc" = xyes; then |
209 |
AC_CHECK_HEADER(dmalloc.h,dmalloc=yes,dmalloc=no) |
210 |
fi |
211 |
if test x"$dmalloc" = xyes ; then |
212 |
LIB_DMALLOC=-ldmalloc |
213 |
AC_DEFINE(DMALLOC,1,[DMalloc availability]) |
214 |
else |
215 |
LIB_DMALLOC= |
216 |
fi |
217 |
AC_SUBST(LIB_DMALLOC) |
218 |
|
219 |
dnl With and without functions |
220 |
AC_ARG_ENABLE(html-docs, |
221 |
[ --disable-html-docs Disable generation of HTML 3.2 docs (default: on)], |
222 |
[case "${enableval}" in |
223 |
yes) htmldocs=true ;; |
224 |
no) htmldocs=false ;; |
225 |
*) AC_MSG_ERROR(bad value ${enableval} for --enable-html-docs) ;; |
226 |
esac],[htmldocs=true]) |
227 |
AM_CONDITIONAL(HTMLDOCS,test x$htmldocs = xtrue) |
228 |
|
229 |
AC_ARG_ENABLE(html4-docs, |
230 |
[ --enable-html4-docs Enable generation of HTML 4 docs (default: off)], |
231 |
[case "${enableval}" in |
232 |
yes) html4docs=true ;; |
233 |
no) html4docs=false ;; |
234 |
*) AC_MSG_ERROR(bad value ${enableval} for --enable-html4-docs) ;; |
235 |
esac],[html4docs=false]) |
236 |
AM_CONDITIONAL(HTML4DOCS,test x$html4docs = xtrue) |
237 |
|
238 |
AC_ARG_ENABLE(ascii-docs, |
239 |
[ --enable-ascii-docs Enable generation of ASCII docs (default: off)], |
240 |
[case "${enableval}" in |
241 |
yes) asciidocs=true ;; |
242 |
no) asciidocs=false ;; |
243 |
*) AC_MSG_ERROR(bad value ${enableval} for --enable-ascii-docs) ;; |
244 |
esac],[asciidocs=false]) |
245 |
AM_CONDITIONAL(ASCIIDOCS,test x$asciidocs = xtrue) |
246 |
|
247 |
AC_ARG_ENABLE(rtf-docs, |
248 |
[ --enable-rtf-docs Enable generation of RTF docs (default: off)], |
249 |
[case "${enableval}" in |
250 |
yes) rtfdocs=true ;; |
251 |
no) rtfdocs=false ;; |
252 |
*) AC_MSG_ERROR(bad value ${enableval} for --enable-rtf-docs) ;; |
253 |
esac],[rtfdocs=false]) |
254 |
AM_CONDITIONAL(RTFDOCS,test x$rtfdocs = xtrue) |
255 |
|
256 |
|
257 |
AC_CONFIG_FILES([Makefile compat/Makefile lib/Makefile lib/psiconv/Makefile program/Makefile program/psiconv/Makefile lib/psiconv/general.h formats/Makefile docs/Makefile extra/Makefile]) |
258 |
AC_OUTPUT |