File: configure.ac

package info (click to toggle)
hocr 0.10.18-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 3,296 kB
  • sloc: ansic: 18,153; sh: 11,473; python: 1,422; makefile: 190; cpp: 19
file content (337 lines) | stat: -rw-r--r-- 8,068 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
331
332
333
334
335
336
337
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)

AC_INIT([libhocr], [0.10.18])

AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([config])

AM_INIT_AUTOMAKE([subdir-objects])

AC_PROG_CC
AM_PROG_LIBTOOL

dnl check for pkg-config
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)

dnl ============================================================================
dnl check host system

host_code=1
case ${host} in
  *linux*)
    host_code=1
  ;;
  *mingw32*)
    host_code=2
  ;;
  *darwin*)
    host_code=3
  ;;
esac

AM_CONDITIONAL(LINUX_HOST, test $host_code = 1 )
AM_CONDITIONAL(MINGW_HOST, test $host_code = 2 )
AM_CONDITIONAL(DARWIN_HOST, test $host_code = 3 )

dnl ============================================================================
dnl check for swig
AC_CHECK_PROG(have_swig, "swig", yes, no)

dnl ============================================================================
dnl build tiff

build_tiff=yes

AC_ARG_ENABLE([tiff], 
  [AS_HELP_STRING([--disable-tiff],
  [do not use libtiff])],
  [build_tiff=no], [build_tiff=yes])

dnl check for libtiff

if test "$build_tiff" = "yes"; then
    AC_CHECK_LIB([tiff], [TIFFOpen], build_tiff=yes, build_tiff=no)

    if test "$build_tiff" = "yes"; then
        tiff_CFLAGS=" -DUSE_TIFF"
        tiff_LIBS=" -ltiff"
   
        AC_SUBST(tiff_CFLAGS)
        AC_SUBST(tiff_LIBS)
        
        ld_tiff="$tiff_LIBS"
        
        dnl export ld_tiff librarys to pkg-config pc file 
        AC_SUBST(ld_tiff)
    fi
fi

AM_CONDITIONAL(WITH_TIFF, test "$build_tiff" = yes)

dnl ============================================================================
dnl build fftw3

build_fftw=yes

AC_ARG_ENABLE([fftw], 
  [AS_HELP_STRING([--disable-fftw],
  [do not use fftw])],
  [build_fftw=no], [build_fftw=yes])

dnl check for fftw3

if test "$build_fftw" = "yes"; then
    fftw_pkg_modules="fftw3"
    PKG_CHECK_MODULES(fftw, [$fftw_pkg_modules], build_fftw=yes, build_fftw=no)
    
    if test "$build_fftw" = "yes"; then
        fftw_CFLAGS+=" -DUSE_FFTW"
        AC_SUBST(fftw_CFLAGS)
        AC_SUBST(fftw_LIBS)
    fi
fi

AM_CONDITIONAL(WITH_FFTW, test "$build_fftw" = yes)

dnl ============================================================================
dnl check for glib

build_lib=yes

AC_ARG_ENABLE([glib], 
  [AS_HELP_STRING([--disable-glib],
  [do not use glib])],
  [build_glib=no], [build_glib=yes])

dnl check for glib

if test "$build_glib" = "yes"; then
    glib_pkg_modules="glib-2.0"
    PKG_CHECK_MODULES(glib, [$glib_pkg_modules], build_glib=yes, build_glib=no)
    
    if test "$build_glib" = "yes"; then
        glib_CFLAGS+=" -DUSE_GLIB"
        AC_SUBST(glib_CFLAGS)
        AC_SUBST(glib_LIBS)
    fi
fi

AM_CONDITIONAL(WITH_GLIB, test "$build_glib" = yes)

dnl ============================================================================
dnl check for gtk

build_gtk=yes

AC_ARG_ENABLE([gtk], 
  [AS_HELP_STRING([--disable-gtk],
  [do not use gtk])],
  [build_gtk=no], [build_gtk=yes])

dnl check for gtk

if test "$build_gtk" = "yes"; then
    gtk_pkg_modules="gtk+-2.0"
    PKG_CHECK_MODULES(gtk, [$gtk_pkg_modules], build_gtk=yes, build_gtk=no)
    
    if test "$build_gtk" = "yes"; then
        gtk_CFLAGS+=" -DUSE_GTK"
        AC_SUBST(gtk_CFLAGS)
        AC_SUBST(gtk_LIBS)
    
        requires_gtk="$gtk_pkg_modules"
    
        dnl export required gtk librarys to pkg-config pc file 
        AC_SUBST(requires_gtk)
    fi
fi

AM_CONDITIONAL(WITH_GTK, test "$build_gtk" = yes)

dnl ============================================================================
dnl check for python

AM_PATH_PYTHON([2.5], [have_python=yes], [have_python=no])

build_python=$have_python

AC_ARG_ENABLE([python], 
  [AS_HELP_STRING([--disable-python],
  [do not build python binding])],
  [build_python=no], [build_python=$have_python])

AC_ARG_WITH(python-sitelib-dir, 
  [AS_HELP_STRING([--with-python-sitelib-dir=PATH],
  [path to python site lib])])

