-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
197 lines (149 loc) · 4.36 KB
/
configure.ac
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
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([hebocr], [0.12.0-dev], [Diego Iastrubni <[email protected]>])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([1.9 foreign])
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 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 create a build string
BUILD_DATE=`date +%d%m%Y`
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
hebocr.pc
Doxyfile
src/Makefile
examples/Makefile
examples/hocr/Makefile
examples/bindings/Makefile
bindings/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 hspell: ${build_hspell}
echo with libtiff: ${build_tiff}
echo with fftw: ${build_fftw}
echo