Add -Wstrict-prototypes to gcc options only in developer mode
[geeqie.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.  -*- Autoconf
2  -*-
3
4 dnl This file is a part of Geeqie project (http://geeqie.sourceforge.net/).
5 dnl Copyright (C) 2008 The Geeqie team
6 dnl
7 dnl This program is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 2 of the License, or
10 dnl (at your option) any later version.
11 dnl
12 dnl This program is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 dnl GNU General Public License for more details.
16
17 AC_PREREQ(2.57)
18 AC_INIT(geeqie, 1.0alpha1, geeqie-devel@lists.sourceforge.net)
19
20 # Check for rightly dirs
21 AC_CONFIG_SRCDIR([src/main.c])
22
23 AC_CONFIG_AUX_DIR(auxdir)
24 AM_INIT_AUTOMAKE
25
26 AC_CONFIG_HEADER([config.h])
27
28 # Only for developers
29 AM_MAINTAINER_MODE
30
31 AC_ARG_ENABLE(developer, [
32 Development options:
33 AC_HELP_STRING([--enable-developer], [turn on developers mode [default=no]])],
34 [
35   __IS_DEVELOPER=yes
36 ],
37 [
38 if test "x${enable_developer}" != "xyes"
39 then
40   __IS_DEVELOPER=no
41 else
42   __IS_DEVELOPER=yes
43 fi
44 ])
45
46 #  Debug support
47 # ----------------------------------------------------------------------
48
49 dnl Debugging option
50 dnl FIXME: official release convert default to 'no'
51 dnl
52
53 AC_ARG_ENABLE([debug], [
54 Development options:
55 AC_HELP_STRING([--enable-debug], [turn on debugging [default=no]])], [],
56 [
57 if test "x${enable_developer}" != "xyes"
58 then
59   enable_debug="no"
60 else
61   enable_debug="yes"
62 fi
63 ])
64
65 if test "x${enable_debug}" != "xno"
66 then
67   CXXFLAGS="${CXXFLAGS} -g -O0 -Wunused-value -Wunused-variable -Wunused-function -Wunused-label -Wcomment -Wmissing-braces -Wparentheses -Wreturn-type -Wswitch -Wstrict-aliasing -W"
68   CFLAGS="${CFLAGS} -g -O0 -Wunused-value -Wunused-variable -Wunused-function -Wunused-label -Wcomment -Wimplicit-int -Werror-implicit-function-declaration -Wmissing-braces -Wparentheses -Wreturn-type -Wswitch -Wstrict-aliasing -W"
69   if test "x${enable_developer}" == "xyes"
70   then
71   CXXFLAGS="${CXXFLAGS} -Wall"
72   CFLAGS="${CFLAGS} -Wstrict-prototypes -Wall"
73   fi
74   AC_DEFINE(DEBUG,1,[Defined if Geeqie is compiled with debugging support])
75   __IS_DEBUG=yes
76 else
77   __IS_DEBUG=no
78 fi
79
80 AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
81
82 AC_ARG_ENABLE(deprecated, [
83 AC_HELP_STRING([--enable-deprecated], [turn off checking of deprecated functions [default=yes]])], [], 
84 [
85 if test "x${enable_developer}" != "xyes"
86 then
87   enable_deprecated="no"
88 else
89   enable_deprecated="yes"
90 fi
91 ])
92
93 if test "x${enable_deprecated}" != "xno"
94 then
95   CXXFLAGS="${CXXFLAGS} -DGTK_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED=1 -DGDK_PIXBUF_DISABLE_DEPRECATED=1 -DG_DISABLE_DEPRECATED=1"
96   CFLAGS="${CFLAGS} -DGTK_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED=1 -DGDK_PIXBUF_DISABLE_DEPRECATED=1 -DG_DISABLE_DEPRECATED=1"
97   __IS_DEPRECATED=yes
98 else
99   __IS_DEPRECATED=no
100 fi
101
102
103 AC_ISC_POSIX
104 AC_PROG_CC
105 AC_PROG_CXX
106 AC_STDC_HEADERS
107 AC_ARG_PROGRAM
108
109 dnl checks for functions
110 AC_CHECK_FUNCS(strverscmp access fsync fflush)
111
112
113 # Check target architecture
114
115 # Check for Win32
116 AC_MSG_CHECKING([for some Win32 platform])
117 case "$target_os" in
118   mingw* | cygwin*)
119     platform_win32=yes
120     AC_DEFINE(PLATFORM_WIN32, 1, [Build on win32 OS])
121     ;;
122   *)
123     platform_win32=no
124     ;;
125 esac
126 AC_MSG_RESULT([$platform_win32])
127 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
128
129 AC_MSG_CHECKING([for native Win32])
130 case "$target_os" in
131   mingw*)
132     os_win32=yes
133     AC_DEFINE(OS_WIN32, 1, [Build on native win32 OS])
134     os_unix=no
135     PATHSEP=';'
136     ;;
137   *)
138     os_win32=no
139     os_unix=yes
140     PATHSEP=':'
141     ;;
142 esac
143 AC_MSG_RESULT([$os_win32])
144 AC_SUBST(PATHSEP)
145 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
146 AM_CONDITIONAL(OS_UNIX, test "$os_unix" = "yes")
147
148 if test "$os_win32" = "yes"; then
149   AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
150   AC_CHECK_TOOL(WINDRES, windres, :)
151 else
152   WINDRES=":"
153 fi
154
155 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
156 AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:")
157 AC_SUBST(WINDRES)
158
159 AC_MSG_CHECKING(for libpthread)
160 have_libpthread=no
161 AC_CHECK_LIB([pthread], [main],
162   [AC_CHECK_HEADER([pthread.h],
163      have_libpthread=yes,
164      have_libpthread=no)],
165   [AC_MSG_ERROR([Can't find the POSIX thread libraries])], [-lpthread])
166 if test "x${have_libpthread}" = "xyes"; then
167         LIBPTHREAD='-lpthread'
168         AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if pthread is available])
169 else
170   AC_MSG_WARN([POSIX thread header not installed])
171 fi
172 AC_MSG_RESULT([${have_libpthread}])
173
174 dnl reasonable guesses for where stuff is installed
175 if test "x$prefix" = "xNONE"; then
176   prefix="/usr/local"
177 else
178   prefix=$prefix
179 fi
180
181 AM_PATH_GTK_2_0(2.4.0,,AC_MSG_ERROR(GTK+ >= 2.4.0 not installed.))
182 AC_PATH_PROGS(GDK_PIXBUF_CSOURCE, "gdk-pixbuf-csource")
183
184 AC_ARG_WITH(readmedir, [  --with-readmedir=DIR    install path for readme files],
185             readmedir=$withval, readmedir="$prefix/share/doc/geeqie-$VERSION")
186 AC_ARG_WITH(htmldir, [  --with-htmldir=DIR      install path for html files],
187             htmldir=$withval, htmldir="$readmedir/html")
188
189 AC_DEFINE_UNQUOTED(GQ_HELPDIR, "$readmedir", [Location of documentation files])
190 AC_DEFINE_UNQUOTED(GQ_HTMLDIR, "$htmldir", [Location of html documentation])
191
192 AC_SUBST(readmedir)
193 AC_SUBST(htmldir)
194
195 #  LIRC support
196 # ----------------------------------------------------------------------
197
198 dnl Check for LIRC client support
199 AC_ARG_ENABLE([lirc],
200   AC_HELP_STRING([--disable-lirc], [disable lirc support (auto)]),
201 [
202 if test x"${enableval}" = x"yes" -a x"$GCC" = x"yes"; then
203   AC_MSG_RESULT(yes)
204   lirc=yes
205 else
206   AC_MSG_RESULT(no)
207   lirc=no
208 fi], AC_MSG_RESULT(no))
209
210
211 AC_ARG_WITH(lirc-prefix,
212 [  --with-lirc-prefix=PATH Prefix where LIRC is installed],
213 [
214 for dir in `echo "$withval" | tr : ' '`; do
215   if test -d $dir/lib; then CXXFLAGS="$CXXFLAGS -L$dir/lib"; fi
216   if test -d $dir/include; then CXXFLAGS="$CXXFLAGS -I$dir/include"; fi
217   done
218 ])
219
220 if test "x${lirc}" != x"no" ; then
221   AC_CHECK_HEADER(lirc/lirc_client.h,
222     [AC_CHECK_LIB(lirc_client,lirc_init,[LIBS=-llirc_client $LIBS;AC_DEFINE([HAVE_LIRC],[],[Define to 1 if LIRC must be used])],,)],)
223 fi
224
225
226 #  LCMS support
227 # ----------------------------------------------------------------------
228
229 AC_ARG_ENABLE([lcms],
230   AC_HELP_STRING([--disable-lcms], [disable lcms support]),
231     [liblcms=$enableval], [liblcms=auto])
232
233 if test "x${liblcms}" != "xno"; then
234   PKG_CHECK_MODULES(LCMS, [lcms >= 1.14],
235     [
236       HAVE_LCMS=yes
237       AC_DEFINE(HAVE_LCMS, 1, [define to enable use of color profiles with lcms])
238     ],
239     [
240       HAVE_LCMS=no
241       AC_MSG_WARN([$LCMS_PKG_ERRORS])
242     ])
243 else
244   HAVE_LCMS=disabled
245 fi
246         
247 AM_CONDITIONAL(HAVE_LCMS, [test "x$HAVE_LCMS" = xyes])
248 AC_SUBST(LCMS_CFLAGS)
249 AC_SUBST(LCMS_LIBS)
250
251
252 #  Exiv2 support
253 # ----------------------------------------------------------------------
254
255 AC_ARG_ENABLE([exiv2],
256   AC_HELP_STRING([--disable-exiv2], [disable exiv2 support]),
257     [libexiv2=$enableval], [libexiv2=auto])
258
259 if test "x${libexiv2}" != "xno"; then
260   PKG_CHECK_MODULES(EXIV2, [exiv2 >= 0.11],
261     [
262       HAVE_EXIV2=yes
263       AC_DEFINE(HAVE_EXIV2, 1, [define to enable exiv2 support])
264     ],
265     [
266       HAVE_EXIV2=no
267       AC_MSG_WARN([$EXIV2_PKG_ERRORS])
268     ])
269 else
270   HAVE_EXIV2=disabled
271 fi
272         
273 AM_CONDITIONAL(HAVE_EXIV2, [test "x$HAVE_EXIV2" = xyes])
274 AC_SUBST(EXIV2_CFLAGS)
275 AC_SUBST(EXIV2_LIBS)
276
277
278 #  Gettext support
279 # ----------------------------------------------------------------------
280
281 dnl Set of available languages
282 ALL_LINGUAS="ar be bg ca cs da de eo es et eu fi fr hu id it ja ko nl nb pl pt_BR ro ru sk sl sv th tr uk vi zh_CN.GB2312 zh_TW"
283
284 GETTEXT_PACKAGE=$PACKAGE
285 AC_SUBST(GETTEXT_PACKAGE)
286 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["${GETTEXT_PACKAGE}"],[Name of gettext file])
287 AM_GLIB_GNU_GETTEXT
288 AM_GLIB_DEFINE_LOCALEDIR(GQ_LOCALEDIR)
289
290 AC_SUBST(CFLAGS)
291 AC_SUBST(CXXFLAGS)
292 AC_SUBST(CPPFLAGS)
293 AC_SUBST(LDFLAGS)
294
295
296 AH_TOP([
297 /** @file config.h
298  * autogenerated definition by autoheader.
299  * @author Bruclik
300  */
301  
302 /*
303  *  This file is a part of Geeqie project (http://geeqie.sourceforge.net/).
304  *  Copyright (C) 2008 The Geeqie team
305  *  
306  *  This program is free software; you can redistribute it and/or modify
307  *  it under the terms of the GNU General Public License as published by
308  *  the Free Software Foundation; either version 2 of the License, or 
309  *  (at your option) any later version.
310  *  
311  *  This program is distributed in the hope that it will be useful,
312  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
313  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
314  *  GNU General Public License for more details.
315  */ 
316  
317 #ifndef _INCLUDE_CONFIG_H
318 #define _INCLUDE_CONFIG_H
319 ])
320
321 AH_BOTTOM([#endif])
322
323 dnl Write the output
324 dnl
325
326 AC_CONFIG_FILES([
327     Makefile
328     src/Makefile
329     src/icons/Makefile
330     src/icons/svg/Makefile
331     po/Makefile.in
332     doc/Makefile
333     geeqie.spec
334 ])
335
336 AC_OUTPUT
337 dnl Print the results
338 dnl
339
340 cat > config.report << END
341
342      Config results:
343     -=-=-=-=-=-=-=-=-
344
345 Package:
346   Name:          $PACKAGE_NAME
347   Version:       $PACKAGE_VERSION
348   Patch version: $GQ_PATCH_VERSION
349   Date:          $GQ_PATCH_DATE
350
351 Architecture:
352   UNIX:          $os_unix
353   Win32:         $platform_win32 (native: $os_win32)
354
355 Settings:
356   Developer:     $__IS_DEVELOPER
357   Debug:         $__IS_DEBUG
358   Deprecated:    $__IS_DEPRECATED
359
360 Flags:
361   Geeqie:        $GQ_CFLAGS
362   DEFS:          $DEFS
363   CPPFLAGS:      $__CPPFLAGS
364   CFLAGS:        $CFLAGS
365   CXXFLAGS:      $CXXFLAGS
366   Gtk:           $GTK_CFLAGS
367   Glib:          $GLIB_CFLAGS
368   Thread:        $LIBPTHREAD
369   Others:        $LCMS_LIBS $EXIV2_LIBS
370
371 Support:
372   LCMS:          $HAVE_LCMS
373   Exiv2:         $HAVE_EXIV2
374 Localization:
375   NLS support:   $USE_NLS
376   LINGUAS:       $LINGUAS
377
378 Documentation:
379   Doxygen:       $DOXYGEN
380   Formats:       $doxy_formats_report
381 END
382
383 cat config.report
384 cat <<EOF
385
386   Now you can type "make" to build Geeqie
387   (or you take blue pill and the story ends :)
388
389 EOF
390