Update for 0.5.1 release
[entangle:entangle.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT([entangle], [0.5.1])
4 AC_CONFIG_SRCDIR([src/entangle-main.c])
5 AM_CONFIG_HEADER([config.h])
6 dnl Make automake keep quiet about wildcards & other GNUmake-isms
7 AM_INIT_AUTOMAKE([-Wno-portability])
8
9 AC_CONFIG_MACRO_DIR([m4])
10
11 # Use the silent-rules feature when possible.
12 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
13 AM_SILENT_RULES([yes])
14
15 AC_CANONICAL_HOST
16
17 dnl *******************************************************************************
18 dnl Declare required library versions
19 dnl *******************************************************************************
20
21 GLIB_REQUIRED=2.26.0
22 AC_SUBST(GLIB_REQUIRED)
23 GIO_REQUIRED=2.26.0
24 AC_SUBST(GIO_REQUIRED)
25 GTHREAD_REQUIRED=2.26.0
26 AC_SUBST(GTHREAD_REQUIRED)
27 GDK_PIXBUF_REQUIRED=2.12.0
28 AC_SUBST(GDK_PIXBUF_REQUIRED)
29 GTK_REQUIRED=3.0.0
30 AC_SUBST(GTK_REQUIRED)
31 GPHOTO2_REQUIRED=2.4.11
32 AC_SUBST(GPHOTO2_REQUIRED)
33 GUDEV_REQUIRED=145
34 AC_SUBST(GUDEV_REQUIRED)
35 DBUS_GLIB_REQUIRED=0.60
36 AC_SUBST(DBUS_GLIB_REQUIRED)
37 GOBJECT_INTROSPECTION_REQUIRED=0.9.3
38 AC_SUBST(GOBJECT_INTROSPECTION_REQUIRED)
39 LCMS_REQUIRED=1.18
40 AC_SUBST(LCMS_REQUIRED)
41 LIBPEAS_REQUIRED=0.5.5
42 AC_SUBST(LIBPEAS_REQUIRED)
43 GEXIV2_REQUIRED=0.2.2
44 AC_SUBST(GEXIV2_REQUIRED)
45 XEXT_REQUIRED=1.3.0
46 AC_SUBST(XEXT_REQUIRED)
47 LIBRAW_REQUIRED=0.9.0
48 AC_SUBST(LIBRAW_REQUIRED)
49
50 dnl *******************************************************************************
51 dnl Setup core compilers / build helpers
52 dnl *******************************************************************************
53
54 AC_PROG_CC_STDC
55 AM_PROG_CC_C_O
56
57 AM_PROG_LIBTOOL
58
59
60 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $GLIB_REQUIRED])
61 AC_SUBST(GLIB_CFLAGS)
62 AC_SUBST(GLIB_LIBS)
63
64 PKG_CHECK_MODULES([GIO], [glib-2.0 >= $GIO_REQUIRED])
65 AC_SUBST(GIO_CFLAGS)
66 AC_SUBST(GIO_LIBS)
67
68 AC_MSG_CHECKING([for glib-compile-schemas])
69 AC_SUBST([GLIB_COMPILE_SCHEMAS], [$($PKG_CONFIG --variable=glib_compile_schemas gio-2.0)])
70 if [ test -n "$GLIB_COMPILE_SCHEMAS" ]; then
71   AC_MSG_RESULT([$GLIB_COMPILE_SCHEMAS])
72 else
73   AC_MSG_ERROR([The $GLIB_COMPILE_SCHEMAS binary must be installed before building entangle])
74 fi
75
76 PKG_CHECK_MODULES([GMODULE], [gmodule-2.0 >= $GLIB_REQUIRED])
77 AC_SUBST(GMODULE_CFLAGS)
78 AC_SUBST(GMODULE_LIBS)
79
80 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0 >= $GTHREAD_REQUIRED])
81 AC_SUBST(GTHREAD_CFLAGS)
82 AC_SUBST(GTHREAD_LIBS)
83
84 PKG_CHECK_MODULES([GDK_PIXBUF], [gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED])
85 AC_SUBST(GDK_PIXBUF_CFLAGS)
86 AC_SUBST(GDK_PIXBUF_LIBS)
87
88 PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_REQUIRED])
89 AC_SUBST(GTK_CFLAGS)
90 AC_SUBST(GTK_LIBS)
91
92 have_gphoto25=no
93 PKG_CHECK_MODULES([GPHOTO2], [libgphoto2 >= 2.5], [
94     have_gphoto25=yes
95 ], [
96     PKG_CHECK_MODULES([GPHOTO2], [libgphoto2 >= $GPHOTO2_REQUIRED])
97 ])
98 AC_SUBST(GPHOTO2_CFLAGS)
99 AC_SUBST(GPHOTO2_LIBS)
100
101 if test "$have_gphoto25" = "yes" ; then
102   AC_DEFINE_UNQUOTED([HAVE_GPHOTO25], 1, [whether we're building libgphoto >= 2.5])
103 fi
104
105 PKG_CHECK_MODULES([GUDEV], [gudev-1.0 >= $GUDEV_REQUIRED])
106 AC_SUBST(GUDEV_CFLAGS)
107 AC_SUBST(GUDEV_LIBS)
108
109 PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1 >= $DBUS_GLIB_REQUIRED])
110 AC_SUBST(DBUS_GLIB_CFLAGS)
111 AC_SUBST(DBUS_GLIB_LIBS)
112
113 PKG_CHECK_MODULES([LCMS], [lcms >= $LCMS_REQUIRED])
114 AC_SUBST(LCMS_CFLAGS)
115 AC_SUBST(LCMS_LIBS)
116
117 PKG_CHECK_MODULES([GEXIV2], [gexiv2 >= $GEXIV2_REQUIRED])
118 AC_SUBST(GEXIV2_CFLAGS)
119 AC_SUBST(GEXIV2_LIBS)
120
121 PKG_CHECK_MODULES([LIBRAW], [libraw_r >= $LIBRAW_REQUIRED])
122 AC_SUBST(LIBRAW_CFLAGS)
123 AC_SUBST(LIBRAW_LIBS)
124
125 PKG_CHECK_MODULES([XEXT], [xext >= $XEXT_REQUIRED],
126                   [have_xext=yes], [have_xext=no])
127 AC_SUBST(XEXT_CFLAGS)
128 AC_SUBST(XEXT_LIBS)
129 if test "$have_xext" = "yes"; then
130   AC_DEFINE_UNQUOTED([HAVE_XEXT], [], [Use Xext library])
131 fi
132
133
134 GTK_DOC_CHECK([1.10],[--flavour no-tmpl])
135
136 PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],
137                   [gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED])
138 AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS)
139 AC_SUBST(GOBJECT_INTROSPECTION_LIBS)
140 AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
141 AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
142
143 PKG_CHECK_MODULES([LIBPEAS], [libpeas-1.0 >= $LIBPEAS_REQUIRED])
144 PKG_CHECK_MODULES([LIBPEAS_UI], [libpeas-gtk-1.0 >= $LIBPEAS_REQUIRED])
145 AC_SUBST(LIBPEAS_CFLAGS)
146 AC_SUBST(LIBPEAS_LIBS)
147 AC_SUBST(LIBPEAS_UI_CFLAGS)
148 AC_SUBST(LIBPEAS_UI_LIBS)
149
150 ENTANGLE_COMPILE_WARNINGS
151
152 GETTEXT_PACKAGE=entangle
153 AC_SUBST(GETTEXT_PACKAGE)
154 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],"$GETTEXT_PACKAGE", [GETTEXT package name])
155 AM_GLIB_GNU_GETTEXT
156 IT_PROG_INTLTOOL([0.35.0])
157
158 # Autoconf 2.61a.99 and earlier don't support linking a file only
159 # in VPATH builds.  But since GNUmakefile is for maintainer use
160 # only, it does not matter if we skip the link with older autoconf.
161 # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH
162 # builds, so use a shell variable to bypass this.
163 GNUmakefile=GNUmakefile
164 m4_if(m4_version_compare([2.61a.100],
165         m4_defn([m4_PACKAGE_VERSION])), [1], [],
166       [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
167         [GNUmakefile=$GNUmakefile])])
168
169 AC_CONFIG_FILES(
170   Makefile
171   entangle.spec
172   src/Makefile
173   src/icons/Makefile
174   src/icons/128x128/Makefile
175   src/icons/128x128/actions/Makefile
176   src/icons/16x16/Makefile
177   src/icons/16x16/actions/Makefile
178   src/icons/22x22/Makefile
179   src/icons/22x22/actions/Makefile
180   src/icons/32x32/Makefile
181   src/icons/32x32/actions/Makefile
182   src/icons/48x48/Makefile
183   src/icons/48x48/actions/Makefile
184   src/icons/64x64/Makefile
185   src/icons/64x64/actions/Makefile
186   po/Makefile.in
187   docs/Makefile
188   docs/man/Makefile
189   docs/man/en/Makefile
190   docs/reference/Makefile
191   )
192
193 AC_OUTPUT
194
195 # Need to eval twice, to ensure we fully subsitute out all path variables
196 rawdatadir=`eval "echo $datadir"`
197 rawdatadir=`eval "echo $rawdatadir"`
198
199 searchdirs="/usr/share:/usr/local/share"
200 test -n "$XDG_DATA_DIRS" && searchdirs="$searchdirs:$XDG_DATA_DIRS"
201
202 found=0
203 oldIFS=$IFS
204 IFS=:
205 for i in $searchdirs
206 do
207     test "$i" = "$rawdatadir" && found=1
208 done
209 IFS=$oldIFS
210
211 if test "$found" = "0"
212 then
213   AC_MSG_NOTICE([WARNING:])
214   AC_MSG_NOTICE([WARNING: GSettings schemas will be installed under:])
215   AC_MSG_NOTICE([WARNING:])
216   AC_MSG_NOTICE([WARNING:      $rawdatadir])
217   AC_MSG_NOTICE([WARNING:])
218   AC_MSG_NOTICE([WARNING: GSettings will only look for configuration file schemas under:])
219   AC_MSG_NOTICE([WARNING:])
220   AC_MSG_NOTICE([WARNING:      $searchdirs])
221   AC_MSG_NOTICE([WARNING:])
222   AC_MSG_NOTICE([WARNING: If you continue with this install location for schemas, you])
223   AC_MSG_NOTICE([WARNING: should set the following environment variable:])
224   AC_MSG_NOTICE([WARNING:])
225   AC_MSG_NOTICE([WARNING:      XDG_DATA_DIRS=$rawdatadir:$searchdirs])
226   AC_MSG_NOTICE([WARNING:])
227   AC_MSG_NOTICE([WARNING: If XDG_DATA_DIRS is not set, Entangle will attempt to enable])
228   AC_MSG_NOTICE([WARNING: a workaround on startup to avoid crashes])
229 fi