Adding upstream version 0.3.2.
[debian/lxrandr.git] / configure.ac
CommitLineData
e96a0ec2
DB
1dnl Process this file with autoconf to produce a configure script.
2
5723eb8f 3AC_INIT([lxrandr],[0.3.2])
d08e9a0e 4AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign no-dist-gzip dist-xz])
e70c902e 5AC_CONFIG_HEADERS([config.h])
f3e98bba 6AC_CONFIG_MACRO_DIR([.])
e70c902e
DB
7
8# Support silent build rules. Disable by either passing --disable-silent-rules
9# to configure or passing V=1 to make
10AM_SILENT_RULES([yes])
11
d08e9a0e 12AM_MAINTAINER_MODE([enable])
e96a0ec2 13
e70c902e
DB
14# Init intltool
15IT_PROG_INTLTOOL
16
d08e9a0e 17AC_SEARCH_LIBS([strerror],[cposix])
e96a0ec2
DB
18AC_PROG_CC
19AM_PROG_CC_STDC
20AC_HEADER_STDC
d08e9a0e 21AM_PROG_CC_C_O
e96a0ec2 22
d5f1e565 23AC_ARG_ENABLE(man,
d08e9a0e 24 [AS_HELP_STRING([--enable-man],[regenerate roff man pages from Docbook @<:@default=no@:>@])],
d5f1e565
DB
25 [enable_man="${enableval}"],
26 [enable_man=no]
27)
28
e70c902e 29AC_ARG_ENABLE(more_warnings,
d08e9a0e 30 [AS_HELP_STRING([--enable-more-warnings],[Add more warnings @<:@default=no@:>@])],
e70c902e
DB
31 [enable_more_warnings="${enableval}"],
32 [enable_more_warnings=no]
33)
34
35AC_ARG_ENABLE(gtk3,
d08e9a0e 36AS_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
e70c902e
DB
37[case "${enableval}" in
38 yes) enable_gtk3=yes ;;
39 no) enable_gtk3=no ;;
40 *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
41esac],[])
42
43if test "x$enable_gtk3" = "xyes" ; then
44 CFLAGS="$CFLAGS -DENABLE_GTK3"
45 gtk_modules="gtk+-3.0 >= 3.0.0"
46else
47 gtk_modules="gtk+-2.0 >= 2.0.0"
48fi
49PKG_CHECK_MODULES(GTK, [$gtk_modules])
e96a0ec2
DB
50AC_SUBST(GTK_CFLAGS)
51AC_SUBST(GTK_LIBS)
52
e70c902e
DB
53if test x"$enable_more_warnings" = x"yes"; then
54 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"
55fi
56AC_SUBST(ADDITIONAL_FLAGS)
57
e96a0ec2
DB
58GETTEXT_PACKAGE=lxrandr
59AC_SUBST(GETTEXT_PACKAGE)
60AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
61
e70c902e
DB
62# Generate po/LINGUAS on the fly rather than relying on translators
63# to maintain it manually. This also overcome the problem that Transifex
64# cannot add a language to po/LINGUAS if a new po file is submitted.
65rm -f $srcdir/po/LINGUAS
66for po_file in `ls $srcdir/po/*.po | sort`;
67do
68 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
69 echo $lang >> $srcdir/po/LINGUAS
70done
71
e96a0ec2
DB
72AM_GLIB_GNU_GETTEXT
73
d5f1e565
DB
74if test x"$enable_man" = x"yes"; then
75 AC_PATH_PROG([XSLTPROC], [xsltproc])
76 if test -z "$XSLTPROC"; then
77 enable_man=no
78 fi
79
80 dnl check for DocBook DTD and stylesheets in the local catalog.
81 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
82 [DocBook XML DTD V4.1.2], [], enable_man=no)
83 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
84 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
85fi
86
87AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
88
f3e98bba
AG
89AC_ARG_ENABLE(debug,
90 [AC_HELP_STRING([--enable-debug],
91 [build lxrandr with debug support @<:@default=no@:>@])],
92 [enable_debug="${enableval}"],
93 [enable_debug=no]
94)
95
96if test "$enable_debug" = "yes"; then
97 # turn on debug and disable optimization
98 CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
99 case "$CC" in
100 gcc*)
101 CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers"
102 ;;
103 *)
104 ;;
105 esac
106 dnl Be more strict on portability
107 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
108else
109 # turn off glib debug checks
110 CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
111fi
112
d08e9a0e 113AC_CONFIG_FILES([
e96a0ec2
DB
114Makefile
115src/Makefile
116po/Makefile.in
cdce278f 117data/Makefile
e96a0ec2 118])
d08e9a0e 119AC_OUTPUT