summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 209e020702d0bab02c136cafefd64f9b09c30e50 (plain)
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 libopenraw configure
dnl written by Hubert Figuiere

AC_PREREQ([2.69])
AC_INIT([libopenraw],[0.4.0-alpha.4])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign tar-ustar no-dist-gzip dist-bzip2 dist-xz subdir-objects])
AM_MAINTAINER_MODE
m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
AM_SILENT_RULES([yes])


dnl ---------------------------------------------------------------------------
dnl Advanced information about versioning:
dnl   * "Writing shared libraries" by Mike Hearn
dnl         http://plan99.net/~mike/writing-shared-libraries.html
dnl   * libtool.info chapter "Versioning"
dnl   * libtool.info chapter "Updating library version information"
dnl ---------------------------------------------------------------------------
dnl Versioning:
dnl  - CURRENT (Major):  Increment if the interface has changes. AGE is always
dnl                      *changed* at the same time.
dnl  - AGE (Micro):      Increment if any interfaces have been added; set to 0
dnl                      if any interfaces have been removed. Removal has
dnl                      precedence over adding, so set to 0 if both happened.
dnl                      It denotes upward compatibility.
dnl  - REVISION (Minor): Increment any time the source changes; set to
dnl                      0 if you incremented CURRENT.
dnl
dnl  To summarize. Any interface *change* increment CURRENT. If that interface
dnl  change does not break upward compatibility (ie it is an addition),
dnl  increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
dnl  REVISION is set to 0, otherwise REVISION is incremented.
dnl ---------------------------------------------------------------------------
dnl version 0.0.3 is 3 2 0
dnl version 0.0.4 is 4 3 0
dnl version 0.0.5 is 5 4 0
dnl version 0.0.6 is 6 5 0
dnl version 0.0.7 is 6.5.1
dnl version 0.0.8 is 6.5.2
dnl version 0.0.9 is 6.5.3
dnl version 0.1.0 is 7.0.0
dnl version 0.1.1 is 7.0.1
dnl version 0.1.2 is 7.0.2
dnl version 0.1.3 is 7.0.3
dnl version 0.2.0 is 8.0.0
dnl version 0.2.1 is 8.0.1
dnl version 0.2.2 is 8.0.2
dnl version 0.2.3 is 8.0.3
dnl version 0.3.0 is 9.0.0
dnl version 0.3.1 is 9.0.1
dnl version 0.3.2 is 9.0.2
dnl version 0.3.3 is 9.0.3
dnl version 0.3.4 is 9.0.4
dnl version 0.3.5 is 9.0.5
dnl version 0.3.6 is 9.0.6
dnl version 0.3.7 is 9.0.7
dnl This version is now built in Rust. Break ABI.
dnl version 0.4.0 is 10.0.0
AC_SUBST([LIBOPENRAW_REVISION], [0])
AC_SUBST([LIBOPENRAW_AGE],      [0])
AC_SUBST([LIBOPENRAW_CURRENT],  [10])
AC_SUBST([LIBOPENRAW_CURRENT_MIN],
         [`expr $LIBOPENRAW_CURRENT - $LIBOPENRAW_AGE`])
AC_SUBST([LIBOPENRAW_VERSION_INFO],
         [$LIBOPENRAW_CURRENT:$LIBOPENRAW_REVISION:$LIBOPENRAW_AGE])

dnl the major version. used for package names, etc
LIBOPENRAW_MAJOR_VERSION=$LIBOPENRAW_CURRENT_MIN.0
AC_SUBST(LIBOPENRAW_MAJOR_VERSION)

dnl the path where includes are installed
LIBOPENRAW_INCLUDE_BASE=libopenraw-0.4
AC_SUBST(LIBOPENRAW_INCLUDE_BASE)


dnl --------------------------------------------------------------------
dnl guess directory to install *.pc into
dnl --------------------------------------------------------------------
pkgconfigdir='${libdir}/pkgconfig'
AC_SUBST(pkgconfigdir)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_INSTALL
LT_INIT
AX_CXX_COMPILE_STDCXX_14(noext,mandatory)

dnl Requirements
EXEMPI_REQUIRED=1.99.5

