forked from lock042/siril
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
447 lines (372 loc) · 13.6 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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
dnl Process this file with autoconf to produce a configure script.
m4_define([siril_major_version], [1])
m4_define([siril_minor_version], [3])
m4_define([siril_micro_version], [5])
m4_define([siril_prerelease_version], [alpha-dev])
m4_define([siril_version],
[siril_major_version.siril_minor_version.siril_micro_version])
m4_define([siril_version_full],
[siril_major_version().siril_minor_version().siril_micro_version()m4_bpatsubst(siril_prerelease_version(), [^], [-])])
m4_define([siril_unstable],
m4_if(m4_eval(siril_minor_version % 2), [1], [yes], [no]))
m4_define([siril_stable],
m4_if(m4_eval(siril_minor_version % 2), [0], [yes], [no]))
dnl change siril_version_full by siril_version for stable release
dnl AC_INIT([siril], [siril_version_full],
AC_INIT([siril], [siril_version],
[https://gitlab.com/free-astro/siril/issues],
[siril],
[https://www.siril.org])
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_MACRO_DIR([m4])
SIRIL_UNSTABLE=siril_unstable
SIRIL_MAJOR_VERSION=siril_major_version
SIRIL_MINOR_VERSION=siril_minor_version
SIRIL_MICRO_VERSION=siril_micro_version
dnl ================================================================
dnl Gettext stuff.
dnl ================================================================
IT_PROG_INTLTOOL([0.50])
AC_SUBST([GETTEXT_PACKAGE], [siril])
AC_SUBST(SIRIL_UNSTABLE)
AC_SUBST(SIRIL_MAJOR_VERSION)
AC_SUBST(SIRIL_MINOR_VERSION)
AC_SUBST(SIRIL_MICRO_VERSION)
dnl Define these values in config.h
AC_DEFINE([SIRIL_MAJOR_VERSION], [siril_major_version], [Major version of Siril])
AC_DEFINE([SIRIL_MINOR_VERSION], [siril_minor_version], [Minor version of Siril])
AC_DEFINE([SIRIL_MICRO_VERSION], [siril_micro_version], [Micro version of Siril])
remember_set_CFLAGS="$CFLAGS"
AC_PROG_CC
m4_include(m4/openmp.m4)
AC_OPENMP
AC_LANG([C])
AC_LANG([C++])
# remove -g flag from default CFLAGS
if test "x$remember_set_CFLAGS" = "x"; then
if test "$CFLAGS" = "-g -O2"; then
CFLAGS="-O2"
elif test "$CFLAGS" = "-g"; then
CFLAGS=""
fi
fi
CFLAGS="-D_FILE_OFFSET_BITS=64 -Werror=unknown-pragmas -Werror=unused-label -fno-common -ftree-vectorize -fno-math-errno $CFLAGS $OPENMP_CFLAGS"
CXXFLAGS="$CFLAGS -std=c++17"
if test "x$SIRIL_UNSTABLE" = "xyes"; then
AC_DEFINE(SIRIL_UNSTABLE, 1,
[Define to 1 if this is an unstable version of Siril])
fi
AM_CONDITIONAL(SIRIL_UNSTABLE, test "x$SIRIL_UNSTABLE" = "xyes")
dnl Set PACKAGE_SOURCE_DIR in config.h.
packagesrcdir=`cd $srcdir && pwd`
AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [Package source dir])
# Checks for header files.
AC_CHECK_HEADERS([execinfo.h sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h sys/filio.h])
# Checks for reallocarray function (used in kplot)
AC_CHECK_FUNCS(reallocarray, AC_DEFINE([HAVE_REALLOCARRAY], [1], [reallocarray is available]), )
# Checks for library functions.
AC_CHECK_FUNCS(timegm gmtime_r)
AC_CHECK_FUNCS(backtrace, , AC_CHECK_LIB(execinfo, backtrace))
dnl Set PACKAGE_DOC_DIR in config.h.
dnl AC_DEFINE_UNQUOTED(PACKAGE_DOC_DIR, "${ac_default_prefix}/share/doc/${PACKAGE}", "package doc dir")
dnl On some platforms, std::atomic needs a helper library
AC_MSG_CHECKING(whether -latomic is needed)
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <atomic>
#include <cstdint>
std::atomic<std::int64_t> v;
int main() {
return v;
}
]])], STD_ATOMIC_NEED_LIBATOMIC=no, STD_ATOMIC_NEED_LIBATOMIC=yes)
AC_MSG_RESULT($STD_ATOMIC_NEED_LIBATOMIC)
if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then
LIBATOMIC_LIBS="-latomic"
fi
AC_SUBST([LIBATOMIC_LIBS])
dnl ================ PLATFORM CHECKS ================
dnl Compute the canonical host-system type variable (need config.guess and config.sub)
AC_CANONICAL_HOST
AC_MSG_CHECKING([if compiling for Win32])
case "$host_os" in
mingw* | cygwin*)
platform_win32=yes
;;
*)
platform_win32=no
;;
esac
AC_MSG_RESULT([$platform_win32])
dnl ================ MANDATORY DEPENDENCIES ================
dnl check math lib
AC_CHECK_LIB(m, log, LIBS="$LIBS -lm")
dnl check GLIB version
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.56.0)
case "$host_os" in
mingw*)
PKG_CHECK_MODULES([GIO],[gio-2.0 >= 2.56.0 gio-windows-2.0 >= 2.56.0])
;;
*)
PKG_CHECK_MODULES([GIO],[gio-2.0 >= 2.56.0 gio-unix-2.0 >= 2.56.0])
;;
esac
dnl check GTK
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.20.0)
dnl check lcms2
PKG_CHECK_MODULES(LCMS2, lcms2 >= 2.14)
dnl check cairo
PKG_CHECK_MODULES(CAIRO, cairo)
dnl check wcslib
PKG_CHECK_MODULES(WCSLIB, wcslib >= 7.12)
dnl check fftw3 and its threading capabilities
m4_include([m4/fftw.m4])
dnl check GNU Scientific Library
PKG_CHECK_MODULES(GSL, [gsl < 2],
[AC_DEFINE([HAVE_GSL_1], [1], [Use GSL 1])],
[PKG_CHECK_MODULES(GSL, [gsl >= 2],
[AC_DEFINE([HAVE_GSL_2], [1], [Use GSL 2])])
])
dnl check cfitsio
PKG_CHECK_MODULES(CFITSIO, [cfitsio])
dnl Check for json-glib
PKG_CHECK_MODULES(JSON_GLIB, [json-glib-1.0 >= 1.2.6])
dnl check opencv
AC_PROG_CXX
if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
(test "X$CXX" != "Xg++"))) ; then
AC_PROG_CXXCPP
dnl check for C++14 support
m4_include([m4/ax_cxx_compile_stdcxx.m4])
AX_CXX_COMPILE_STDCXX(14, noext, mandatory)
PKG_CHECK_MODULES([OPENCV], [opencv4 >= 4.4.0],
[AC_DEFINE([HAVE_CV44], [1], [Using OpenCV4.4])]
[OPENCV_LIBS="-lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_stitching"],
[PKG_CHECK_MODULES([OPENCV], [opencv4 >= 4.2.0],
[AC_MSG_WARN([OpenCV 4.2 found, translation-only registration will be disabled - requires 4.4])]
[OPENCV_LIBS="-lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_stitching"],
AC_MSG_ERROR([opencv not found.]))])
else
AC_MSG_ERROR([no C++ compiler found])
fi
PKG_CHECK_MODULES(LIBRTPROCESS, [rtprocess], have_rtprocess="yes", have_rtprocess="no")
if test "x$have_rtprocess" = "xno"; then
AC_MSG_NOTICE([librtprocess not found])
if test "$cross_compiling" != "yes"; then
dnl check CMake used for librtprocess
AC_PATH_PROG(CMAKE, cmake, no)
if test "x$CMAKE" = xno; then
AC_MSG_ERROR([CMAKE not found (needed to built internal librtprocess)])
fi
CMAKE_GENERATOR=
if test "$platform_win32" = "yes"; then
CMAKE_GENERATOR="-G \"MSYS Makefiles\""
fi
AC_SUBST([CMAKE_GENERATOR])
AC_MSG_NOTICE([librtprocess will be built statically])
else
# When cross-compiling, you should build rtprocess yourself and
# install it yourself.
AC_MSG_ERROR([librtprocess not found])
fi
fi
AM_CONDITIONAL(HAVE_LIBRTPROCESS, test "x$have_rtprocess" = "xyes")
if test "$cross_compiling" != "yes"; then
dnl check CMake used for htmesh
AC_PATH_PROG(CMAKE, cmake, no)
if test "x$CMAKE" = xno; then
AC_MSG_ERROR([CMAKE not found (needed to built internal htmesh)])
fi
CMAKE_GENERATOR=
if test "$platform_win32" = "yes"; then
CMAKE_GENERATOR="-G \"MSYS Makefiles\""
fi
AC_SUBST([CMAKE_GENERATOR])
AC_MSG_NOTICE([htmesh will be built statically])
else
# When cross-compiling, you should build rtprocess yourself and
# install it yourself.
AC_MSG_ERROR([htmesh cannot be built])
fi
AM_CONDITIONAL(HAVE_HTMESH, test "x$have_htmesh" = "xyes")
dnl ================ OPTIONAL DEPENDENCIES ================
dnl check raw lib
PKG_CHECK_MODULES(LIBRAW, [libraw >= 0.17],
[AC_DEFINE([HAVE_LIBRAW], [1], [Using RAW images])],
AC_MSG_WARN([libraw not found. Not using RAW importer.]))
dnl check libexiv2
PKG_CHECK_MODULES(EXIV2, [exiv2 >= 0.25],
[AC_DEFINE([HAVE_EXIV2], [1], [Using exif previews])],
AC_MSG_WARN([exiv2 not found. Not extracting image previews.]))
dnl check tiff lib
PKG_CHECK_MODULES(LIBTIFF, [libtiff-4],
[AC_DEFINE([HAVE_LIBTIFF], [1], [Using TIFF images])],
AC_MSG_WARN([libtiff not found. Not using TIFF importer and exporter.]))
dnl check jpeg lib
dnl PKG_CHECK_MODULES(JPEG, [libjpeg])
AC_CHECK_LIB(jpeg, jpeg_mem_src, [],
AC_MSG_WARN([libjpeg not found. Not using JPEG importer and exporter.]))
dnl check png lib
PKG_CHECK_MODULES(LIBPNG, [libpng >= 1.6],
[AC_DEFINE([HAVE_LIBPNG], [1], [Using PNG images])],
AC_MSG_WARN([libpng not found. Not using PNG importer and exporter.]))
dnl check heif lib
PKG_CHECK_MODULES(LIBHEIF, [libheif],
[AC_DEFINE([HAVE_LIBHEIF], [1], [Using HEIF images])],
AC_MSG_WARN([libheif not found. Not using HEIF importer and exporter.]))
dnl check heif lib
PKG_CHECK_MODULES(LIBXISF, [libxisf],
[AC_DEFINE([HAVE_LIBXISF], [1], [Using XISF images >= 0.2.7])],
AC_MSG_WARN([libxisf not found. Not using XISF importer and exporter.]))
dnl check ffms2
PKG_CHECK_MODULES(FFMS2, [ffms2],
[AC_DEFINE([HAVE_FFMS2], [1], [Using FFMS2])],
AC_MSG_WARN([libffms2 not found. Not using AVI importer.]))
dnl checking several ffmpeg libraries
PKG_CHECK_MODULES(FFMPEG, [libavformat libavutil >= 55.20 libavcodec libswscale libswresample],
[AC_DEFINE([HAVE_FFMPEG], [1], [film export supported])],
AC_MSG_WARN([ffmpeg libav libraries not found or too old. Not using film export formats.]))
dnl checking libcurl
curl_avail=no
m4_include([m4/libcurl.m4])
LIBCURL_CHECK_CONFIG([yes], [7.10.0],
[AC_DEFINE([HAVE_LIBCURL], [1], [Using Libcurl])] curl_avail=yes, [])
dnl Check for libgit
PKG_CHECK_MODULES([LIBGIT], [libgit2],
[AC_DEFINE([HAVE_LIBGIT2], [1], [Using online scripts])],
AC_MSG_WARN([libgit2 was not found. Not using online scripts.]))
dnl ================================================================
dnl Collect some arguments.
dnl ================================================================
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],
[enable debug build [default=no]])],,
[enable_debug="no"])
AM_CONDITIONAL([SIRIL_DEBUG],[test "x$enable_debug" = "xyes"])
if test "x$enable_debug" = "xyes"; then
AC_DEFINE([SIRIL_OUTPUT_DEBUG], [1], [Using debug output])
CFLAGS="-g $CFLAGS"
CXXFLAGS="$CFLAGS"
fi
#####################################
# Check for Platform and architecture
#####################################
platform_family="other"
PATHSEP=':'
AC_MSG_CHECKING([platform and architecture])
case "$host_os" in
linux-**)
platform=unix
platform_family="linux"
;;
freebsd-*)
platform=unix
platform_family="bsd"
;;
cygwin*)
platform=windows
platform_family="windows"
;;
mingw*)
platform=windows
platform_family="windows"
PATHSEP=';'
CFLAGS=" $CFLAGS -D_WIN32_WINNT=0x0600 -DWINVER=0x0600 "
CXXFLAGS=" $CXXFLAGS -D_WIN32_WINNT=0x0600 -DWINVER=0x0600 "
case "$host_cpu" in
x86_64)
;;
*)
WIN32_LARGE_ADDRESS_AWARE='-Wl,--large-address-aware'
;;
esac
;;
darwin*)
platform=osx
platform_family="macos"
AC_SUBST(EXTRA_LIBS,'-framework AppKit')
CFLAGS="$CFLAGS -ObjC"
;;
esac
AC_MSG_RESULT([$platform])
AM_CONDITIONAL([PLATFORM_UNIX], [test "$platform" = "unix"])
AM_CONDITIONAL([PLATFORM_WIN32], [test "$platform" = "windows"])
AM_CONDITIONAL([PLATFORM_OSX], [test "$platform" = "osx"])
AC_DEFINE_UNQUOTED(CPU_ARCH, "$host_cpu", [The CPU family this was built for])
AC_DEFINE_UNQUOTED(SIRIL_BUILD_PLATFORM_FAMILY, "$platform_family", [The OS family this was built for])
AC_SUBST(WIN32_LARGE_ADDRESS_AWARE)
AC_SUBST(PATHSEP)
if test "$platform" = "windows"; then
AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
AC_CHECK_TOOL(WINDRES, windres, :)
else
WINDRES=":"
AC_PROG_LN_S
fi
AM_CONDITIONAL(MS_LIB_AVAILABLE, test "x$ms_librarian" = xyes)
AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:")
AC_SUBST(WINDRES)
#####################################
# Check for gdk windowing style
#####################################
AC_MSG_CHECKING([for native gdk windows style])
gdk_targets=`$PKG_CONFIG --variable=targets gdk-3.0`
gdk_windowing="x11"
for target in $gdk_targets;
do
case "$target" in
quartz)
gdk_windowing=quartz
;;
win32)
gdk_windowing=win32
;;
esac
done
AC_MSG_RESULT([$gdk_windowing])
AM_CONDITIONAL(GDK_WINDOWING_QUARTZ, test "$gdk_windowing" = "quartz")
AM_CONDITIONAL(GDK_WINDOWING_WIN32, test "$gdk_windowing" = "win32")
AM_CONDITIONAL(GDK_WINDOWING_X11, test "$gdk_windowing" = "x11")
if test "$platform" = "osx"; then
AC_DEFINE([OS_OSX],[1],[Defined if os is Mac OSX])
PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration-gtk3 >= 2.0.8)
AC_SUBST(GTK_MAC_CFLAGS)
AC_SUBST(GTK_MAC_LIBS)
fi
if test `uname` != "Darwin"; then
if (test "$platform" = "windows") ; then
AC_SUBST(EXTRA_LIBS,'-lpsapi')
fi
fi
#################
# Bundle packages
#################
AC_MSG_CHECKING([whether we build a relocatable package])
AC_ARG_ENABLE(relocatable-bundle,
[ --enable-relocatable-bundle
build with resources considered bundled under the same prefix
(default=auto)],,
enable_relocatable_bundle=auto)
if test "x$enable_relocatable_bundle" != xno &&
test "x$enable_relocatable_bundle" != xyes; then
# By default, assume building for Windows or macOS everything to be on
# the same prefix and can be relocated.
# On other platforms, build-time paths are meaningful.
if test "$platform" = "osx" ||
test "$platform" = "windows"; then
enable_relocatable_bundle=yes
else
enable_relocatable_bundle=no
fi
fi
if test "x$enable_relocatable_bundle" = xyes; then
AC_DEFINE(ENABLE_RELOCATABLE_RESOURCES, 1,
[Define to 1 if resources are considered bundled under the same prefix])
fi
AM_CONDITIONAL(ENABLE_RELOCATABLE_RESOURCES, test x$enable_relocatable_bundle = xyes)
AC_MSG_RESULT([$enable_relocatable_bundle])
AC_SUBST([AM_LDFLAGS])
AC_CONFIG_FILES([Makefile src/Makefile subprojects/Makefile data/Makefile pixmaps/Makefile pixmaps/icons/Makefile platform-specific/Makefile platform-specific/linux/Makefile po/Makefile.in])
AC_OUTPUT