File: configure.in

package info (click to toggle)
libharu 2.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, trixie
  • size: 5,132 kB
  • sloc: ansic: 134,076; python: 5,086; cs: 2,546; pascal: 1,627; ruby: 809; makefile: 215; cpp: 95; sh: 73; sed: 4
file content (330 lines) | stat: -rw-r--r-- 9,521 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
dnl this file has to be processed by autoconf
dnl run ./buildconf.sh to get a working ./configure script

dnl {{{ AX_PREFIX_CONFIG_H
AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl
AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl
AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl
AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
m4_pushdef([_script],[conftest.prefix])dnl
m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
_OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)`
_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
_PKG=`echo ifelse($2, , $PACKAGE, $2)`
_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:"  -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
_INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'`
if test ".$_INP" = "."; then
   for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
     case "$ac_file" in
        *.h) _INP=$ac_file ;;
        *)
     esac
     test ".$_INP" != "." && break
   done
fi
if test ".$_INP" = "."; then
   case "$_OUT" in
      */*) _INP=`basename "$_OUT"`
      ;;
      *-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
      ;;
      *) _INP=config.h
      ;;
   esac
fi
if test -z "$_PKG" ; then
   AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
else
  if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
     _INP="$srcdir/$_INP"
  fi fi
  AC_MSG_NOTICE(creating: $_OUT: prefix $_UPP for $_INP defines)
  if test -f $_INP ; then
    echo "s/^@%:@undef  *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script
    echo "s/^@%:@undef  *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script
    echo "s/^@%:@def[]ine  *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script
    echo "@%:@def[]ine $_UPP""_\\1 \\2 \\" >> _script
    echo "@%:@endif/" >>_script
    echo "s/^@%:@def[]ine  *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script
    echo "@%:@define $_LOW""_\\1 \\2 \\" >> _script
    echo "@%:@endif/" >> _script
    # now executing _script on _DEF input to create _OUT output file
    echo "@%:@ifndef $_DEF"      >$tmp/pconfig.h
    echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h
    echo ' ' >>$tmp/pconfig.h
    echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h

    sed -f _script $_INP >>$tmp/pconfig.h
    echo ' ' >>$tmp/pconfig.h
    echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h
    echo "@%:@endif" >>$tmp/pconfig.h
    if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
      rm -f $tmp/pconfig.h
      AC_MSG_NOTICE([unchanged $_OUT])
    else
      ac_dir=`AS_DIRNAME(["$_OUT"])`
      AS_MKDIR_P(["$ac_dir"])
      rm -f "$_OUT"
      mv $tmp/pconfig.h "$_OUT"
    fi
    cp _script _configs.sed
  else
    AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
  fi
  rm -f conftest.*
fi
m4_popdef([_symbol])dnl
m4_popdef([_script])dnl
AS_VAR_POPDEF([_INP])dnl
AS_VAR_POPDEF([_UPP])dnl
AS_VAR_POPDEF([_LOW])dnl
AS_VAR_POPDEF([_PKG])dnl
AS_VAR_POPDEF([_DEF])dnl
AS_VAR_POPDEF([_OUT])dnl
],[PACKAGE="$PACKAGE"])])
dnl }}}

AC_PREREQ(2.60)

AC_INIT([libhpdf],[2.3.0])
AC_CONFIG_SRCDIR([README])
AC_CONFIG_SRCDIR(include/hpdf.h)
AC_CONFIG_HEADER(include/config.h)
AX_PREFIX_CONFIG_H(include/hpdf_config.h)
AM_INIT_AUTOMAKE([no-define])
AM_MAINTAINER_MODE

dnl Check for programs
AC_PROG_CC
AC_PROG_LD
AM_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_EGREP

dnl Check for size_t
AC_TYPE_SIZE_T

dnl Check for header files
AC_CHECK_HEADERS(string.h strings.h unistd.h stdint.h)

AC_CHECK_LIB([m], [floor], [LIBS="$LIBS -lm"], [AC_MSG_ERROR([can't continue without libm])])

DEFAULT_INSTALL_PREFIX="/usr/local"
STANDARD_PREFIXES="/usr /usr/local /opt /local"

HPDF_MAJOR_VERSION=2
HPDF_MINOR_VERSION=3
HPDF_BUGFIX_VERSION=0
HPDF_EXTRA_VERSION=""

HPDF_VERSION_TEXT="${HPDF_MAJOR_VERSION}.${HPDF_MINOR_VERSION}.${HPDF_BUGFIX_VERSION}${HPDF_EXTRA_VERSION}"
HPDF_VERSION_ID=`expr [$]HPDF_MAJOR_VERSION \* 10000 + [$]HPDF_MINOR_VERSION \* 100 + [$]HPDF_BUGFIX_VERSION`

dnl generate hpdf_version.h {{{
echo "/* automatically generated by configure */" > hpdf_version.h.new
echo "/* edit configure.in to change version number */" >> hpdf_version.h.new
echo "#define HPDF_MAJOR_VERSION $HPDF_MAJOR_VERSION" >> hpdf_version.h.new
echo "#define HPDF_MINOR_VERSION $HPDF_MINOR_VERSION" >> hpdf_version.h.new
echo "#define HPDF_BUGFIX_VERSION $HPDF_BUGFIX_VERSION" >> hpdf_version.h.new
echo "#define HPDF_EXTRA_VERSION \"$HPDF_EXTRA_VERSION\"" >> hpdf_version.h.new
echo "#define HPDF_VERSION_TEXT \"$HPDF_VERSION_TEXT\"" >> hpdf_version.h.new
echo "#define HPDF_VERSION_ID $HPDF_VERSION_ID" >> hpdf_version.h.new
cmp hpdf_version.h.new $srcdir/include/hpdf_version.h >/dev/null 2>&1
if test $? -ne 0 ; then
  rm -f $srcdir/include/hpdf_version.h && mv hpdf_version.h.new $srcdir/include/hpdf_version.h && \
  echo 'Updated include/hpdf_version.h'
