Automatic translation update from Pootle
[lxde/lxhotkey.git] / configure.ac
1 AC_PREREQ(2.53)
2 AC_INIT(lxhotkey, 0.1.0, http://lxde.org/)
3 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects no-dist-gzip dist-xz])
4 AC_CONFIG_HEADER([config.h])
5 AC_CONFIG_MACRO_DIR([m4])
6
7 # Support silent build rules. Disable by either passing --disable-silent-rules
8 # to configure or passing V=1 to make
9 AM_SILENT_RULES([yes])
10
11 # Force to dynamic
12 AC_DISABLE_STATIC
13
14 # Checks for programs.
15 AC_PROG_CC
16 AC_PROG_INSTALL
17 AC_PROG_LN_S
18 IT_PROG_INTLTOOL([0.40.0], [no-xml])
19 AM_PROG_CC_C_O
20 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
21
22 # Initialize libtool
23 LT_PREREQ([2.2])
24 LT_INIT
25
26 # International support
27 GETTEXT_PACKAGE=lxhotkey
28 AC_SUBST(GETTEXT_PACKAGE)
29 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
30
31 AM_GLIB_GNU_GETTEXT
32
33 # Generate po/LINGUAS for available PO files
34 rm -f $srcdir/po/LINGUAS
35 for po_file in `ls $srcdir/po/*.po | sort`;
36 do
37     lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
38     echo $lang >> $srcdir/po/LINGUAS
39 done
40
41 # Handle --enable-debug option
42 AC_ARG_ENABLE(debug,
43     [AC_HELP_STRING([--enable-debug],
44         [enable debug support @<:@default=no@:>@])],
45     [enable_debug="${enableval}"],
46     [enable_debug=no]
47 )
48 if test "$enable_debug" = "yes"; then
49     # turn on debug and disable optimization
50     CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
51     case "$CC" in
52     gcc*)
53         CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
54         ;;
55     *)
56         ;;
57     esac
58     dnl Be more strict on portability
59     #CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
60 else
61     # turn off glib debug checks
62     CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
63 fi
64
65 dnl Test for required libraries
66 pkg_modules="libfm >= 1.2.0 x11"
67 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
68 AC_SUBST(PACKAGE_CFLAGS)
69 AC_SUBST(PACKAGE_LIBS)
70
71 dnl GTK+ stuff
72 AC_ARG_WITH(gtk,
73     [AC_HELP_STRING([--with-gtk=VER],
74         [build 'gtk' GUI, choose GTK+ version for build])
75 AC_HELP_STRING([--without-gtk],
76         [disable 'gtk' GUI build @<:@default@:>@])],
77     [ac_with_gtk="${withval}"],
78     [ac_with_gtk=no]
79 )
80
81 if test x"$ac_with_gtk" != xno; then
82   case "$ac_with_gtk" in
83     3|3.*)
84       pkg_modules="gtk+-3.0"
85       ;;
86     *)
87       pkg_modules="gtk+-2.0 >= 2.18.0"
88       ;;
89   esac
90   PKG_CHECK_MODULES(GTK, [$pkg_modules], [with_gtk=yes], [with_gtk=no])
91 fi
92 AM_CONDITIONAL(WITH_GTK, [test x$with_gtk = xyes])
93 AC_SUBST(GTK_CFLAGS)
94 AC_SUBST(GTK_LIBS)
95
96 dnl Test for libunistring for correct UTF-8 printf
97 AC_CHECK_LIB(unistring, ulc_fprintf)
98
99 dnl Supress extra linking
100 AC_MSG_CHECKING([whether $LD accepts --as-needed])
101 case `$LD --as-needed -v 2>&1 </dev/null` in
102 *GNU* | *'with BFD'*)
103     LDFLAGS="$LDFLAGS -Wl,--as-needed"
104     AC_MSG_RESULT([yes])
105     ;;
106 *)
107     AC_MSG_RESULT([no])
108     ;;
109 esac
110
111 dnl Fix invalid sysconfdir when --prefix=/usr
112 if test `eval "echo $sysconfdir"` = /usr/etc
113 then
114     sysconfdir=/etc
115 fi
116
117 dnl Finish all
118 AC_CONFIG_FILES([
119     Makefile
120     lxhotkey.pc
121     src/Makefile
122     plugins/Makefile
123     po/Makefile.in
124     man/lxhotkey.1
125 ])
126 AC_OUTPUT