-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
329 lines (281 loc) · 7.9 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
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([rawproc], [1.3], [[email protected]])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_SRCDIR([src/tiffimage.cpp])
#AC_CONFIG_HEADERS([config.h])
m4_include(wxwin.m4)
m4_include(ax_cxx_compile_stdcxx.m4)
AC_LANG([C++])
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_OPENMP
#AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
# MINGW_AC_WIN32_NATIVE_HOST
# --------------------------
# Check if the runtime platform is a native Win32 host.
#
AC_DEFUN([MINGW_AC_WIN32_NATIVE_HOST],
[AC_CACHE_CHECK([whether we are building for a Win32 host],
[mingw_cv_win32_host],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#ifdef _WIN32
choke me
#endif
])
], [mingw_cv_win32_host=no], [mingw_cv_win32_host=yes]))])
#run the win32 check macro:
MINGW_AC_WIN32_NATIVE_HOST
AC_DEFUN([RP_FIND_GMIC], [
#adapted from https://stackoverflow.com/questions/1021962/how-to-test-a-c-library-usability-in-configure-in
AC_MSG_CHECKING([libgmic])
saved_ldflags="${LDFLAGS}"
LDFLAGS="${LDFLAGS} -lgmic"
AC_RUN_IFELSE(
[
AC_LANG_PROGRAM(
[#include <gmic.h>],
[gmic_list<float> images;]
)
],
[
LIBS="$LIBS -lgmic"
AC_MSG_RESULT([yes])
],
[AC_MSG_ERROR([libgmic not found.])]
)
LDFLAGS="${saved_ldflags}"
])
#Process enables:
AC_ARG_WITH([pixtype],
AS_HELP_STRING([--with-pixtype], [=half|float|double, specifies data type for pixel structure, default is float])
)
if test "$with_pixtype" != ""
then
CXXFLAGS="$CXXFLAGS -DPIXTYPE=$with_pixtype -DPIX$with_pixtype"
fi
#do a bunch of stuff if win32:
if test "$mingw_cv_win32_host" == "yes"
then
AC_MSG_NOTICE([adding win32 libs and flags])
AC_CHECK_LIB([ws2_32],[main])
CXXFLAGS="$CXXFLAGS -DLIBRAW_NODLL"
# LDFLAGS="$LDFLAGS -static" #commented out when I switched to mxe.static...
INNO_SRCDIR="$srcdir"
INNO_SUFFIX="win32"
case "$host_alias" in
x86_64-w64-mingw32* )
INNO_SUFFIX="w64"
INNO_PF="{commonpf64}"
INNO_ARCHITECURESALLOWED="ArchitecturesAllowed=x64"
INNO_ARCHITECTURESINSTALLEDIN64BITMODE="ArchitecturesInstallIn64BitMode=x64"
;;
i686-w64-mingw32* )
INNO_SUFFIX="w32"
INNO_PF="{commonpf32}"
INNO_ARCHITECURES="ArchitecturesAllowed=x64\nArchitecturesInstallIn64BitMode=x64"
;;
esac
fi
AM_CONDITIONAL(WIN32, test x$mingw_cv_win32_host = xyes)
# Checks for libraries.
# Check for wxWidgets.
AC_ARG_ENABLE([wxwidgets],
AS_HELP_STRING([--disable-wxwidgets], [Bypasses wxWidgets checks, use for only compiling the img or exif command line programs.]))
AS_IF([test "x$enable_wxwidgets" != "xno"], [
WX_CONFIG_OPTIONS
reqwx=3.1.0
WX_CONFIG_CHECK([$reqwx], [wxWin=1], [wxWin=0], [std,aui,propgrid], [])
if test "$wxWin" != 1; then
AC_MSG_ERROR([
wxWidgets must be installed on your system.
Please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' or 'wx-config --static --libs' command)
is in LD_LIBRARY_PATH or equivalent variable and
wxWidgets version is $reqwx or above.
])
fi
])
#libjpeg:
PKG_CHECK_MODULES([JPEG],[libjpeg], [
CPPFLAGS="$JPEG_CFLAGS $CPPFLAGS"
LIBS="$JPEG_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
#AC_CHECK_LIB([tiff], [TIFFSetErrorHandler])
#libtiff:
PKG_CHECK_MODULES([TIFF],[libtiff-4], [
CPPFLAGS="$TIFF_CFLAGS $CPPFLAGS"
LIBS="$TIFF_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
#libpng:
PKG_CHECK_MODULES([PNG],[libpng], [
CPPFLAGS="$PNG_CFLAGS $CPPFLAGS"
LIBS="$PNG_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
#littlecms2:
PKG_CHECK_MODULES([LCMS2],[lcms2], [
CPPFLAGS="$LCMS2_CFLAGS $CPPFLAGS"
LIBS="$LCMS2_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
AC_ARG_WITH([lcms2-fastfloat],
AS_HELP_STRING([--with-lcms2-fastfloat], [use LittleCMS fast_float plugin])
)
if test "$with_lcms2_fastfloat" != ""
then
CXXFLAGS="$CXXFLAGS -DUSE_LCMS_FASTFLOAT"
fi
#exiv2:
PKG_CHECK_MODULES([EXIV2],[exiv2], [
CPPFLAGS="$EXIV2_CFLAGS $CPPFLAGS"
LIBS="$EXIV2_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
#libraw-dcraw:
AC_ARG_ENABLE([dcraw],
AS_HELP_STRING([--enable-dcraw], [enables use of a dcraw executable for
raw file input, in lieu of LibRaw. dcraw mus be in a directory listed in PATH, o
r an absolute path specified with input.raw.dcraw.programpath])
)
if test "$enable_dcraw" == "yes"
then
CXXFLAGS="$CXXFLAGS -DUSE_DCRAW"
else
if test "$OPENMP_CFLAGS" == ""
then
PKG_CHECK_MODULES([LIBRAW],[libraw], [
CPPFLAGS="$LIBRAW_CFLAGS $CPPFLAGS"
LIBS="$LIBRAW_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
else
PKG_CHECK_MODULES([LIBRAW],[libraw_r], [
CPPFLAGS="$LIBRAW_CFLAGS $CPPFLAGS"
LIBS="$LIBRAW_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
fi
fi
#G'MIC:
AC_ARG_ENABLE([gmic],
AS_HELP_STRING([--enable-gmic], [enables gmic.])
)
if test "$enable_gmic" == "yes"
then
PKG_CHECK_MODULES([GMIC],[gmic], [
CPPFLAGS="$GMIC_CFLAGS $CPPFLAGS"
LIBS="$GMIC_LIBS $LIBS"
],[
RP_FIND_GMIC
])
CXXFLAGS="$CXXFLAGS -DUSE_GMIC"
fi
AM_CONDITIONAL(GMIC, test x$enable_gmic = xyes)
#lensfun:
AC_ARG_ENABLE([lensfun],
AS_HELP_STRING([--enable-lensfun], [enables lensfun.])
)
if test "$enable_lensfun" == "yes"
then
PKG_CHECK_MODULES([LENSFUN],[lensfun], [
CPPFLAGS="$LENSFUN_CFLAGS $CPPFLAGS"
LIBS="$LENSFUN_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
CXXFLAGS="$CXXFLAGS -DUSE_LENSFUN"
if test "${LENSFUN_DATABASE_VERSION+set}" != set; then
LENSFUN_DATABASE_VERSION="version_1"
fi
fi
AM_CONDITIONAL(LENSFUN, test x$enable_lensfun = xyes)
#lensfun-update:
AC_ARG_ENABLE([lensfunupdate],
AS_HELP_STRING([--enable-lensfunupdate], [enables lensfun update. lensfun must also be enabled.])
)
if test "$enable_lensfunupdate" == "yes"
then
PKG_CHECK_MODULES([CURL],[libcurl], [
CPPFLAGS="$CURL_CFLAGS $CPPFLAGS"
LIBS="$CURL_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
PKG_CHECK_MODULES([ARCHIVE],[libarchive], [
CPPFLAGS="$ARCHIVE_CFLAGS $CPPFLAGS"
LIBS="$ARCHIVE_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
CXXFLAGS="$CXXFLAGS -DUSE_LENSFUN_DBUPDATE"
fi
AM_CONDITIONAL(LENSFUNUPDATE, test x$enable_lensfunupdate = xyes)
#librtprocess:
AC_ARG_ENABLE([librtprocess],
AS_HELP_STRING([--enable-librtprocess], [enables librtprocess, which contains additional demosaic algorithms.])
)
if test "$enable_librtprocess" == "yes"
then
PKG_CHECK_MODULES([RTPROCESS],[rtprocess], [
CPPFLAGS="$RTPROCESS_CFLAGS $CPPFLAGS"
LIBS="$RTPROCESS_LIBS $LIBS"
],[
AC_MSG_ERROR([not found.])
])
CXXFLAGS="$CXXFLAGS -DUSE_LIBRTPROCESS"
fi
AM_CONDITIONAL(LIBRTPROCESS, test x$enable_librtprocess = xyes)
#old LibRaw dcraw params, pre 0.18.7:
AC_ARG_ENABLE([old-libraw],
AS_HELP_STRING([--enable-old-libraw], [enables old LibRaw demosaic parameters.])
)
if test "$enable_old_libraw" == "yes"
then
CXXFLAGS="$CXXFLAGS -DOLD_LIBRAW"
fi
CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
#LIBS="$LIBS $WX_LIBS"
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h locale.h stdint.h stdlib.h string.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
# Checks for library functions.
#AC_FUNC_MALLOC
#AC_CHECK_FUNCS([clock_gettime floor modf pow rint setlocale sqrt strtol])
CXXFLAGS="$OPENMP_CXXFLAGS $CXXFLAGS"
LIBS="$OPENMP_CFLAGS $LIBS"
#AC_SUBST(WX_CPPFLAGS)
#AC_SUBST(WX_CXXFLAGS_ONLY)
#AC_SUBST(WX_CFLAGS_ONLY)
AC_SUBST(WX_LIBS)
AC_SUBST(INNO_SRCDIR)
AC_SUBST(INNO_ARCHITECURESALLOWED)
AC_SUBST(INNO_ARCHITECTURESINSTALLEDIN64BITMODE)
AC_SUBST(INNO_PF)
AC_SUBST(INNO_SUFFIX)
AC_SUBST(LENSFUN_DATABASE_VERSION)
AC_CONFIG_FILES([Makefile src/Makefile])
if test "$mingw_cv_win32_host" == "yes"
then
AC_CONFIG_FILES([rawproc.iss])
fi
AC_OUTPUT