1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT(configure.in)
4AM_INIT_AUTOMAKE(rawstudio, 2.0)
5AM_CONFIG_HEADER(config.h)
6AM_MAINTAINER_MODE
7AM_PROG_LIBTOOL
8AC_CONFIG_MACRO_DIR([m4])
9
10AC_ISC_POSIX
11AC_PROG_CC
12AM_PROG_CC_STDC
13AC_PROG_CXX
14AC_HEADER_STDC
15
16AC_ARG_ENABLE(experimental,
17	AS_HELP_STRING(
18		[--enable-experimental],
19		[Enable experimental code (default: disabled)]),
20	[EXPERIMENTAL=yes]
21)
22
23AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
24[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
25AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
26dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27AS_LITERAL_IF([$1],
28  [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]), [
29      ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
30      _AC_LANG_PREFIX[]FLAGS="$1"
31      AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
32        AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
33        AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
34      _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
35  [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
36   _AC_LANG_PREFIX[]FLAGS="$1"
37   AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
38     eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
39     eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
40   _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
41eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])
42AC_MSG_RESULT($ax_check_compiler_flags)
43if test "x$ax_check_compiler_flags" = xyes; then
44	m4_default([$2], :)
45else
46	m4_default([$3], :)
47fi
48])dnl AX_CHECK_COMPILER_FLAGS
49
50if test "$EXPERIMENTAL" == "yes"; then
51	AC_DEFINE([EXPERIMENTAL],[1],[Enable experimental code])
52fi
53
54dnl libjpeg
55if test -z "$LIBJPEG"; then
56  AC_CHECK_LIB(jpeg, jpeg_destroy_decompress, jpeg_ok=yes, jpeg_ok=no)
57  if test "$jpeg_ok" = yes; then
58    AC_CHECK_HEADER(jpeglib.h, jpeg_ok=yes, jpeg_ok=no)
59    if test "$jpeg_ok" = yes; then
60      LIBJPEG='-ljpeg'
61    else
62      AC_MSG_ERROR([*** JPEG header files not found.])
63    fi
64  else
65    AC_MSG_ERROR([*** Rawstudio requires libjpeg.])
66  fi
67fi
68AC_SUBST(LIBJPEG)
69
70dnl libtiff
71if test -z "$LIBTIFF"; then
72AC_CHECK_LIB(tiff, TIFFOpen, tiff_ok=yes, tiff_ok=no)
73  if test "$tiff_ok" = yes; then
74    AC_CHECK_HEADER(tiffio.h, tiff_ok=yes, tiff_ok=no)
75    if test "$tiff_ok" = yes; then
76      LIBTIFF='-ltiff'
77    else
78      AC_MSG_ERROR([*** libtiff header files not found.])
79    fi
80  else
81    AC_MSG_ERROR([*** Rawstudio requires libtiff.])
82  fi
83fi
84AC_SUBST(LIBTIFF)
85
86pkg_modules="gtk+-2.0 >= 2.8.0 libxml-2.0 >= 2.4 gconf-2.0 >= 2.0 lcms dbus-1 exiv2 fftw3f lensfun libcurl flickcurl sqlite3 libssl libgphoto2 x11"
87PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
88AC_SUBST(PACKAGE_CFLAGS)
89AC_SUBST(PACKAGE_LIBS)
90
91GETTEXT_PACKAGE=rawstudio
92AC_SUBST(GETTEXT_PACKAGE)
93AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
94
95dnl Add the languages which your application supports here.
96ALL_LINGUAS="cs da de en fr it nb pl ru fi es sv nl pt_BR ca hu ja"
97AM_GLIB_GNU_GETTEXT
98AC_CHECK_FUNCS(memmem)
99
100AX_CHECK_COMPILER_FLAGS("-msse2", [_CAN_COMPILE_SSE2=yes], [_CAN_COMPILE_SSE2=no])
101AX_CHECK_COMPILER_FLAGS("-msse4.1", [_CAN_COMPILE_SSE4_1=yes],[_CAN_COMPILE_SSE4_1=no])
102AX_CHECK_COMPILER_FLAGS("-mavx", [_CAN_COMPILE_AVX=yes],[_CAN_COMPILE_AVX=no])
103
104AM_CONDITIONAL(CAN_COMPILE_SSE4_1,  test "$_CAN_COMPILE_SSE4_1" = yes)
105AM_CONDITIONAL(CAN_COMPILE_SSE2, test "$_CAN_COMPILE_SSE2" = yes)
106AM_CONDITIONAL(CAN_COMPILE_AVX, test "$_CAN_COMPILE_AVX" = yes)
107
108[
109branchname()
110{
111	awk '
112/^Repository Root:/ {
113	root=$3;
114}
115
116/^URL:/ {
117	url=$2;
118}
119
120END{
121	sub(root, "", url);
122	if (index(url, "/branches/") == 1) {
123		branch = substr(url, 11);
124		printf(" (branch %s)", branch);
125	} else if (index(url, "/tags/") == 1) {
126		tag = substr(url, 7);
127		printf(" (tag %s)", tag);
128	} else {
129		printf(" (trunk)");
130	}
131}
132'
133}
134
135if test -f .version  ; then
136  RAWSTUDIO_VERSION=$(cat .version)
137else
138  RAWSTUDIO_VERSION="${VERSION}"
139fi
140if test -d .svn && svn --version>/dev/null 2>&1 ; then
141  RAWSTUDIO_SVNREV=$(LC_ALL=C svn info | awk '/^Revision:/ {printf("-svn%s",$2); }')
142  RAWSTUDIO_BRANCH=$(LC_ALL=C svn info |branchname)
143elif test -f .svninfo ; then
144  RAWSTUDIO_SVNREV=$(awk '/^Revision:/ {printf("-snapshot%s",$2); }' .svninfo)
145  RAWSTUDIO_BRANCH=$(cat .svninfo|branchname)
146else
147  RAWSTUDIO_SVNREV=""
148  RAWSTUDIO_BRANCH=""
149fi
150]
151RAWSTUDIO_VERSION="${RAWSTUDIO_VERSION}${RAWSTUDIO_SVNREV}${RAWSTUDIO_BRANCH}"
152
153AC_DEFINE_UNQUOTED([RAWSTUDIO_VERSION], ["$RAWSTUDIO_VERSION"], ["Public revision"])
154
155if test -f .svninfo; then
156  SVNINFO=".svninfo"
157else
158  SVNINFO=""
159fi
160AC_SUBST([SVNINFO])
161
162AC_OUTPUT([
163Makefile
164librawstudio/Makefile
165librawstudio/rawstudio-2.0.pc
166plugins/Makefile
167plugins/cache/Makefile
168plugins/colorspace-adobergb/Makefile
169plugins/colorspace-prophoto/Makefile
170plugins/colorspace-srgb/Makefile
171plugins/colorspace-transform/Makefile
172plugins/crop/Makefile
173plugins/dcp/Makefile
174plugins/demosaic/Makefile
175plugins/denoise/Makefile
176plugins/exposure-mask/Makefile
177plugins/fuji-rotate/Makefile
178plugins/input-file/Makefile
179plugins/input-image16/Makefile
180plugins/lensfun/Makefile
181plugins/load-dcraw/Makefile
182plugins/load-gdk/Makefile
183plugins/load-rawspeed/Makefile
184plugins/meta-ciff/Makefile
185plugins/meta-exiv2/Makefile
186plugins/meta-mrw/Makefile
187plugins/meta-raf/Makefile
188plugins/meta-tiff/Makefile
189plugins/meta-x3f/Makefile
190plugins/output-jpegfile/Makefile
191plugins/output-pngfile/Makefile
192plugins/output-picasa/Makefile
193plugins/output-facebook/Makefile
194plugins/output-flickr/Makefile
195plugins/output-tifffile/Makefile
196plugins/resample/Makefile
197plugins/rotate/Makefile
198src/Makefile
199po/Makefile.in
200pixmaps/Makefile
201profiles/Makefile
202])
203
204