Debian Codegraph @

configure.ac

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 AC_PREREQ(2.64)
2 AC_INIT([minidjvu],[0.8],[[email protected]])
3 AC_CONFIG_AUX_DIR(config)
4 AC_CONFIG_HEADER(config.h:config/config.h.in)
5 AC_CONFIG_MACRO_DIR([m4])
6 AC_PREFIX_DEFAULT(/usr/local)
7
8 LIBRARY_VERSION=`echo $PACKAGE_VERSION | sed -e 's/\./:/'`
9
10 AC_CANONICAL_HOST
11
12 target="$PACKAGE_NAME"
13 mdjvulib="lib$PACKAGE_NAME"
14
15 prefer_static='no'
16 prefer_gettext='yes'
17 AC_MSG_CHECKING([if we are building for Windows])
18 case "$host" in
19 *-mingw32)
20 prefer_static='yes'
21 prefer_gettext='no'
22 target="$target.exe"
23 AC_MSG_RESULT(yes)
24 ;;
25 *)
26 AC_MSG_RESULT(no)
27 ;;
28 esac
29
30 AC_ARG_ENABLE(
31 [static],
32 [ --enable-static Enable static building],
33 [static=$enableval],
34 [static=$prefer_static])
35
36 AC_ARG_ENABLE(
37 [gettext],
38 [ --enable-gettext Enable localization via gettext],
39 [gettext=$enableva],
40 [gettext=$prefer_gettext])
41
42 AC_ARG_WITH(
43 [tiff],
44 [ --with-tiff Enable static tiff support],
45 [tiff=$enableval],
46 [tiff=yes])
47
48 if test "$static" = "yes"; then
49 if test "x$LDFLAGS" = "x"; then
50 LDFLAGS="-static"
51 fi
52 mdjvulib="$mdjvulib.a"
53 oext='o'
54 SHARED_YES='#'
55 else
56 mdjvulib="$mdjvulib.la"
57 oext='lo'
58 STATIC_YES='#'
59 fi
60
61 case "$host" in
62 *-mingw32)
63 if test "$static" != "yes"; then
64 DLLFLAGS="$DLLFLAGS -Wl,--export-all-symbols"
65 fi
66 ;;
67 *-darwin* | *-macos10*)
68 if test -d /opt/local ; then
69 INCS="-I/opt/local/include"
70 LIBS="-L/opt/local/lib $LIBS"
71 elif test -d /sw ; then
72 INCS="-I/sw/include $CPPFLAGS"
73 LIBS="-L/sw/lib $LIBS"
74 fi
75 ;;
76 esac
77
78 # Checks for programs.
79
80 if test "x$CFLAGS" = "x"; then
81 CFLAGS="-g -pipe -O3"
82 fi
83 AC_PROG_MAKE_SET
84 AC_PROG_CXX
85 AC_PROG_CC
86 LT_INIT
87 AC_PROG_INSTALL
88 AC_PATH_PROG(GZIP, gzip)
89 AC_PATH_PROG(RM, rm)
90 RM="$RM -f"
91
92 # Checks for libraries.
93
94 zlib_ok='no'
95 dnl Test for libz
96 AC_CHECK_LIB(z, inflate,
97 [z_libs="-lz"; zlib_ok='yes'])
98
99 jpeg_ok='no'
100 AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
101 [jpeg_libs="-ljpeg"; jpeg_ok='yes'])
102
103 # Checks for header files.
104
105 if test "$tiff" != 'no'; then
106 have_tiff_header='no'
107 have_libtiff='no'
108
109 if test "$static" != 'yes' || test "$zlib_ok" = 'yes' -a "$jpeg_ok" = 'yes'; then
110 AC_CHECK_HEADER(tiff.h, have_tiff_header='yes')
111 AC_CHECK_HEADER(tiffio.h,have_tiff_header='yes',have_tiff_header='no')
112 if test "$have_tiff_header" = 'yes'; then
113 saveLIBS="$LIBS"
114 if test "$static" = 'yes'; then
115 LIBS="$z_libs $jpeg_libs $LIBS"
116 fi
117
118 have_libtiff='no'
119 AC_CHECK_LIB(tiff,TIFFOpen,have_libtiff='yes',have_libtiff='no')
120 if test "$have_libtiff" != 'no'; then
121 LIBS="-ltiff $LIBS"
122 AC_DEFINE(HAVE_TIFF,1,Define if you have TIFF library)
123 else
124 LIBS=$saveLIBS
125 fi
126 fi
127 fi
128
129 if test "$have_libtiff" != 'yes'; then
130 AC_MSG_WARN(*** Native TIFF support will not be included ***)
131 fi
132 fi
133
134 PO_YES='#'
135 if test "$gettext" != 'no'; then
136 have_intl_header='no'
137 gettext_ok='no'
138 needs_lintl='no'
139
140 AC_CHECK_HEADER(libintl.h, have_intl_header='yes')
141 if test "$have_intl_header" = 'yes'; then
142 AC_CHECK_FUNC(gettext,gettext_ok='yes')
143
144 if test "$gettext_ok" = 'no'; then
145 AC_CHECK_LIB(intl,gettext,[gettext_ok='yes'; needs_lintl='yes'])
146 fi
147 fi
148
149 iconv_ok='no'
150 needs_liconv='no'
151 AC_CHECK_FUNC(iconv, [iconv_ok='yes'])
152 if test "$iconv_ok" = "no"; then
153 AC_CHECK_LIB([iconv], [iconv], [iconv_ok='yes'; needs_liconv='yes'])
154 fi
155
156 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt)
157 if test "$MSGFMT" != ""; then
158 if msgfmt --help 2>&1 | grep illegal >/dev/null ; then
159 echo "msgfmt isn't GNU version"
160 MSGFMT=""
161 fi
162 fi
163
164 if test "$MSGFMT" != "" -a "$gettext_ok" != "no" -a "$iconv_ok" != "no" ; then
165 echo "msgfmt, iconv() and gettext() exist; will build i18n support"
166 AC_DEFINE(HAVE_GETTEXT,,Define if we are building i18n support)
167 PO_YES=''
168 if test "$needs_lintl" != "no"; then
169 intl_libs="-lintl"
170 LIBS="$intl_libs $LIBS"
171 fi
172 if test "$needs_liconv" != "no"; then
173 iconv_libs="-liconv"
174 LIBS="$iconv_libs $LIBS"
175 fi
176 else
177 echo "msgfmt and libintl don't both exist; will not build i18n support"
178 fi
179 fi
180
181 AC_CHECK_HEADERS([locale.h stdlib.h string.h])
182
183 AC_SUBST(target)
184 AC_SUBST(mdjvulib)
185 AC_SUBST(oext)
186 AC_SUBST(OPTS)
187 AC_SUBST(INCS)
188 AC_SUBST(MSGFMT)
189 AC_SUBST(LIBRARY_VERSION)
190 AC_SUBST(DLLFLAGS)
191 AC_SUBST(PO_YES)
192 AC_SUBST(STATIC_YES)
193 AC_SUBST(SHARED_YES)
194
195 # Checks for typedefs, structures, and compiler characteristics.
196 AC_HEADER_STDBOOL
197 AC_C_INLINE
198 AC_TYPE_SIZE_T
199
200 CFLAGS="$CFLAGS -Wall -Wshadow"
201 CFLAGS="$CFLAGS -pedantic-errors -Wpointer-arith -Waggregate-return"
202 CFLAGS="$CFLAGS -Wlong-long -Wredundant-decls -Wcast-qual -Wcast-align"
203 DEFS="$DEFS -D__STRICT_ANSI__ -DNDEBUG"
204 OPTS="-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
205
206 # Checks for library functions.
207 AC_FUNC_MALLOC
208 AC_FUNC_REALLOC
209 AC_CHECK_FUNCS([memset pow setlocale strcspn strrchr])
210
211 AC_CONFIG_FILES([Makefile])
212 AC_CONFIG_FILES([src/Makefile])
213 AC_CONFIG_FILES([tools/Makefile])
214 AC_CONFIG_FILES([po/Makefile])
215 AC_OUTPUT