File: configure.ac

package info (click to toggle)
iipimage 1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,744 kB
  • sloc: sh: 8,101; cpp: 6,672; ansic: 3,983; java: 872; makefile: 189; perl: 2
file content (350 lines) | stat: -rw-r--r-- 8,887 bytes parent folder | download | duplicates (2)
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
338
339
340
341
342
343
344
345
346
347
348
349
350
# Process this file with autoconf to produce a configure script.

AC_INIT(iipsrv,1.0,ruven@users.sourceforge.net)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE


AC_PREFIX_DEFAULT( `pwd` )


# Checks for programs.
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_CC_C_O

AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T

LT_INIT


# Checks for header files.
AC_CHECK_HEADERS(glob.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(sys/time.h)
AC_FUNC_MALLOC
AC_CHECK_LIB(m, log2, AC_DEFINE(HAVE_LOG2))
AC_CHECK_FUNCS([setenv])

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_HEADERS(ext/pool_allocator.h)
AC_LANG_RESTORE

# Checks for various hash map implementations
AC_CXX_HEADER_UNORDERED_MAP
AC_HEADER_TR1_UNORDERED_MAP
AX_CXX_HAVE_EXT_HASH_MAP

# For our windows build
AC_CHECK_HEADERS(windows.h)

# we want largefile support, if possible
AC_SYS_LARGEFILE

# Check for C99 isfinite function
AX_CXX_HAVE_ISFINITE

# Check for OpenMP
AC_OPENMP
AS_IF([test "x$enable_openmp" != "xyes"], [
 INCLUDES="$INCLUDES $OPENMP_CFLAGS"
 LIBS="$LIBS $OPENMP_CFLAGS"
])


#************************************************************ 


AC_ARG_ENABLE([debug],
     [  --enable-debug    Turn on debugging],
     [case "${enableval}" in
       yes) debug=true ;;
       no)  debug=false ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
     esac],[debug=false])
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])


#************************************************************ 


# Check for a user specified location for libjpeg

# AC_ARG_WITH(libjpeg-incl,
#   [  --with-libjpeg-incl=DIR     location of the jpeg library include files],
#   jpeg_incl=-I$withval)

# AC_ARG_WITH(libjpeg-lib,
#   [  --with-libjpeg-lib=DIR     location of the jpeg library files],
#   jpeg_lib=-L$withval)

# AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
#   LIBJPEG_INCL=$jpeg_incl; LIBJPEG_LIB="$jpeg_lib -ljpeg",
#   AC_MSG_ERROR(unable to find libjpeg),
#   $jpeg_lib)

FIND_JPEG(,[AC_MSG_ERROR([libjpeg not found])])



#************************************************************ 
# Check for a standard libz

AC_SEARCH_LIBS(gzopen, z)

#************************************************************ 



#************************************************************
# Check for libmemcached

AC_CHECK_HEADERS( libmemcached/memcached.h,
	AC_SEARCH_LIBS( memcached_create,
		memcached,
		MEMCACHED=true,
		MEMCACHED=false,
		-lpthread )
)
if test "x${MEMCACHED}" = xtrue; then
	AC_DEFINE(HAVE_MEMCACHED)
	LIBS="$LIBS -lpthread"
fi
#************************************************************



# Check for user specified location for libtiff

# AC_ARG_WITH(libtiff-incl,
#   [  --with-libtiff-incl=DIR     location of the tiff library include files],
#   tiff_incl=-I$withval)

# AC_ARG_WITH(libtiff-lib,
#   [  --with-libtiff-lib=DIR     location of the tiff library files],
#   tiff_lib=-L$withval)

# AC_CHECK_LIB(tiff, TIFFReadScanline,
#   LIBTIFF_INCL=$tiff_incl; LIBTIFF_LIB="$tiff_lib -ltiff -ljpeg -lm",
#   AC_MSG_ERROR(unable to find libtiff),
#   $tiff_lib -ljpeg -lm)


FIND_TIFF(,[AC_MSG_ERROR([libtiff not found])])


#************************************************************

# Check for little cms library

AC_CHECK_HEADERS(lcms2.h,
	AC_SEARCH_LIBS( cmsOpenProfileFromMem, lcms2,
		LCMS=true; AC_DEFINE(LCMS),
		LCMS=false )
)
LCMS=false


#************************************************************ 

# Check for user specified locations for fast cgi library


AC_ARG_WITH( fcgi-incl,
   [  --with-fcgi-incl=DIR          location of the fcgi include files],
   [LIBFCGI_INCLUDES="-I$withval"]
)

AC_ARG_WITH( fcgi-lib,
   [  --with-fcgi-lib=DIR           location of the fcgi libraries],
   [LIBFCGI_LDFLAGS="-L$withval"]
)

AC_CHECK_LIB( fcgi, FCGI_Accept,
		AC_MSG_RESULT([configure: using system libfcgi]);
			LIBFCGI_LIBS="-lfcgi",
		AC_MSG_RESULT([configure: unable to find system libfcgi - using bundled version]);
			LIBFCGI_INCLUDES="-I../fcgi/include -I../fcgi";
			LIBFCGI_LIBS="../fcgi/libfcgi/libfcgi.a"
)

AC_SUBST(LIBFCGI_INCLUDES)
AC_SUBST(LIBFCGI_LDFLAGS)
AC_SUBST(LIBFCGI_LIBS)

#************************************************************ 


# Check for libdl for dynamic library loading

AC_ARG_ENABLE(modules,
    [  --enable-modules       enable dynamic module loading] )

if test "$enable_modules" = "yes"; then

	modules=true
	AC_CHECK_HEADERS(dlfcn.h,
		AC_SEARCH_LIBS( dlopen, dl, AC_DEFINE(ENABLE_DL), AC_MSG_ERROR(unable to find libdl) )
	)

