da8b633fcc42c458904b1cd5419706accd8feb61
[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([-Wall -Werror foreign])
9
10 AC_CONFIG_HEADERS([config.h])
11
12 # Checks for programs.
13 AC_PROG_CC
14 # AM_PROG_LIBTOOL
15
16 # Checks for libraries.
17
18 # Checks for header files.
19 AC_HEADER_STDC
20
21 # Checks for typedefs, structures, and compiler characteristics.
22
23 # Checks for library functions.
24
25 # intltool
26 IT_PROG_INTLTOOL([0.40.0])
27
28 AC_ARG_ENABLE(man,
29        [AC_HELP_STRING([--enable-man],
30                [regenerate roff man pages from Docbook @<:@default=no@:>@])],
31        [enable_man="${enableval}"],
32        [enable_man=no]
33 )
34
35 PKG_CHECK_MODULES(XLIB, "x11")
36 AC_SUBST(XLIB_CFLAGS)
37 AC_SUBST(XLIB_LIBS)
38
39 gtk_modules="gtk+-2.0 >= 2.12.0 gthread-2.0"
40 PKG_CHECK_MODULES(GTK, [$gtk_modules])
41 AC_SUBST(GTK_CFLAGS)
42 AC_SUBST(GTK_LIBS)
43
44 gmodule_modules="gmodule-export-2.0"
45 PKG_CHECK_MODULES(GMODULE, [$gmodule_modules])
46 AC_SUBST(GMODULE_CFLAGS)
47 AC_SUBST(GMODULE_LIBS)
48
49 # gio_modules="gthread-2.0 gio-unix-2.0 glib-2.0 >= 2.18.0"
50 # PKG_CHECK_MODULES(GIO, [$gio_modules])
51 # AC_SUBST(GIO_CFLAGS)
52 # AC_SUBST(GIO_LIBS)
53
54 # menu_modules="libmenu-cache >= 0.3.2"
55 # PKG_CHECK_MODULES(MENU_CACHE, [$menu_modules])
56 # AC_SUBST(MENU_CACHE_CFLAGS)
57 # AC_SUBST(MENU_CACHE_LIBS)
58
59 AC_ARG_ENABLE(man,
60        [AC_HELP_STRING([--enable-man],
61                [regenerate roff man pages from Docbook @<:@default=no@:>@])],
62        [enable_man="${enableval}"],
63        [enable_man=no]
64 )
65
66 if test "$enable_debug" = "yes"; then
67     # turn on debug and disable optimization
68     CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
69 else
70     # turn off glib debug checks
71     CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
72 fi
73
74 # Generate po/LINGUAS on the fly rather than relying on translators
75 # to maintain it manually. This also overcome the problem that Transifex
76 # cannot add a language to po/LINGUAS if a new po file is submitted.
77 rm -f $srcdir/po/LINGUAS
78 for po_file in `ls $srcdir/po/*.po | sort`;
79 do
80     lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
81     echo $lang >> $srcdir/po/LINGUAS
82 done
83
84 GETTEXT_PACKAGE=lxappearance
85 AC_SUBST(GETTEXT_PACKAGE)
86 AM_GLIB_GNU_GETTEXT
87 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
88
89 if test x"$enable_man" = x"yes"; then
90         AC_PATH_PROG([XSLTPROC], [xsltproc])
91         if test -z "$XSLTPROC"; then
92                 enable_man=no
93         fi
94
95         dnl check for DocBook DTD and stylesheets in the local catalog.
96         JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
97                 [DocBook XML DTD V4.1.2], [], enable_man=no)
98         JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
99                 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
100 fi
101
102 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
103
104 AC_CONFIG_FILES([
105     Makefile
106     src/Makefile
107     data/Makefile
108     data/ui/Makefile
109     data/ui/about.glade
110     data/lxappearance.pc
111     man/Makefile
112     po/Makefile.in
113 ])
114
115 AC_OUTPUT
116
117 if test x"$sysconfdir" != x'/etc'; then
118     echo
119     echo
120     echo 'Error: sysconfdir is not /etc.'
121     echo 'Please consider passing --sysconfdir=/etc to configure.';
122     echo 'Otherwise default config files will be installed to wrong place.'
123     echo
124     echo
125 else
126     echo
127     echo lxappearance....................... : Version $VERSION
128     echo
129     echo Enable debug....................: "$enable_debug"
130     echo Prefix..........................: $prefix
131     echo
132     echo The binary will be installed in $prefix/bin
133     echo
134     echo http://lxde.org/
135     echo
136     echo "Ready to make lxappearance. Type 'make' to continue."
137     echo
138 fi