forked from clearscene/opendias
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
236 lines (186 loc) · 6.59 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
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(opendias, [0.9.5], [[email protected]])
AC_DEFINE([DB_VERSION],[7],[Setting DB version])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
AM_CONFIG_HEADER([config.h])
AM_MAINTAINER_MODE
AC_PROG_CXX
AM_PROG_CC_STDC
AC_HEADER_STDC
dnl
dnl Ensure weve got everything we need to even start!
dnl
PKG_CHECK_MODULES(OPENDIAS, [sqlite3 libmicrohttpd uuid libssl])
AC_SUBST(OPENDIAS_CFLAGS)
AC_SUBST(OPENDIAS_LIBS)
AC_SUBST(VAR_DIR)
AC_SUBST(TESSERACT_BASE_DIR)
AC_PATH_PROG(PKG_CONFIG,pkg-config,no)
dnl
dnl Special config options
dnl
AC_ENABLE([werror],[OPENDIAS_CFLAGS="$OPENDIAS_CFLAGS -Werror"])
AC_ENABLE([open_to_all],[
AC_DEFINE([OPEN_TO_ALL],[],[No login for users. The application is open to all.])
LOCALISATION_FLAGS="$LOCALISATION_FLAGS OPEN_TO_ALL"
])
AC_ENABLE([create_test_language],[
LOCALISATION_FLAGS="$LOCALISATION_FLAGS CREATE_TEST_LANGUAGE"
])
AC_ENABLE([thread_join],[
AC_DEFINE([THREAD_JOIN],[],[The main process will wait for child threads to finish.])
])
AC_ARG_ENABLE([force_var_at_root],
[AS_HELP_STRING([--enable-force_var_at_root],[Ignore --prefix for the placement of '/var' and put it at the systems root])],
[VAR_DIR="/var"],
[VAR_DIR="${localstatedir}"]
)
OPENDIAS_LIBS="$OPENDIAS_LIBS -lpthread "
dnl
dnl Find out what we've got to work with
dnl
imageprocessing="no"
AC_CHECK_LIB(lept, main,
[AC_CHECK_HEADER(leptonica/allheaders.h,
imageprocessing="yes",
AC_MSG_WARN(You are missing the development headers for the leptonica libs))],
AC_MSG_WARN(You are missing the leptonica libs) )
scanning="no"
AC_CHECK_LIB(sane, main,
[AC_CHECK_HEADER(sane/sane.h,
scanning="yes",
AC_MSG_WARN(You are missing the development headers for the sane libs))],
AC_MSG_WARN(You are missing the sane libs) )
ocr="no"
AC_LANG_PUSH([C++])
AC_SEARCH_LIBS([_ZN9tesseract11TessBaseAPI8SetImageEPK3Pix], [tesseract tesseract_api],
[AC_CHECK_HEADER(tesseract/baseapi.h,
ocr="yes"
AC_SEARCH_LIBS([_ZNK9tesseract11TessBaseAPI24GetInitLanguagesAsStringEv], [tesseract tesseract_api],
AC_DEFINE([EXTENDED_OCR],[],[Have everything that is needed to OCR documents])),
AC_MSG_WARN(You are missing the development headers for the tesseract v3 libs))],
AC_MSG_WARN(You are missing the tesseract v3 libs) )
AC_LANG_POP([C++])
pdf="no"
AC_LANG_PUSH([C++])
AC_CHECK_LIB(poppler-cpp, _ZN7poppler8document14load_from_fileERKSsS2_S2_,
[AC_CHECK_HEADER(poppler/cpp/poppler-document.h,
pdf="yes",
AC_MSG_WARN(You are missing the development headers for the poppler libs))],
AC_MSG_WARN(You are missing the poppler libs) )
AC_LANG_POP([C++])
zzip="no"
AC_CHECK_LIB(zzipwrap, main,
[AC_CHECK_HEADER(zzip/lib.h,
zzip="yes",
AC_MSG_WARN(You are missing the development headers for the zzip libs))],
AC_MSG_WARN(You are missing the zzip libs) )
xml="no"
AC_CHECK_LIB(xml2, xmlParseExternalEntity,
[AC_PATH_PROG(XML2_CONFIG,xml2-config,no)
if test "$XML2_CONFIG" != "no"; then
xml2_cflags=`$XML2_CONFIG --cflags`
CPPFLAGS="$CPPFLAGS $xml2_cflags"
fi
AC_CHECK_HEADER(libxml/parser.h,
xml="yes",
AC_MSG_WARN(You are missing the development headers for the xml libs))],
AC_MSG_WARN(You are missing the xml libs) )
magic="no"
AC_CHECK_LIB(magic, magic_open,
[AC_CHECK_HEADER(magic.h,
magic="yes",
AC_MSG_WARN(You are missing the development headers for the magic libs))],
AC_MSG_WARN(You are missing the magic libs) )
phash="no"
AC_LANG_PUSH([C++])
AC_CHECK_LIB(pHash, ph_hamming_distance,
[AC_CHECK_HEADER(pHash.h,
phash="yes",
AC_MSG_WARN(You are missing the development headers for the pHash libs))],
AC_MSG_WARN(You are missing the pHash libs) )
AC_LANG_POP([C++])
dnl
dnl Determin what service we can provide based on available libs
dnl
if test "x$imageprocessing" = "xyes" ; then
OPENDIAS_LIBS="$OPENDIAS_LIBS -llept"
AC_DEFINE([CAN_IMAGE],[],[Can manipulate images])
if test "x$scanning" = "xyes" && test "x$imageprocessing" = "xyes" ; then
AC_DEFINE([CAN_SCAN],[],[Have everything that is needed for scanning documents])
OPENDIAS_LIBS="$OPENDIAS_LIBS -lsane"
else
AC_MSG_WARN(You will not be able to scan in any document.)
fi
if test "x$ocr" = "xyes" && test "x$imageprocessing" = "xyes" ; then
AC_DEFINE([CAN_OCR],[],[Have everything that is needed to OCR documents])
LOCALISATION_FLAGS="$LOCALISATION_FLAGS CAN_OCR"
if test -d "/usr/share/tesseract-ocr/tessdata" ; then
dnl Debian/Ubuntu location
TESSERACT_BASE_DIR="/usr/share/tesseract-ocr"
else
if test -d "/usr/share/tesseract/tessdata" ; then
dnl Redhat/Fedora location
TESSERACT_BASE_DIR="/usr/share/tesseract"
else
if test -d "/usr/share/tessdata" ; then
dnl Default/Gentoo location
TESSERACT_BASE_DIR="/usr/share"
else
TESSERACT_BASE_DIR=""
fi
fi
fi
else
AC_MSG_WARN(You will not be able to OCR any document.)
fi
if test "x$phash" = "xyes" ; then
AC_DEFINE([CAN_PHASH],[],[Have everything that is needed to PHASH documents])
OPENDIAS_LIBS="$OPENDIAS_LIBS -lpHash"
LOCALISATION_FLAGS="$LOCALISATION_FLAGS CAN_PHASH"
else
AC_MSG_WARN(You will not be able to compare document.)
fi
else
AC_MSG_WARN(You will not be able to scan, OCR or compare any document.)
fi
if test "x$magic" = "xyes" ; then
AC_DEFINE([CAN_MAGIC],[],[Can decide on uploaded file type.])
OPENDIAS_LIBS="$OPENDIAS_LIBS -lmagic"
if test "x$xml" = "xyes" && test "x$zzip" = "xyes" ; then
AC_DEFINE([CAN_READODF],[],[Have everything that is needed to read ODF documents])
OPENDIAS_LIBS="$OPENDIAS_LIBS -lxml2 -lzzip"
else
AC_MSG_WARN(You will not be able to import any ODF documents.)
fi
if test "x$pdf" = "xyes"; then
AC_DEFINE([CAN_PDF],[],[Have everything that is needed to import PDF documents])
OPENDIAS_LIBS="$OPENDIAS_LIBS -lpoppler-cpp"
else
AC_MSG_WARN(You will not be able to import any PDF documents.)
fi
else
AC_MSG_WARN(You will not be able to import in any document.)
fi
if test -f ${srcdir}/scripts/build-local-versions.pl; then
echo Running build-local-versions.pl "$PACKAGE_STRING" $LOCALISATION_FLAGS
perl ${srcdir}/scripts/build-local-versions.pl "$PACKAGE_STRING" $LOCALISATION_FLAGS
fi
dnl
dnl Write what we've learnt
dnl
AC_OUTPUT([
Makefile
src/Makefile
sql/Makefile
i18n/Makefile
webcontent/Makefile
webcontent/style/Makefile
webcontent/includes/Makefile
webcontent/includes/local/Makefile
webcontent/images/Makefile
webcontent/images/datepicker/Makefile
webcontent/images/easySlider/Makefile
webcontent/images/jquery-ui/Makefile
])