Removing wrong dependency on libfm-gtk-bin.
[debian/pcmanfm.git] / configure.ac
CommitLineData
92978c90
DB
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.63])
f411d8c9 5AC_INIT([pcmanfm], [1.1.1], [http://pcmanfm.sf.net/])
92978c90
DB
6AM_INIT_AUTOMAKE([-Wall -Werror foreign])
7
8AC_CONFIG_HEADERS([config.h])
9
10# Checks for programs.
11AC_ISC_POSIX
12AC_PROG_CC
4c02b03d 13AM_PROG_CC_C_O
92978c90
DB
14
15# Checks for header files.
16AC_HEADER_STDC
17
18# Checks for typedefs, structures, and compiler characteristics.
19
20# Checks for library functions.
f411d8c9 21AC_SEARCH_LIBS([floor], [m])
92978c90
DB
22
23# Large file support
24AC_ARG_ENABLE([largefile],
25 AS_HELP_STRING([--enable-largefile],
26 [enable Large file support (default: yes)]),
27 largefile=$enableval, largefile="yes")
28
29if test x"$largefile" = x"yes"; then
30 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64"
31 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
32 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
33fi
34
35AC_ARG_ENABLE(
36 [cast-checks],
37 AS_HELP_STRING([--enable-cast-checks],
38 [enable Glib casting checks (default: disable)]),
39 cast_checks=$enableval, cast_checks="no")
92978c90
DB
40
41AC_ARG_ENABLE(debug,
737b76cc
DB
42 [AC_HELP_STRING([--enable-debug],
43 [build pcmanfm with debug support @<:@default=no@:>@])],
44 [enable_debug="${enableval}"],
f411d8c9
AG
45 [enable_debug=no])
46
92978c90
DB
47if test "$enable_debug" = "yes"; then
48 # turn on debug and disable optimization
49 CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
4c02b03d
DB
50 case "$CC" in
51 gcc*)
52 CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers"
53 ;;
54 *)
55 ;;
56 esac
f411d8c9
AG
57 dnl Be more strict on compatibility
58 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
59 dnl debug should enforce cast checks
60 cast_checks=yes
92978c90
DB
61else
62 # turn off glib debug checks
63 # G_DISABLE_CAST_CHECKS is already handled by $(G_CAST_CHECKS)
64 CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
65fi
66
f411d8c9
AG
67G_CAST_CHECKS=""
68if test x"$cast_checks" = "xno"; then
69 G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
70fi
71AC_SUBST(G_CAST_CHECKS)
72
92978c90
DB
73# intltool
74IT_PROG_INTLTOOL([0.40.0])
75
f411d8c9
AG
76dnl libgtk version
77AC_ARG_WITH(gtk,
78 [AC_HELP_STRING([--with-gtk=VER],
79 [choose Gtk+ version for libfm-gtk build (default=2)])],
80 [ac_with_gtk="${withval}"],
81 [ac_with_gtk=2])
82
92978c90
DB
83# Checks for libraries.
84
85PKG_CHECK_MODULES(XLIB, "x11")
86AC_SUBST(XLIB_CFLAGS)
87AC_SUBST(XLIB_LIBS)
88
7868df51 89gio_modules="gthread-2.0 gio-unix-2.0 >= 2.18.0"
92978c90
DB
90PKG_CHECK_MODULES(GIO, [$gio_modules])
91AC_SUBST(GIO_CFLAGS)
92AC_SUBST(GIO_LIBS)
93
f411d8c9
AG
94fm_modules="$gio_modules glib-2.0 pango >= 1.20.0 libfm >= 1.0"
95case "$ac_with_gtk" in
96 3|3.*)
97 fm_modules="$fm_modules gtk+-3.0 libfm-gtk3 >= 1.0.1"
98 ;;
99 *)
100 fm_modules="$fm_modules gtk+-2.0 libfm-gtk >= 1.0.1"
101 ;;
102esac
92978c90
DB
103PKG_CHECK_MODULES(FM, [$fm_modules])
104AC_SUBST(FM_CFLAGS)
105AC_SUBST(FM_LIBS)
106
55e66dba 107GETTEXT_PACKAGE=pcmanfm
92978c90
DB
108AC_SUBST(GETTEXT_PACKAGE)
109
110# Generate po/LINGUAS on the fly rather than relying on translators
111# to maintain it manually. This also overcome the problem that Transifex
112# cannot add a language to po/LINGUAS if a new po file is submitted.
113rm -f $srcdir/po/LINGUAS
114for po_file in `ls $srcdir/po/*.po | sort`;
115do
116 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
117 echo $lang >> $srcdir/po/LINGUAS
118done
119
120AM_GLIB_GNU_GETTEXT
121AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
122
f411d8c9
AG
123dnl Fix invalid sysconfdir when --prefix=/usr
124if test `eval "echo $sysconfdir"` = /usr/etc
125then
126 sysconfdir=/etc
127fi
128
92978c90
DB
129AC_CONFIG_FILES([
130 Makefile
131 src/Makefile
132 po/Makefile.in
133 data/Makefile
4c02b03d 134 data/pcmanfm.1
92978c90
DB
135 data/ui/Makefile
136 data/ui/about.glade
92978c90
DB
137])
138
139AC_OUTPUT
140
141echo Ready to make pcmanfm