r4716: Fixes for the filter directories option: Initialize properly, inherit from
[rox-filer.git] / ROX-Filer / src / configure.in
blob4d654a5e5ba866d57256bac28233c10ac730ca00
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(main.c)
3 AC_CONFIG_HEADER(config.h)
5 [ if [ -f configure ]; then ]
6         AC_MSG_ERROR([Please run configure from the build directory (try ../AppRun --compile)])
7         exit 1
8 fi
10 dnl Checks for programs.
11 AC_PROG_CC
13 dnl Use -Wall, etc if possible
14 dnl Note: GTK uses func(), so can't use -Wstrict-prototypes 
16 if test "x$GCC" = "xyes"; then
17   CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
19   AC_MSG_CHECKING(for GCC version 4)
20 [ if $CC --version | grep "(GCC) 4" > /dev/null; then ]
21     AC_MSG_RESULT(yes)
22     [ CFLAGS="$CFLAGS -Wno-pointer-sign" ]
23   else
24     AC_MSG_RESULT(no)
25   fi
28 if test -z "$PKG_CONFIG"; then
29   PKG_CONFIG=pkg-config
31 AC_SUBST(PKG_CONFIG)
33 AC_MSG_CHECKING(that pkg-config runs)
34 if "$PKG_CONFIG" --version > /dev/null 2>&1 ; then
35   AC_MSG_RESULT(yes)
36 else
37   AC_MSG_RESULT(no)
38   AC_MSG_ERROR([*** $PKG_CONFIG missing ***
40 \'$PKG_CONFIG --version\' failed to run - make sure it is inside one of the
41 directories in your PATH environment variable!
43 pkg-config comes with the developement packages for GTK+-2.4, available at:
45     http://www.gtk.org])
48 AC_DEFUN(ROX_REQUIRE, [
49 AC_MSG_CHECKING(that $1 (version >= $2) is installed)
50 if "$PKG_CONFIG" --atleast-version=$2 $1 ; then
51   AC_MSG_RESULT(yes)
52 else
53   AC_MSG_RESULT(no)
54   if "$PKG_CONFIG" --exists $1 ; then
55     AC_MSG_ERROR(Current version is only `"$PKG_CONFIG" "$1" --modversion`)
56   else
57     AC_MSG_ERROR(Package is not installed)
58   fi
62 ROX_REQUIRE(gtk+-2.0, 2.4.0)
63 ROX_REQUIRE(libxml-2.0, 2.0.0)
64 ROX_REQUIRE(shared-mime-info, 0.14)
66 GTK_VERSION=`"$PKG_CONFIG" --modversion gtk+-2.0`
67 AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION")
69 AC_MSG_CHECKING(if pango (version >= 1.1.2) is installed)
70 if "$PKG_CONFIG" --atleast-version=1.1.2 pango ; then
71   AC_DEFINE(USE_PANGO_WRAP_WORD_CHAR)
72   AC_MSG_RESULT(yes; enabling better wrapping)
73 else
74   AC_MSG_RESULT(no; better wrapping not enabled)
77 dnl Find the X libraries
78 AC_PATH_XTRA
79 if test x$no_x = xyes ; then
80   AC_MSG_ERROR([X development libraries not found])
82 LIBS="$LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
83 CFLAGS="$CFLAGS $X_CFLAGS"
85 dnl Does file(1) support '-b' ?
86 AC_MSG_CHECKING(whether file -b works)
87 if file -b / > /dev/null 2> /dev/null
88 then
89   AC_DEFINE(FILE_B_FLAG)
90   AC_MSG_RESULT(yes)
91 else
92   AC_MSG_RESULT(no)
95 AC_MSG_CHECKING(for large file support)
96 case "$with_platform" in
97 OpenBSD*)
98   AC_MSG_RESULT(yes)
99   AC_DEFINE(LARGE_FILE_SUPPORT)
100   ;;
101 FreeBSD*)
102   AC_MSG_RESULT(yes)
103   AC_DEFINE(LARGE_FILE_SUPPORT)
104   ;;
106   if getconf LFS64_CFLAGS > /dev/null 2> /dev/null; then
107     AC_MSG_RESULT(yes)
108     LFS_CFLAGS="`getconf LFS_CFLAGS`"
109     LFS_LDFLAGS="`getconf LFS_LDFLAGS`"
110     LFS_LIBS="`getconf LFS_LIBS`"
111     AC_DEFINE(LARGE_FILE_SUPPORT)
112   else
113     AC_MSG_RESULT(no)
114     LFS_CFLAGS=""
115     LFS_LDFLAGS=""
116     LFS_LIBS=""
117   fi
118   ;;
119 esac
121 AC_SUBST(LFS_CFLAGS)
122 AC_SUBST(LFS_LDFLAGS)
123 AC_SUBST(LFS_LIBS)
125 dnl Checks for header files.
126 AC_HEADER_DIRENT
127 AC_HEADER_STDC
128 AC_HEADER_SYS_WAIT
129 AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h mntent.h sys/ucred.h sys/mntent.h apsymbols.h apbuild/apsymbols.h sys/statvfs.h sys/vfs.h wctype.h)
131 AC_CHECK_HEADER([X11/SM/SMlib.h], [],
132   [AC_MSG_ERROR([Session management library (libsm) missing. It is part of the X server distribution. Try installing the libsm-dev package.])]
135 dnl Checks for typedefs, structures, and compiler characteristics.
136 AC_C_CONST
137 AC_TYPE_UID_T
138 AC_TYPE_SIZE_T
140 dnl Checks for library functions.
141 AC_CHECK_FUNCS(gethostname unsetenv mkdir rmdir strdup strtol statvfs statfs mbrtowc)
143 dnl getopt_long may be in an addtional library
144 AC_CHECK_LIB(gnugetopt, getopt_long)
145 AC_CHECK_FUNCS(getopt_long)
147 dnl Check for extended attribute support
148 AC_CHECK_FUNCS(attropen getxattr)
149 AC_CHECK_HEADERS(attr/xattr.h sys/xattr.h)
151 dnl Extract version info from AppInfo.xml
152 AC_MSG_CHECKING(extracting version information)
154 VERSION=`sed -n 's/^.*<Version>\([.0-9]*\).*<\/Version>.*$/\1/p' ../AppInfo.xml`
156 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
157 AC_MSG_RESULT(version $VERSION)
159 AC_OUTPUT(Makefile)