comparison mupdf-source/thirdparty/jbig2dec/configure.ac.in @ 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 # Process this file with autoconf to produce a configure script.
2
3 AC_INIT([jbig2dec], [unknown-version], [gs-devel@ghostscript.com])
4 AC_PREREQ(2.53)
5 AC_CONFIG_SRCDIR([jbig2dec.c])
6
7 AM_SILENT_RULES([yes])
8 AM_INIT_AUTOMAKE([-Wall])
9 AM_CONFIG_HEADER(config.h)
10
11 dnl Library versioning - Adapted from the libtool info page
12 dnl
13 dnl 1. If source has changed at all: increment revision
14 dnl 2. If the ABI changed: increment current, reset revision to 0
15 dnl 3. If interfaces have been added since last public release: increment age
16 dnl 4. If interfaces have been removed: reset age to 0
17
18 AC_SUBST([JBIG2DEC_LT_CURRENT], [0])
19 AC_SUBST([JBIG2DEC_LT_REVISION], [0])
20 AC_SUBST([JBIG2DEC_LT_AGE], [0])
21
22 # Checks for programs.
23 AC_PROG_CC
24 AM_PROG_CC_C_O
25 AM_PROG_AR
26 AC_LIBTOOL_WIN32_DLL
27 AC_PROG_LIBTOOL
28
29 # platform specific compiler flags
30 if test "x$GCC" = xyes; then
31 CFLAGS="$CFLAGS -Wall -Wsign-compare"
32 fi
33
34 # Checks for libraries.
35 dnl by default we want png support if possible
36 AC_ARG_WITH([libpng],
37 AC_HELP_STRING([--with-libpng[=prefix]],
38 [include support for png output (if libpng is available)]),
39 [ac_cv_want_libpng="$withval"], [ac_cv_want_libpng="yes"])
40 save_cflags="$CFLAGS"
41 save_ldflags="$LDFLAGS"
42 have_libpng="no"
43 if test "x$ac_cv_want_libpng" != "xno"; then
44 if test "x$ac_cv_want_libpng" != "xyes"; then
45 dnl if it's not yes or no, treat as a prefix
46 CFLAGS="$CFLAGS -I$ac_cv_want_libpng/include"
47 LDFLAGS="$LDFLAGS -L$ac_cv_want_libpng/lib"
48 fi
49 dnl libpng requires pow() which may be in libm
50 AC_SEARCH_LIBS([pow], [m])
51 AC_CHECK_LIB([png], [png_create_write_struct], [
52 AC_CHECK_LIB([z], [deflate], [
53 AC_DEFINE(HAVE_LIBPNG, 1, [Define if libpng is available (-lpng)])
54 PNG_LIBS="-lpng -lz"
55 AC_LIBOBJ([jbig2_image_png])
56 have_libpng="yes"
57 ])
58 ])
59 fi
60 dnl restore (possibly changed) flags if we didn't find working libpng
61 if test "x$have_libpng" != "xyes"; then
62 CFLAGS="$save_cflags"
63 LDFLAGS="$save_ldflags"
64 fi
65 AC_SUBST(PNG_LIBS)
66
67 # Checks for header files.
68 AC_HEADER_STDC
69 AC_CHECK_HEADERS([libintl.h stddef.h unistd.h strings.h])
70
71 dnl We assume the fixed-size types from stdint.h. If that header is
72 dnl not available, look for the same types in a few other headers.
73 dnl We also attempt to define them ourselves, but only use those if
74 dnl the native versions aren't available. The substitutions happen
75 dnl in a file config_types.h, whose template is created by autogen.sh
76
77 stdint_types_in="no_replacement_found"
78 stdint_types_discovered="yes"
79 AC_CHECK_SIZEOF(char)
80 AC_CHECK_SIZEOF(short)
81 AC_CHECK_SIZEOF(int)
82 AC_CHECK_SIZEOF(long)
83 case 1 in
84 $ac_cv_sizeof_char) int8_type="char";;
85 *) stdint_types_discovered="no"
86 esac
87 case 2 in
88 $ac_cv_sizeof_short) int16_type="short";;
89 $ac_cv_sizeof_char) int16_type="char";;
90 $ac_cv_sizeof_int) int16_type="char";;
91 *) stdint_types_discovered="no";;
92 esac
93 case 4 in
94 $ac_cv_sizeof_int) int32_type="int";;
95 $ac_cv_sizeof_long) int32_type="long";;
96 $ac_cv_sizeof_short) int32_type="short";;
97 *) stdint_types_discovered="no";;
98 esac
99 AC_CHECK_HEADER([stdint.h])
100 if test "x$ac_cv_header_stdint_h" != "xyes"; then
101 for include in sys/types.h inttypes.h sys/inttypes.h sys/int_types.h ; do
102 AC_MSG_CHECKING([for uint32_t in $include])
103 AC_TRY_COMPILE([#include <$include>], [uint32_t canary;], [
104 AC_MSG_RESULT([yes])
105 stdint_types_in="$include"
106 break;
107 ], AC_MSG_RESULT([no])
108 )
109 done
110 if test "x$stdint_types_in" != "xno_replacement_found"; then
111 AC_MSG_RESULT([Adding $stdint_types_in to config header for stdint types])
112 AC_DEFINE([JBIG2_REPLACE_STDINT_H],,
113 [set by configure if an alternate header with the stdint.h types is found])
114 elif test "x$stdint_types_discovered" = "xno"; then
115 AC_MSG_ERROR([
116 Unable to find suitable definitions of the stdint.h types (uint32_t and friends)
117 You will have to define these yourself in a separate header.
118 See config_win32.h for an example.
119 ])
120 fi
121 fi
122 AC_SUBST(JBIG2_INT32_T, [$int32_type])
123 AC_SUBST(JBIG2_INT16_T, [$int16_type])
124 AC_SUBST(JBIG2_INT8_T, [$int8_type])
125 AC_SUBST(JBIG2_STDINT_H, [$stdint_types_in])
126
127 # Checks for typedefs, structures, and compiler characteristics.
128 AC_C_CONST
129 AC_TYPE_SIZE_T
130 AC_C_BIGENDIAN
131
132 # Checks for library functions.
133 AC_FUNC_MEMCMP
134 dnl we use realloc() but don't depend on the zero-length behavior
135 dnl tested by AC_FUNC_REALLOC
136
137 AC_CHECK_FUNCS([memset strdup])
138
139 dnl use our included getopt if the system doesn't have getopt_long()
140 AC_CHECK_FUNC(getopt_long,
141 AC_DEFINE(HAVE_GETOPT_LONG,,
142 [Define if the local libc includes getopt_long()]
143 ),[
144 AC_LIBOBJ([getopt])
145 AC_LIBOBJ([getopt1])
146 ])
147
148 # generate output
149 AC_CONFIG_FILES([Makefile config_types.h jbig2dec.pc])
150 AC_OUTPUT