dnl Needed for GdkPixbuf
LIBGLIB_REQUIRED=2.0.0
dnl Optional GdkPixbuf support
LIBGDKPIXBUF_REQUIRED=2.0.0

AC_SUBST(LIBGLIB_REQUIRED)
AC_SUBST(LIBGDKPIXBUF_REQUIRED)

AC_ARG_WITH(darwinports,[  --with-darwinports     add /opt/local/... to CPP/LDFLAGS (Mac OSX)],[
        if test "x$withval" != "xno"; then
                CPPFLAGS="$CPPFLAGS -I/opt/local/include"
                LDFLAGS="$LDFLAGS -L/opt/local/lib"
		CC=g++
        fi
])
AC_ARG_WITH(fink,[  --with-fink          add /sw/... to CPP/LDFLAGS (Mac OSX)],[
        if test "x$withval" != "xno"; then
                CPPFLAGS="$CPPFLAGS -I/sw/include"
                LDFLAGS="$LDFLAGS -L/sw/lib"
		CC=g++
        fi
])

dnl Approximate minimum version.
dnl Feel free to adjust.
BOOST_REQUIRE([1.60.0])
BOOST_TEST([s])
BOOST_STRING_ALGO
BOOST_VARIANT

AC_LANG(C)
AC_CHECK_HEADER(jpeglib.h, ,
	AC_MSG_ERROR([jpeglib headers not found]))
dnl PKG_CHECK_MODULES(EXEMPI, exempi-2.0 >= $EXEMPI_REQUIRED)
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.5.0)

PKG_CHECK_MODULES(CURL, libcurl,
			[AC_DEFINE(HAVE_CURL, 1, [Define to 1 to enable CURL support for testsuite])
			HAVE_CURL=yes],
			[HAVE_CURL=no])
AC_CHECK_FUNCS_ONCE(get_current_dir_name)

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

AC_LANG([C++])
AC_LANG_COMPILER_REQUIRE

AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])

AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option], [
        ax_compiler_flags_test="-Werror=unknown-warning-option"
], [
        ax_compiler_flags_test=""
])
AX_APPEND_COMPILE_FLAGS([ \
   -Wchar-subscripts \
   -Wcast-align \
   -Wextra \
   -Wexceptions \
   -Wheader-guard \
   -Wformat \
   -Wformat-nonliteral \
   -Wformat-security \
   -Wno-gnu-zero-variadic-macro-arguments \
   -Wlogical-not-parentheses \
   -Wmisleading-indentation \
   -Wmissing-noreturn \
   -Woverloaded-virtual \
   -Wpointer-arith \
   -Wredundant-decls \
   -Wpointer-bool-conversion \
   -Wshadow \
   -Wsign-compare \
   -Wno-suggest-attribute=noreturn \
   -Wsuggest-override \
   -Wnull-conversion \
   -Wunreachable-code \
   -Wunused \
   -Wwrite-strings \
], [], [$ax_compiler_flags_test])

AC_ARG_ENABLE(asan,[  --enable-asan    Turn on address sanitizer],[
    AX_APPEND_COMPILE_FLAGS([-fsanitize=address -fno-omit-frame-pointer])
    AC_LANG([C])
    AX_APPEND_COMPILE_FLAGS([-fsanitize=address -fno-omit-frame-pointer])
]
,
[

])

AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
AS_IF(test x$CARGO = xno,
    AC_MSG_ERROR([cargo is required])
)
AC_CHECK_PROG(RUSTC, [rustc], [yes], [no])
AS_IF(test x$RUSTC = xno,
    AC_MSG_ERROR([rustc is required])
)

dnl Release build we do.
if test x$debug = xtrue; then
CARGO_TARGET_SUBDIR=debug
else
CARGO_TARGET_SUBDIR=release
fi
AC_SUBST(CARGO_TARGET_SUBDIR)

AC_CONFIG_FILES([
Makefile
include/Makefile
include/libopenraw/Makefile
lib/Makefile
lib/libopenraw-0.4.pc
doc/Makefile
doc/Doxyfile
doc/doxygen/Makefile
test/Makefile
testsuite/Makefile
tools/Makefile
demo/Makefile
])
AC_OUTPUT


echo "
Options:

  Testsuite booststrap: ${HAVE_CURL}
"