Use an option to enable more warnings instead of the maintainer mode
[lxde/lxappearance.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 prog_name = lxappearance
5
6 AC_PREREQ([2.63])
7 AC_INIT([lxappearance], [0.5.0], [http://lxde.org/])
8 AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
9 # Support silent build rules. Disable by either passing --disable-silent-rules
10 # to configure or passing V=1 to make
11 AM_SILENT_RULES([yes])
12
13 AM_MAINTAINER_MODE
14
15 AC_CONFIG_HEADERS([config.h])
16
17 # Checks for programs.
18 AC_PROG_CC
19 # AM_PROG_LIBTOOL
20
21 # Checks for libraries.
22
23 # Checks for header files.
24 AC_HEADER_STDC
25
26 # Checks for typedefs, structures, and compiler characteristics.
27
28 # Checks for library functions.
29
30 # intltool
31 IT_PROG_INTLTOOL([0.40.0])
32
33 AC_ARG_ENABLE(man,
34        [AC_HELP_STRING([--enable-man],
35                [regenerate roff man pages from Docbook @<:@default=no@:>@])],
36        [enable_man="${enableval}"],
37        [enable_man=no]
38 )
39
40 AC_ARG_ENABLE(more_warnings,
41        [AC_HELP_STRING([--enable-more-warnings],
42                [Add more warnings @<:@default=no@:>@])],
43        [enable_more_warnings="${enableval}"],
44        [enable_more_warnings=no]
45 )
46
47 PKG_CHECK_MODULES(XLIB, "x11")
48 AC_SUBST(XLIB_CFLAGS)
49 AC_SUBST(XLIB_LIBS)
50
51 gtk_modules="gtk+-2.0 >= 2.12.0 gthread-2.0"
52 PKG_CHECK_MODULES(GTK, [$gtk_modules])
53 AC_SUBST(GTK_CFLAGS)
54 AC_SUBST(GTK_LIBS)
55
56 gmodule_modules="gmodule-export-2.0"
57 PKG_CHECK_MODULES(GMODULE, [$gmodule_modules])
58 AC_SUBST(GMODULE_CFLAGS)
59 AC_SUBST(GMODULE_LIBS)
60
61 # gio_modules="gthread-2.0 gio-unix-2.0 glib-2.0 >= 2.18.0"
62 # PKG_CHECK_MODULES(GIO, [$gio_modules])
63 # AC_SUBST(GIO_CFLAGS)
64 # AC_SUBST(GIO_LIBS)
65
66 # menu_modules="libmenu-cache >= 0.3.2"
67 # PKG_CHECK_MODULES(MENU_CACHE, [$menu_modules])
68 # AC_SUBST(MENU_CACHE_CFLAGS)
69 # AC_SUBST(MENU_CACHE_LIBS)
70
71 if test x"$enable_more_warnings" = x"yes"; then
72   ADDITIONAL_FLAGS="-Wall -Werror=all -Werror=format -Werror=implicit-function-declaration -Werror=implicit-int -Werror=missing-braces -Werror=parentheses -Werror=return-type -Werror=strict-aliasing -Werror=switch -Wuninitialized -Werror=unused-label -Werror=unused-value -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Werror=missing-declarations -Wredundant-decls -Wmissing-noreturn -Wpointer-arith -Wcast-align -Wwrite-strings -Werror=inline -Werror=format-nonliteral -Wformat-nonliteral -Werror=format-security -Wformat-security -Winit-self -Werror=missing-include-dirs -Werror=undef -Werror=aggregate-return -Wmissing-format-attribute -Werror=nested-externs -fno-strict-aliasing -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES"
73 fi
74 AC_SUBST(ADDITIONAL_FLAGS)
75
76 AC_ARG_ENABLE(man,
77        [AC_HELP_STRING([--enable-man],
78                [regenerate roff man pages from Docbook @<:@default=no@:>@])],
79        [enable_man="${enableval}"],
80        [enable_man=no]
81 )
82
83 if test "$enable_debug" = "yes"; then
84     # turn on debug and disable optimization
85     CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
86 else
87     # turn off glib debug checks
88     CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
89 fi
90
91 # Generate po/LINGUAS on the fly rather than relying on translators
92 # to maintain it manually. This also overcome the problem that Transifex
93 # cannot add a language to po/LINGUAS if a new po file is submitted.
94 rm -f $srcdir/po/LINGUAS
95 for po_file in `ls $srcdir/po/*.po | sort`;
96 do
97     lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
98     echo $lang >> $srcdir/po/LINGUAS
99 done
100
101 GETTEXT_PACKAGE=lxappearance
102 AC_SUBST(GETTEXT_PACKAGE)
103 AM_GLIB_GNU_GETTEXT
104 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
105
106 if test x"$enable_man" = x"yes"; then
107         AC_PATH_PROG([XSLTPROC], [xsltproc])
108         if test -z "$XSLTPROC"; then
109                 enable_man=no
110         fi
111
112         dnl check for DocBook DTD and stylesheets in the local catalog.
113         JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
114                 [DocBook XML DTD V4.1.2], [], enable_man=no)
115         JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
116                 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
117 fi
118
119 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
120
121 AC_CONFIG_FILES([
122     Makefile
123     src/Makefile
124     data/Makefile
125     data/ui/Makefile
126     data/ui/about.ui
127     data/lxappearance.pc
128     man/Makefile
129     po/Makefile.in
130 ])
131
132 AC_OUTPUT
133
134 if test x"$sysconfdir" != x'/etc'; then
135     echo
136     echo
137     echo 'Error: sysconfdir is not /etc.'
138     echo 'Please consider passing --sysconfdir=/etc to configure.';
139     echo 'Otherwise default config files will be installed to wrong place.'
140     echo
141     echo
142 else
143     echo
144     echo lxappearance....................... : Version $VERSION
145     echo
146     echo Enable debug....................: "$enable_debug"
147     echo Prefix..........................: $prefix
148     echo
149     echo The binary will be installed in $prefix/bin
150     echo
151     echo http://lxde.org/
152     echo
153     echo "Ready to make lxappearance. Type 'make' to continue."
154     echo
155 fi