if test "$have_python" = "yes"; then
    PY_PREFIX=`$PYTHON -c 'import sys; print sys.prefix'`
    AC_MSG_CHECKING(for $PY_PREFIX/include/python${PYTHON_VERSION}/Python.h)
    if test -f $PY_PREFIX/include/python${PYTHON_VERSION}/Python.h; then
          AC_MSG_RESULT(yes)
          PY_CFLAGS="-I$PY_PREFIX/include/python${PYTHON_VERSION}"
          
          if test "$with_python_sitelib_dir" = "" ; then
            PY_MODULES_PATH=$pythondir
          else
            PY_MODULES_PATH=$with_python_sitelib_dir
          fi
          
          AC_SUBST([PY_CFLAGS])
          AC_SUBST([PY_MODULES_PATH])
          
      else
          AC_MSG_RESULT(no)
          build_python=no
      fi
fi

if test "$have_swig" = "no"; then
  build_python=no
fi

if test "$build_tiff" = "no"; then
  build_python=no
fi

if test "$build_fftw" = "no"; then
  build_python=no
fi

AM_CONDITIONAL(WITH_PYTHON, test "$build_python" = "yes")

dnl ============================================================================
dnl build hspell

build_hspell=yes

AC_ARG_ENABLE([hspell], 
  [AS_HELP_STRING([--disable-hspell],
  [do not use hspell])],
  [build_hspell=no], [build_hspell=yes])

dnl check for hspell

if test "$build_hspell" = "yes"; then
    AC_CHECK_LIB([hspell], [hspell_get_dictionary_path], build_hspell=yes, build_hspell=no, -lz)

    if test "$build_hspell" = "yes"; then
        hspell_CFLAGS=" -DUSE_HSPELL"
        hspell_LIBS=" -lhspell -lz"
       
        AC_SUBST(hspell_CFLAGS)
        AC_SUBST(hspell_LIBS)
        
        ld_hspell="$hspell_LIBS"
        
        dnl export ld_hspell librarys to pkg-config pc file 
        AC_SUBST(ld_hspell)
    fi
fi

AM_CONDITIONAL(WITH_HSPELL, test "$build_hspell" = yes)

dnl ============================================================================
dnl build hocr

build_hocr=yes

AC_ARG_ENABLE([hocr], 
  [AS_HELP_STRING([--disable-hocr],
  [do not build hocr utility program])],
  [build_hocr=no], [build_hocr=yes])

if test "$build_glib" = "no"; then
  build_hocr=no
fi

AM_CONDITIONAL(WITH_HOCR, test "$build_hocr" = "yes")

dnl ============================================================================
dnl build hocr-gtk

build_hocr_gtk=yes

AC_ARG_ENABLE([hocr-gtk], 
  [AS_HELP_STRING([--disable-hocr-gtk],
  [do not build hocr-gtk utility program])],
  [build_hocr_gtk=no], [build_hocr_gtk=yes])

if test "$build_python" = "no"; then
  build_hocr_gtk=no
fi

AM_CONDITIONAL(WITH_HOCR_GTK, test "$build_hocr_gtk" = "yes")

dnl ============================================================================
dnl create a build string

if test -n "$SOURCE_DATE_EPOCH"; then
	BUILD_DATE=`date --utc --date="@$SOURCE_DATE_EPOCH" +%d%m%Y`
else
	BUILD_DATE=`date +%d%m%Y`
fi
BUILD_STR="$PACKAGE-$VERSION-$build-$BUILD_DATE"
if test "$build_tiff" = "yes"; then
BUILD_STR+="-tiff"
fi
if test "$build_fftw" = "yes"; then
BUILD_STR+="-fftw3"
fi
if test "$build_hspell" = "yes"; then
BUILD_STR+="-hspell"
fi
if test "$build_gtk" = "yes"; then
BUILD_STR+="-gtk"
fi
AC_SUBST(BUILD_STR)
AC_SUBST(VERSION)

dnl ============================================================================
dnl output

AC_CONFIG_FILES([
Makefile
libhocr.pc
libhocr-gtk.pc
Doxyfile
src/Makefile
examples/Makefile
examples/hocr/Makefile
examples/hocr-gtk/Makefile
examples/bindings/Makefile
bindings/Makefile
bindings/python/Makefile
docs/Makefile
docs/man/Makefile
docs/man/man1/Makefile
docs/man/man3/Makefile
])

AC_OUTPUT

dnl print status

echo
echo $PACKAGE $VERSION - Hebrew Optical Character Recognition library
echo OS: ${host}
echo build: $BUILD_STR
echo prefix: $prefix
echo compiler: ${CC}
echo have swig:    ${have_swig}
echo pkg-config path: ${PKG_CONFIG}
echo
echo with glib: ${build_glib}
echo with gtk: ${build_gtk}
echo with hspell: ${build_hspell}
echo with libtiff: ${build_tiff}
echo with fftw: ${build_fftw}
echo
echo build python binding, requires swig, libtiff, fftw: ${build_python}
echo python site lib path: ${PY_MODULES_PATH}
echo
echo build hocr, requires glib, suggests gtk: ${build_hocr}
echo build hocr-gtk, requires python bindings: ${build_hocr_gtk}
echo