else
	modules=false
	AC_MSG_WARN( optional dynamic module loading not enabled)

fi

AM_CONDITIONAL( [ENABLE_MODULES], [test x$modules = xtrue] )
AC_SUBST(DL_LIBS)


#************************************************************

# Check for Kakadu JPEG2000 library

AC_ARG_WITH( kakadu,
   [  --with-kakadu=DIR          location of the kakadu source files],
   kakadu_path=$withval)


AC_CHECK_FILE( $kakadu_path/managed/all_includes/jpx.h,
	AC_MSG_RESULT([configure: Found Kakadu sources. Will compile JPEG2000 support]); KAKADU=true,
	AC_MSG_RESULT([configure: No Kakadu JPEG2000 Sources Found]); KAKADU=false
)
AM_CONDITIONAL([ENABLE_KAKADU], [test x$KAKADU = xtrue])

if test "x${KAKADU}" = xtrue; then
	AC_DEFINE(HAVE_KAKADU)
	INCLUDES="$INCLUDES -I$kakadu_path/managed/all_includes/"
	EXTRAS="KakaduImage.o"
	kakadu_lib_name=`basename $kakadu_path/apps/make/*.so | sed 's/^lib//' | sed 's/.so$//'`
	LIBS="$LIBS $kakadu_path/apps/make/jpx.o $kakadu_path/apps/make/jp2.o $kakadu_path/apps/make/kdu_stripe_decompressor.o -L$kakadu_path/apps/make -l$kakadu_lib_name -lpthread"

	# Check for SSSE3 support in Kakadu
	AC_CHECK_FILE( $kakadu_path/apps/make/ssse3_stripe_transfer.o,
		KDU_SSSE3=true
	)
	if test "x${KDU_SSSE3}" = xtrue; then
		LIBS="$LIBS $kakadu_path/apps/make/ssse3_stripe_transfer.o"
	fi

	# Check for AVX2 support in Kakadu
	AC_CHECK_FILE( $kakadu_path/apps/make/avx2_stripe_transfer.o,
		AC_MSG_RESULT([configure: Kakadu is >= v7.5.]);
		KDU_75=true,
		AC_MSG_RESULT([configure: Kakadu is < v7.5])
	)
	if test "x${KDU_75}" = xtrue; then
		LIBS="$LIBS $kakadu_path/apps/make/avx2_stripe_transfer.o $kakadu_path/apps/make/kdu_client_window.o"
	fi
fi

INCLUDES="$INCLUDES -I."
AC_SUBST(INCLUDES)
AC_SUBST(EXTRAS)

AC_CHECK_LIB(c,get_nprocs_conf,AC_DEFINE(NPROCS))



#************************************************************
#     Check for PNG support
#************************************************************

#AC_CHECK_HEADERS( png.h,
#	AC_SEARCH_LIBS(
#		png_create_read_struct,
#		png,
#		PNG=true,
#		PNG=false )
#)

# Disable PNG for now
PNG=false

if test "x${PNG}" = xtrue; then
	AM_CONDITIONAL([ENABLE_PNG], [true])
	AC_DEFINE(HAVE_PNG)
else
	AM_CONDITIONAL([ENABLE_PNG], [false])
fi


#************************************************************
#     FCGI library configure
#************************************************************


AC_LANG([C++])

# autoconf defaults CXX to 'g++', so its unclear whether it exists/works
AC_MSG_CHECKING([whether $CXX works])
AC_TRY_COMPILE([#include <iostream>], 
               [std::cout << "ok";], 
               [AC_MSG_RESULT(yes)
                LIBFCGIXX=libfcgi++.la
                ECHO_CPP=echo-cpp${EXEEXT}
                AC_MSG_CHECKING([whether cin has a streambuf assignment operator])
                AC_TRY_COMPILE([#include <iostream>], 
                               [cin = static_cast<streambuf *>(0);], 
                               [AC_MSG_RESULT(yes)
                                AC_DEFINE([HAVE_IOSTREAM_WITHASSIGN_STREAMBUF],  [1], 
                                          [Define if cin/cout/cerr has a streambuf assignment operator])],
                               [AC_MSG_RESULT(no)]) 
                AC_MSG_CHECKING([whether char_type is defined in the context of streambuf])
                AC_TRY_COMPILE([#include <iostream>],
                               [class fcgi_streambuf : public std::streambuf { char_type ct; }],
                               [AC_MSG_RESULT(yes)
                                AC_DEFINE([HAVE_STREAMBUF_CHAR_TYPE], [1], 
                                          [Define if char_type is defined in the context of streambuf])],
                               [AC_MSG_RESULT(no)])],
               [AC_MSG_RESULT(no)])
AC_SUBST(LIBFCGIXX)
AC_SUBST(ECHO_CPP)

AC_LANG([C])

AC_CHECK_LIB([nsl],       [gethostbyname])
AC_CHECK_LIB([socket],    [socket]) 


ACX_PTHREAD([THREADED=threaded${EXEEXT}])
AC_SUBST([THREADED])


FCGI_COMMON_CHECKS

AC_REPLACE_FUNCS([strerror])


SYSTEM=unix
AC_SUBST([SYSTEM])

AC_PROG_CC_WARNINGS

AC_SUBST(LIBS)

AC_PROG_MAKE_SET
AC_CONFIG_FILES([Makefile \
	src/Makefile \
	man/Makefile])
AC_OUTPUT

# Print out option status
AC_MSG_RESULT([
Options Enabled:
---------------
 Memcached: 			${MEMCACHED}
 JPEG2000 (Kakadu):		${KAKADU}
])

# PNG Output:			${PNG}
# LitleCMS:			${LCMS}
#])