1# see /usr/share/info/standards.info,autoconf.info (autoconf 2.57)
2dnl Process this file with autoconf to produce a configure script.
3dnl obsolete: AC_INIT(src/pgm2asc.c)
4AC_INIT(gocr,0.52,,)
5AC_PREREQ(2.50)
6AC_CONFIG_HEADERS([include/config.h])
7dnl AC_EXEEXT is obsolete now
8
9dnl Checks for programs.
10AC_PROG_CC
11AC_PROG_INSTALL
12AC_PROG_MAKE_SET
13dnl only needed for libPgm2asc.a, not for the rpm/ebuild
14dnl AC_PROG_RANLIB
15dnl AC_CHECK_PROG(AR,ar,ar)
16dnl needed for developpers to make examples, not for the rpm/ebuild
17dnl AC_CHECK_PROG(FIG2DEV,fig2dev,fig2dev)
18
19dnl Check for optional debug mode
20dnl debug makes program slow, but is very useful for developper
21dnl ToDo: how to check that c-flags are available?
22AC_ARG_WITH(debug,
23 [  --with-debug            switching on debugging (more verbose output)],
24 [ CPPFLAGS="-Wall -g -fexceptions -DDO_DEBUG=1 $CPPFLAGS" ])
25if test "$with_debug"; then echo "debugging enabled"; fi
26
27dnl Check for optional netpbm PACKAGE: --with-netpbm=no == --without-netpbm
28dnl LDFLAGS+=-R$withval/lib compiles the search path into the file ???
29AC_ARG_WITH(netpbm,
30 [  --with-netpbm=PATH      enter the PATH to netpbm package],
31 [ if test "$withval" != "no"; then
32    LDFLAGS="-L$withval/lib $LDFLAGS";\
33    CPPFLAGS="-I$withval/include $CPPFLAGS";\
34   fi ])
35if test -n "$with_netpbm"; then echo "option: with_netpbm $with_netpbm"; fi
36
37dnl Checks for libraries.
38if test "$with_netpbm" != "no"; then
39# netpbm-10.26 + SuSE-10.0: netpbm needs mathlib -lm
40# netpbm-10    : libnetpbm + pam.h (+ p[bgpn]m.h, libp[bgpn]m.so as links)
41# netpbm-9     : libpnm    + pnm.h (+ p[bgp]m.h)
42# pnm_readpaminit (netpbm-10)
43# pnm_readpnminit (netpbm-9,10)
44# ToDo: how to check that -lm is needed?
45LDFLAGS="-lm $LDFLAGS"
46AC_SEARCH_LIBS(pnm_readpnminit,[netpbm pnm],[check_netpbm_h="pam.h pnm.h"],
47 [ echo " * * * try option --with-netpbm=PATH"])
48fi
49
50dnl Checks for header files.
51AC_HEADER_STDC
52AC_CHECK_HEADERS([unistd.h wchar.h ${check_netpbm_h}])
53
54dnl Checks for typedefs, structures, and compiler characteristics.
55AC_C_CONST
56dnl AC_CHECK_TYPE(wchar_t,unsigned)
57
58dnl Checks for library functions.
59dnl this macro produces a warning: AC_TRY_RUN called without default ...
60dnl The message can be ignored as long as you don't configure gOCR for
61dnl cross-compiling.
62AC_FUNC_SETVBUF_REVERSED
63AC_CHECK_FUNCS(wcschr wcsdup gettimeofday popen)
64
65dnl Checks for system services
66
67dnl obsolete: AC_OUTPUT(Makefile src/Makefile doc/Makefile man/Makefile)
68dnl the light weight version of package comes without src/api
69AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile man/Makefile])
70dnl AC_CONFIG_COMMANDS([default],,)
71AC_OUTPUT
72