else
  rm -f hpdf_version.h.new
fi
dnl }}}

dnl {{{ --enable-debug
AC_ARG_ENABLE(debug,
  [AS_HELP_STRING([--enable-debug],[enable debugging symbols and compile flags])
  ],
  [
    if test x"$enableval" = xyes ; then
      debug="yes"
    else
      debug="no"
    fi
  ]
)

if test x"$debug" = xyes ; then
  AC_DEFINE([DEBUG], [], [debug build])

  if test x"$GCC" = xyes; then

    dnl Remove any optimization flags from CFLAGS
    changequote({,})
    CFLAGS=`echo "$CFLAGS" | /usr/bin/sed -e 's/-O[0-9s]*//g'`
    CFLAGS=`echo "$CFLAGS" | /usr/bin/sed -e 's/-g[0-2]\? //g'`
    changequote([,])
    CFLAGS="$CFLAGS -g3 -Wall -O0"

  fi

  dnl Do not strip symbols from developer object files.
  INSTALL_STRIP_FLAG=""
else
  dnl Make sure to strip symbols from non-developer object files.
  INSTALL_STRIP_FLAG="-s"
fi
dnl }}}

dnl {{{ --enable-debug-trace
AC_ARG_ENABLE(debug-trace,
  [AS_HELP_STRING([--enable-debug-trace],[enable debug trace (only available along with --enable-debug)])
  ],
  [
    if test x"$enableval" = xyes && test x"$debug" = xyes; then
      debug_trace="yes"
    else
      debug_trace="no"
    fi
  ]
)

if test x"$debug_trace" = xyes ; then
  AC_DEFINE([DEBUG_TRACE], [], [debug trace enabled])
fi
dnl }}}

dnl {{{ --with-libdir
AC_ARG_WITH(libdir,
  [AS_HELP_STRING([--with-libdir],[look for libraries in .../NAME rather than .../lib])
  ],
  [LIBDIR=$with_libdir],
  [LIBDIR=lib]
)
dnl }}}

