2
# Process this file with autoconf to produce a configure script.
5
AC_INIT([jp2a], [1.0.6], [csl@sublevel3.org])
6
AM_INIT_AUTOMAKE(dist-bzip2)
7
AC_CONFIG_SRCDIR(src/jp2a.c)
8
AC_CONFIG_HEADER([config.h])
9
AC_REVISION([$Id: configure.ac 460 2006-09-25 11:08:24Z csl $])
10
AC_CONFIG_FILES([Makefile src/Makefile])
12
# Checks for programs.
15
# Checks for libraries.
16
AC_ARG_WITH([jpeg-include],
17
AC_HELP_STRING([--with-jpeg-include=PATH], [specify path to directory containing jpeglib.h -- http://www.ijg.org/]),
18
[CPPFLAGS="$CPPFLAGS -I$withval"])
20
AC_ARG_WITH([jpeg-lib],
21
AC_HELP_STRING([--with-jpeg-lib=PATH], [specify path to directory containing jpeglib lib file -- http://www.ijg.org/]),
22
[LDFLAGS="$LDFLAGS -L$withval"])
24
AC_ARG_WITH([jpeg-prefix],
25
AC_HELP_STRING([--with-jpeg-prefix=PATH], [this is the same as --with-jpeg-include=PATH/include and --with-jpeg-lib=PATH/lib]),
26
[CPPFLAGS="$CPPFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib"])
28
AC_ARG_WITH([curl-config],
29
AC_HELP_STRING([--with-curl-config=PATH], [specify path to curl-config]),
30
[curl_config_path="$withval" enable_curl="yes"],
31
[curl_config_path="$PATH"])
33
AC_CHECK_LIB([jpeg], [jpeg_start_decompress], [LIBS="$LIBS -ljpeg"])
35
if test "x$ac_cv_lib_jpeg_jpeg_start_decompress" != "xyes" ; then
36
AC_MSG_ERROR([I need a working jpeglib; please specify --with-jpeg-lib=PATH or see --help for more explicit options.
38
On many systems, this is installed in /usr/local/lib/ so you can try --with-jpeg-prefix=/usr/local/
43
AC_HELP_STRING([--enable-curl], [enable to be to use libcurl (http://curl.haxx.se) to download images from the net (default: yes)]),
44
[enable_curl=$enableval],
47
AC_ARG_ENABLE([termlib],
48
AC_HELP_STRING([--enable-termlib], [enable to use term/curses for detecting terminal dimensions (default: yes)]),
49
[enable_termlib=$enableval],
50
[enable_termlib="yes"])
52
AC_MSG_CHECKING([enable-curl])
53
AC_MSG_RESULT([$enable_curl])
55
if test "x$enable_curl" = "xyes" ; then
56
AC_PATH_PROGS([curl_config], [curl-config], [no], [$curl_config_path])
58
if test "x$curl_config" != "xno" ; then
59
curl_cflags="`$curl_config --cflags`"
60
curl_libs="`$curl_config --libs`"
61
CPPFLAGS="$CPPFLAGS $curl_cflags"
63
AC_MSG_CHECKING([curl-config --cflags])
64
AC_MSG_RESULT([$curl_cflags])
66
AC_MSG_CHECKING([curl-config --libs])
67
AC_MSG_RESULT([$curl_libs])
70
if test "x$curl_libs" = "x" ; then
74
AC_CHECK_LIB([curl], [curl_easy_init], [LIBS="$LIBS $curl_libs" AC_DEFINE([FEAT_CURL], [1], [Found working libcurl environment])], [
75
AC_MSG_WARN([I need a working libcurl (use --with-curl-config=PATH); download-support will be disabled])
80
# Checks for header files.
83
AC_CHECK_HEADER([jpeglib.h],
84
[ AC_DEFINE([HAVE_JPEGLIB_H], [1], [Define to 1 if you have <jpeglib.h> header file.]) ],
85
[ AC_MSG_ERROR([required header file jpeglib.h not found, use --with-jpeg-include=PATH or see --help]) ])
87
if test "x$enable_curl" = "xyes" ; then
88
AC_CHECK_HEADER([curl/curl.h],
89
[ AC_DEFINE([HAVE_CURL_CURL_H], [1], [Define to 1 if you have the <curl/curl.h> header file]) ],
90
[ AC_MSG_WARN([required header file curl/curl.h not found, libcurl will be disabled (see --help)]) ])
93
AC_CHECK_HEADERS([fcntl.h curses.h term.h ncurses/term.h])
95
if test "$enable_termlib" = "yes" ; then
97
# Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but
98
# rather ncurses. So we check for it.
100
# Check for termlib before termcap because Solaris termcap needs libucb.
101
TERMLIB_VARIANTS="ncurses curses termlib termcap terminfo"
102
for termlib in ${TERMLIB_VARIANTS}; do
103
AC_CHECK_LIB(${termlib}, tgetent,
104
[TERMLIBS="${TERMLIBS} -l${termlib}"; break])
106
# don't bother warning on djgpp, it doesn't have a term library, it
107
# ports each termcap-needing program separately according to its needs.
108
if test -z "$TERMLIBS" && echo "$build" | grep -v djgpp >/dev/null; then
109
AC_MSG_WARN([probably need a terminal library, one of: ${TERMLIB_VARIANTS}])
111
LIBS="$LIBS $TERMLIBS"
112
AC_DEFINE([FEAT_TERMLIB], [1], [Found working term/curses environment])
118
# Checks for typedefs, structures, and compiler characteristics.
122
# Checks for library functions.
123
AC_CHECK_FUNCS([memset])
124
AC_CHECK_FUNCS([atexit])