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