comparison mupdf-source/thirdparty/jbig2dec/autogen.sh @ 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 #!/bin/sh
2 # Run this to set up the build system: configure, makefiles, etc.
3
4 package="jbig2dec"
5 AUTOMAKE_FLAGS="$AUTOMAKE_FLAGS"
6
7 srcdir=`dirname $0`
8 test -z "$srcdir" && srcdir=.
9
10 cd "$srcdir"
11
12 echo "checking for autoconf... "
13 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
14 echo
15 echo "You must have autoconf installed to compile $package."
16 echo "Download the appropriate package for your distribution,"
17 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
18 exit 1
19 }
20
21 VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/"
22 VERSIONMKMAJ="sed -e s/\([0-9][0-9]*\)[^0-9].*/\\1/"
23 VERSIONMKMIN="sed -e s/.*[0-9][0-9]*\.//"
24
25 JBIG2VERSIONGREP="sed -e s/^.*(\([0-9][0-9]*\)).*/\\1/"
26 JBIG2MAJOR=$(grep 'define JBIG2_VERSION_MAJOR' jbig2.h | $JBIG2VERSIONGREP)
27 JBIG2MINOR=$(grep 'define JBIG2_VERSION_MINOR' jbig2.h | $JBIG2VERSIONGREP)
28 sed -e "s/^\(AC_INIT[^,]*,\)[^,]*\(,.*\)$/\1 [$JBIG2MAJOR.$JBIG2MINOR]\2/" configure.ac.in > configure.ac
29
30 # do we need automake?
31 if test "x$USE_OLD" = "xyes" ; then
32 if test -r Makefile.am; then
33 AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
34 AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
35 if test "x$AM_NEEDED" = "x$AM_OPTIONS"; then
36 AM_NEEDED=""
37 fi
38 if test -z "$AM_NEEDED"; then
39 echo -n "checking for automake... "
40 AUTOMAKE=automake
41 ACLOCAL=aclocal
42 if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
43 echo "yes"
44 else
45 echo "no"
46 AUTOMAKE=
47 fi
48 else
49 echo -n "checking for automake $AM_NEEDED or later... "
50 majneeded=`echo $AM_NEEDED | $VERSIONMKMAJ`
51 minneeded=`echo $AM_NEEDED | $VERSIONMKMIN`
52 for am in automake-$AM_NEEDED automake$AM_NEEDED automake \
53 automake-1.7 automake-1.8 automake-1.9 automake-1.10; do
54 ($am --version < /dev/null > /dev/null 2>&1) || continue
55 ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP`
56 maj=`echo $ver | $VERSIONMKMAJ`
57 min=`echo $ver | $VERSIONMKMIN`
58 if test $maj -eq $majneeded -a $min -ge $minneeded; then
59 AUTOMAKE=$am
60 echo $AUTOMAKE
61 break
62 fi
63 done
64 test -z $AUTOMAKE && echo "no"
65 echo -n "checking for aclocal $AM_NEEDED or later... "
66 for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal\
67 aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10; do
68 ($ac --version < /dev/null > /dev/null 2>&1) || continue
69 ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP`
70 maj=`echo $ver | $VERSIONMKMAJ`
71 min=`echo $ver | $VERSIONMKMIN`
72 if test $maj -eq $majneeded -a $min -ge $minneeded; then
73 ACLOCAL=$ac
74 echo $ACLOCAL
75 break
76 fi
77 done
78 test -z $ACLOCAL && echo "no"
79 fi
80 test -z $AUTOMAKE || test -z $ACLOCAL && {
81 echo
82 echo "You must have automake installed to compile $package."
83 echo "Download the appropriate package for your distribution,"
84 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
85 exit 1
86 }
87 fi
88 else
89 AUTOMAKE=automake
90 ACLOCAL=aclocal
91 AM_VER=`$AUTOMAKE --version | grep "automake (GNU automake)" | sed 's/[^0-9\.]*//g'`
92 AM_MAJ=`echo $AM_VER |cut -d. -f1`
93 AM_MIN=`echo $AM_VER |cut -d. -f2`
94 AM_PAT=`echo $AM_VER |cut -d. -f3`
95
96 AM_NEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $VERSIONGREP`
97 AM_MAJOR_REQ=`echo $AM_NEEDED |cut -d. -f1`
98 AM_MINOR_REQ=`echo $AM_NEEDED |cut -d. -f2`
99
100 echo "checking for automake $AM_NEEDED or later..."
101
102 if [ $AM_MAJ -lt $AM_MAJOR_REQ -o $AM_MIN -lt $AM_MINOR_REQ ] ; then
103 echo
104 echo "You must have automake $AM_NEEDED or better installed to compile $package."
105 echo "Download the appropriate package for your distribution,"
106 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
107 exit 1
108 fi
109 fi
110
111 # do we need libtool?
112 if ! test -z `grep -l -s -e PROG_LIBTOOL configure.ac configure.in`; then
113 echo -n "Checking for libtoolize... "
114 LIBTOOLIZE=
115 for lt in glibtoolize libtoolize; do
116 if ($lt --version < /dev/null > /dev/null 2>&1); then
117 LIBTOOLIZE=$lt
118 echo $lt
119 break;
120 fi
121 done
122 if test -z $LIBTOOLIZE; then
123 echo
124 echo "You must have GNU libtool installed to compile $package."
125 echo "Download the appropriate package for your distribution,"
126 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
127 exit 1
128 fi
129 fi
130
131 echo "Generating configuration files for $package, please wait...."
132
133 echo " $ACLOCAL $ACLOCAL_FLAGS"
134 $ACLOCAL $ACLOCAL_FLAGS
135
136 echo " $LIBTOOLIZE"
137 $LIBTOOLIZE --copy
138
139 echo " autoheader"
140 autoheader
141
142 echo " creating config_types.h.in"
143 cat >config_types.h.in <<EOF
144 /*
145 generated header with missing types for the
146 jbig2dec program and library. include this
147 after config.h, within the HAVE_CONFIG_H
148 ifdef
149 */
150
151 #ifdef HAVE_STDINT_H
152 # include <stdint.h>
153 #else
154 # ifdef JBIG2_REPLACE_STDINT_H
155 # include <@JBIG2_STDINT_H@>
156 # else
157 typedef unsigned @JBIG2_INT32_T@ uint32_t;
158 typedef unsigned @JBIG2_INT16_T@ uint16_t;
159 typedef unsigned @JBIG2_INT8_T@ uint8_t;
160 typedef signed @JBIG2_INT32_T@ int32_t;
161 typedef signed @JBIG2_INT16_T@ int16_t;
162 typedef signed @JBIG2_INT8_T@ int8_t;
163 # endif /* JBIG2_REPLACE_STDINT */
164 #endif /* HAVE_STDINT_H */
165 EOF
166
167 echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
168 $AUTOMAKE --add-missing --copy $AUTOMAKE_FLAGS
169
170 echo " autoconf"
171 autoconf
172
173 if test -z "$*"; then
174 echo "I am going to run ./configure with no arguments - if you wish "
175 echo "to pass any to it, please specify them on the $0 command line."
176 else
177 echo "running ./configure $@"
178 fi
179
180 $srcdir/configure "$@" && echo