dnl {{{ --with-zlib
AC_ARG_WITH(zlib,
  [AS_HELP_STRING([--with-zlib],[specify Zlib install prefix])
  ],
  [ ],
  [with_zlib=yes]
)

if test "x$with_zlib" = "xno"; then
  AC_DEFINE([HAVE_NOZLIB], [], [zlib is not available])
else
  AC_MSG_CHECKING([Zlib install prefix])

  if test "x$with_zlib" = "xyes"; then
    for i in `echo "$STANDARD_PREFIXES"`; do
      if test -f "$i/include/zlib.h"; then
        ZLIB_DIR="$i"
        break;
      fi
    done
  else
    if test -f "$with_zlib/include/zlib.h"; then
      ZLIB_DIR="$with_zlib"
      break;
    else
      AC_MSG_ERROR([Can't find Zlib headers under $with_zlib directory]);
    fi
  fi

  if test "x$ZLIB_DIR" = "x"; then
    AC_MSG_ERROR([Unable to locate Zlib headers, please use --with-zlib=<DIR>]);
  fi

  AC_MSG_RESULT([$ZLIB_DIR])
  LDFLAGS="$LDFLAGS -L$ZLIB_DIR/$LIBDIR"
  CFLAGS="$CFLAGS -I$ZLIB_DIR/include"
  LIBS="$LIBS -lz"

  AC_CHECK_LIB([z], [deflate], [], [
    AC_MSG_ERROR([deflate() is missing, check config.log for more details])
  ])

  HAVE_ZLIB=yes
fi
dnl }}}

dnl {{{ --with-png
AC_ARG_WITH(png,
  [AS_HELP_STRING([--with-png],[specify libpng install prefix])
  ],
  [ ],
  [with_png=yes]
)

if test "x$with_png" = "xno"; then
  AC_DEFINE([HAVE_NOPNGLIB], [], [libpng is not available])
else

  if test "x$HAVE_ZLIB" != "xyes"; then
    AC_MSG_ERROR([PNG support requires Zlib, but it's not enabled. Either enable Zlib or disable PNG support.]);
  fi

  AC_MSG_CHECKING([libpng install prefix])

  if test "x$with_png" = "xyes"; then
    for i in `echo "$STANDARD_PREFIXES"`; do
      if test -f "$i/include/png.h"; then
        LIBPNG_DIR="$i"
        break;
      fi
    done
  else
    if test -f "$with_png/include/png.h"; then
      LIBPNG_DIR="$with_png"
      break;
    else
      AC_MSG_ERROR([Can't find libpng headers under $with_png directory]);
    fi
  fi

  if test "x$LIBPNG_DIR" = "x"; then
    AC_MSG_ERROR([Unable to locate libpng headers, please use --with-png=<DIR>]);
  fi

  AC_MSG_RESULT([$LIBPNG_DIR])
  LDFLAGS="$LDFLAGS -L$LIBPNG_DIR/$LIBDIR"
  CFLAGS="$CFLAGS -I$LIBPNG_DIR/include"
  LIBS="$LIBS -lpng"

  AC_CHECK_LIB([png], [png_init_io], [], [
    AC_MSG_ERROR([png_init_io() is missing, check config.log for more details])
  ])
fi
dnl }}}

case "$host_alias" in
  *cygwin*[)]
    CFLAGS="$CFLAGS -mno-cygwin -DHPDF_DLL_MAKE_CDECL"
    ;;
esac

if test "$GCC" = yes ; then
  AC_MSG_CHECKING([whether GCC supports -fexceptions])
  echo 'void somefunc() { };' > conftest.c
  cmd='$CC -fexceptions -c conftest.c'
  if eval $cmd 2>&1 | $EGREP -e $1 >/dev/null ; then
    AC_MSG_RESULT([no])
  else
    AC_MSG_RESULT([yes])
    CFLAGS="$CFLAGS -fexceptions"
  fi
  rm -f conftest.*
fi

dnl link against libm
LIBS="$LIBS -lm"
AC_SUBST(INSTALL_STRIP_FLAG)

AC_CONFIG_FILES([Makefile src/Makefile include/Makefile])
AC_OUTPUT

# vim600: expandtab sw=2 ts=2 sts=2 fdm=marker