comparison mupdf-source/thirdparty/libjpeg/configure.ac @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 # IJG auto-configuration source file.
2 # Process this file with autoconf to produce a configure script.
3
4 #
5 # Configure script for IJG libjpeg
6 #
7
8 AC_INIT([libjpeg], [9.6.0])
9
10 # Directory where autotools helper scripts lives.
11 AC_CONFIG_AUX_DIR([.])
12
13 # Generate configuration headers.
14 AC_CONFIG_HEADERS([jconfig.h:jconfig.cfg])
15
16 # Hack: disable autoheader so that it doesn't overwrite our cfg template.
17 AUTOHEADER="echo autoheader ignored"
18
19 # Check system type
20 AC_CANONICAL_TARGET
21
22 # Initialize Automake
23 # Don't require all the GNU mandated files
24 AM_INIT_AUTOMAKE([-Wall -Werror no-dist foreign])
25
26 # Make --enable-silent-rules the default.
27 # To get verbose build output you may configure
28 # with --disable-silent-rules or use "make V=1".
29 AM_SILENT_RULES([yes])
30
31 # Add configure option --enable-maintainer-mode which enables
32 # dependency checking and generation useful to package maintainers.
33 # This is made an option to avoid confusing end users.
34 AM_MAINTAINER_MODE
35
36 # Check for programs
37 AC_PROG_CC
38 AC_PROG_CPP
39 AC_PROG_INSTALL
40 AC_PROG_MAKE_SET
41 AC_PROG_LN_S
42 AC_PROG_EGREP
43 AM_PROG_AR
44
45 # Check if LD supports linker scripts,
46 # and define automake conditional HAVE_LD_VERSION_SCRIPT if so.
47 AC_ARG_ENABLE([ld-version-script],
48 AS_HELP_STRING([--enable-ld-version-script],
49 [enable linker version script (default is enabled when possible)]),
50 [have_ld_version_script=$enableval], [])
51 if test -z "$have_ld_version_script"; then
52 AC_MSG_CHECKING([if LD -Wl,--version-script works])
53 save_LDFLAGS="$LDFLAGS"
54 LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
55 cat > conftest.map <<EOF
56 VERS_1 {
57 global: sym;
58 };
59
60 VERS_2 {
61 global: sym;
62 } VERS_1;
63 EOF
64 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
65 [have_ld_version_script=yes], [have_ld_version_script=no])
66 rm -f conftest.map
67 LDFLAGS="$save_LDFLAGS"
68 AC_MSG_RESULT($have_ld_version_script)
69 fi
70 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
71
72 # See if compiler supports prototypes.
73 AC_MSG_CHECKING([for function prototypes])
74 AC_CACHE_VAL([ijg_cv_have_prototypes],
75 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
76 int testfunction (int arg1, int * arg2); /* check prototypes */
77 struct methods_struct { /* check method-pointer declarations */
78 int (*error_exit) (char *msgtext);
79 int (*trace_message) (char *msgtext);
80 int (*another_method) (void);
81 };
82 int testfunction (int arg1, int * arg2) /* check definitions */
83 { return arg2[arg1]; }
84 int test2function (void) /* check void arg list */
85 { return 0; }
86 ]])],
87 [ijg_cv_have_prototypes=yes],
88 [ijg_cv_have_prototypes=no])])
89 AC_MSG_RESULT([$ijg_cv_have_prototypes])
90 if test $ijg_cv_have_prototypes = yes; then
91 AC_DEFINE([HAVE_PROTOTYPES],[1],[Compiler supports function prototypes.])
92 else
93 AC_MSG_WARN([Your compiler does not seem to know about function prototypes.
94 Perhaps it needs a special switch to enable ANSI C mode.
95 If so, we recommend running configure like this:
96 ./configure CC='cc -switch'
97 where -switch is the proper switch.])
98 fi
99
100 # Check header files
101 AC_CHECK_HEADERS([stddef.h stdlib.h locale.h])
102 AC_CHECK_HEADER([string.h], [],
103 [AC_DEFINE([NEED_BSD_STRINGS], [1],
104 [Compiler has <strings.h> rather than standard <string.h>.])])
105
106 # See whether type size_t is defined in any ANSI-standard places;
107 # if not, perhaps it is defined in <sys/types.h>.
108 AC_MSG_CHECKING([for size_t])
109 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
110 #ifdef HAVE_STDDEF_H
111 #include <stddef.h>
112 #endif
113 #ifdef HAVE_STDLIB_H
114 #include <stdlib.h>
115 #endif
116 #include <stdio.h>
117 #ifdef NEED_BSD_STRINGS
118 #include <strings.h>
119 #else
120 #include <string.h>
121 #endif
122 typedef size_t my_size_t;
123 ]], [[ my_size_t foovar; ]])],
124 [ijg_size_t_ok=yes],
125 [ijg_size_t_ok="not ANSI, perhaps it is in sys/types.h"])
126 AC_MSG_RESULT([$ijg_size_t_ok])
127 if test "$ijg_size_t_ok" != yes; then
128 AC_CHECK_HEADER([sys/types.h],
129 [AC_DEFINE([NEED_SYS_TYPES_H], [1],
130 [Need to include <sys/types.h> in order to obtain size_t.])
131 AC_EGREP_CPP([size_t], [#include <sys/types.h>],
132 [ijg_size_t_ok="size_t is in sys/types.h"],
133 [ijg_size_t_ok=no])],
134 [ijg_size_t_ok=no])
135 AC_MSG_RESULT([$ijg_size_t_ok])
136 if test "$ijg_size_t_ok" = no; then
137 AC_MSG_WARN([Type size_t is not defined in any of the usual places.
138 Try putting '"typedef unsigned int size_t;"' in jconfig.h.])
139 fi
140 fi
141
142 # Check compiler characteristics
143 AC_MSG_CHECKING([for type unsigned char])
144 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ unsigned char un_char; ]])],
145 [AC_MSG_RESULT(yes)
146 AC_DEFINE([HAVE_UNSIGNED_CHAR], [1],
147 [Compiler supports 'unsigned char'.])],
148 [AC_MSG_RESULT(no)])
149
150 AC_MSG_CHECKING([for type unsigned short])
151 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ unsigned short un_short; ]])],
152 [AC_MSG_RESULT(yes)
153 AC_DEFINE([HAVE_UNSIGNED_SHORT], [1],
154 [Compiler supports 'unsigned short'.])],
155 [AC_MSG_RESULT(no)])
156
157 AC_MSG_CHECKING([for type void])
158 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
159 /* Caution: a C++ compiler will insist on valid prototypes */
160 typedef void * void_ptr; /* check void * */
161 #ifdef HAVE_PROTOTYPES /* check ptr to function returning void */
162 typedef void (*void_func) (int a, int b);
163 #else
164 typedef void (*void_func) ();
165 #endif
166
167 #ifdef HAVE_PROTOTYPES /* check void function result */
168 void test3function (void_ptr arg1, void_func arg2)
169 #else
170 void test3function (arg1, arg2)
171 void_ptr arg1;
172 void_func arg2;
173 #endif
174 {
175 char * locptr = (char *) arg1; /* check casting to and from void * */
176 arg1 = (void *) locptr;
177 (*arg2) (1, 2); /* check call of fcn returning void */
178 }
179 ]], [[ ]])],
180 [AC_MSG_RESULT(yes)],
181 [AC_MSG_RESULT(no)
182 AC_DEFINE([void], [char],
183 [Define 'void' as 'char' for archaic compilers
184 that don't understand it.])])
185 AC_C_CONST
186
187 # Check for non-broken inline under various spellings
188 AC_MSG_CHECKING([for inline])
189 ijg_cv_inline=""
190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[} __inline__ int foo() { return 0; }
191 int bar() { return foo();]])], ijg_cv_inline="__inline__",
192 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[} __inline int foo() { return 0; }
193 int bar() { return foo();]])], ijg_cv_inline="__inline",
194 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[} inline int foo() { return 0; }
195 int bar() { return foo();]])], ijg_cv_inline="inline")])])
196 AC_MSG_RESULT($ijg_cv_inline)
197 AC_DEFINE_UNQUOTED([INLINE], [$ijg_cv_inline],
198 [How to obtain function inlining.])
199
200 # We cannot check for bogus warnings, but at least we can check for errors
201 AC_MSG_CHECKING([for broken incomplete types])
202 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
203 typedef struct undefined_structure * undef_struct_ptr;
204 ]], [[]])],
205 [AC_MSG_RESULT(ok)],
206 [AC_MSG_RESULT(broken)
207 AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1],
208 [Compiler does not support pointers to unspecified
209 structures.])])
210
211 # Test whether global names are unique to at least 15 chars
212 AC_MSG_CHECKING([for short external names])
213 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
214 int possibly_duplicate_function () { return 0; }
215 int possibly_dupli_function () { return 1; }
216 ]], [[]])],
217 [AC_MSG_RESULT(ok)],
218 [AC_MSG_RESULT(short)
219 AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], [1],
220 [Linker requires that global names be unique in
221 first 15 characters.])])
222
223 # Run-time checks
224 AC_MSG_CHECKING([to see if char is signed])
225 AC_RUN_IFELSE([AC_LANG_SOURCE([[
226 #ifdef HAVE_STDLIB_H
227 #include <stdlib.h>
228 #endif
229 #include <stdio.h>
230 #ifdef HAVE_PROTOTYPES
231 int is_char_signed (int arg)
232 #else
233 int is_char_signed (arg)
234 int arg;
235 #endif
236 {
237 if (arg == 189) { /* expected result for unsigned char */
238 return 0; /* type char is unsigned */
239 }
240 else if (arg != -67) { /* expected result for signed char */
241 printf("Hmm, it seems 'char' is not eight bits wide on your machine.\n");
242 printf("I fear the JPEG software will not work at all.\n\n");
243 }
244 return 1; /* assume char is signed otherwise */
245 }
246 char signed_char_check = (char) (-67);
247 int main() {
248 exit(is_char_signed((int) signed_char_check));
249 }]])], [AC_MSG_RESULT(no)
250 AC_DEFINE([CHAR_IS_UNSIGNED], [1],
251 [Characters are unsigned])],
252 [AC_MSG_RESULT(yes)],
253 [AC_MSG_WARN([Assuming that char is signed on target machine.
254 If it is unsigned, this will be a little bit inefficient.])
255 ])
256
257 AC_MSG_CHECKING([to see if right shift is signed])
258 AC_RUN_IFELSE([AC_LANG_SOURCE([[
259 #ifdef HAVE_STDLIB_H
260 #include <stdlib.h>
261 #endif
262 #include <stdio.h>
263 #ifdef HAVE_PROTOTYPES
264 int is_shifting_signed (long arg)
265 #else
266 int is_shifting_signed (arg)
267 long arg;
268 #endif
269 /* See whether right-shift on a long is signed or not. */
270 {
271 long res = arg >> 4;
272
273 if (res == -0x7F7E80CL) { /* expected result for signed shift */
274 return 1; /* right shift is signed */
275 }
276 /* see if unsigned-shift hack will fix it. */
277 /* we can't just test exact value since it depends on width of long... */
278 res |= (~0L) << (32-4);
279 if (res == -0x7F7E80CL) { /* expected result now? */
280 return 0; /* right shift is unsigned */
281 }
282 printf("Right shift isn't acting as I expect it to.\n");
283 printf("I fear the JPEG software will not work at all.\n\n");
284 return 0; /* try it with unsigned anyway */
285 }
286 int main() {
287 exit(is_shifting_signed(-0x7F7E80B1L));
288 }]])],
289 [AC_MSG_RESULT(no)
290 AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], [1],
291 [Broken compiler shifts signed values as an unsigned shift.])],
292 [AC_MSG_RESULT(yes)],
293 [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
294
295 AC_MSG_CHECKING([to see if fopen accepts b spec])
296 AC_RUN_IFELSE([AC_LANG_SOURCE([[
297 #ifdef HAVE_STDLIB_H
298 #include <stdlib.h>
299 #endif
300 #include <stdio.h>
301 int main() {
302 if (fopen("conftestdata", "wb") != NULL)
303 exit(0);
304 exit(1);
305 }]])],
306 [AC_MSG_RESULT(yes)],
307 [AC_MSG_RESULT(no)
308 AC_DEFINE([DONT_USE_B_MODE], [1],
309 [Don't open files in binary mode.])],
310 [AC_MSG_RESULT(Assuming that it does.)])
311
312 # Configure libtool
313 LT_INIT([win32-dll])
314
315 # Select memory manager depending on user input.
316 # If no "-enable-maxmem", use jmemnobs
317 MEMORYMGR='jmemnobs'
318 MAXMEM="no"
319 AC_ARG_ENABLE([maxmem],
320 [ --enable-maxmem[=N] enable use of temp files, set max mem usage to N MB],
321 [MAXMEM="$enableval"])
322 dnl [# support --with-maxmem for backwards compatibility with IJG V5.]
323 dnl AC_ARG_WITH(maxmem, , MAXMEM="$withval")
324 if test "x$MAXMEM" = xyes; then
325 MAXMEM=1
326 fi
327 if test "x$MAXMEM" != xno; then
328 if test -n "`echo $MAXMEM | sed 's/[[0-9]]//g'`"; then
329 AC_MSG_ERROR(non-numeric argument to --enable-maxmem)
330 fi
331 DEFAULTMAXMEM=`expr $MAXMEM \* 1048576`
332 AC_DEFINE_UNQUOTED([DEFAULT_MAX_MEM], [${DEFAULTMAXMEM}],
333 [Maximum data space library will allocate.])
334 AC_MSG_CHECKING([for 'tmpfile()'])
335 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ FILE * tfile = tmpfile(); ]])],
336 [AC_MSG_RESULT(yes)
337 MEMORYMGR='jmemansi'],
338 [AC_MSG_RESULT(no)
339 dnl if tmpfile is not present, must use jmemname.
340 MEMORYMGR='jmemname'
341
342 # Test for the need to remove temporary files using a signal handler
343 # (for cjpeg/djpeg)
344 AC_DEFINE([NEED_SIGNAL_CATCHER], [1],
345 [Need signal handler to clean up temporary files.])
346 AC_MSG_CHECKING([for 'mktemp()'])
347 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char fname[80]; mktemp(fname); ]])],
348 [AC_MSG_RESULT(yes)],
349 [AC_MSG_RESULT(no)
350 AC_DEFINE([NO_MKTEMP], [1],
351 [The mktemp() function is not available.])])])
352 fi
353 AC_SUBST([MEMORYMGR])
354
355 # Extract the library version IDs from jpeglib.h.
356 AC_MSG_CHECKING([libjpeg version number])
357 [major=`sed -ne 's/^#define JPEG_LIB_VERSION_MAJOR *\([0-9][0-9]*\).*$/\1/p' $srcdir/jpeglib.h`
358 minor=`sed -ne 's/^#define JPEG_LIB_VERSION_MINOR *\([0-9][0-9]*\).*$/\1/p' $srcdir/jpeglib.h`]
359 AC_SUBST([JPEG_LIB_VERSION], [`expr $major + $minor`:0:$minor])
360 AC_SUBST([JPEG_LIB_VERSION_MAJOR], [$major])
361 AC_SUBST([JPEG_LIB_VERSION_MINOR], [$minor])
362 AC_MSG_RESULT([$major.$minor.0])
363
364 AC_CONFIG_FILES([Makefile libjpeg.pc])
365 AC_OUTPUT