1 dnl Process this file with autoconf to produce a configure script.
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)])
10 dnl Checks for programs.
13 dnl Use -Wall, etc if possible
14 dnl Note: GTK uses func(), so can't use -Wstrict-prototypes
15 dnl -fno-stack-protector must be used to avoid GLIBC2.4 dependency,
16 dnl but is only available from 4.1 onwards
18 if test "x$GCC" = "xyes"; then
19 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
21 AC_MSG_CHECKING(for GCC version)
22 if $CC --version | grep -i gcc > /dev/null; then
24 ver=`$CC --version | head -1 | sed -e 's/.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][-_0-9a-zA-Z]*\).*/\1/'`
26 major=`echo $ver | cut -d"." -f 1`
27 minor=`echo $ver | cut -d"." -f 2`
36 if test "$minor" -ge 1 ; then gcc_stack=yes; else gcc_stack=no; fi ;;
45 AC_MSG_CHECKING(whether to disable pointer sign warning)
46 if test "$gcc_pointer" = yes ; then
48 CFLAGS="$CFLAGS -Wno-pointer-sign"
52 AC_MSG_CHECKING(whether to disable stack protector)
53 if test "$gcc_stack" = yes ; then
55 CFLAGS="$CFLAGS -fno-stack-protector"
62 if test -z "$PKG_CONFIG"; then
67 AC_MSG_CHECKING(that pkg-config runs)
68 if "$PKG_CONFIG" --version > /dev/null 2>&1 ; then
72 AC_MSG_ERROR([*** $PKG_CONFIG missing ***
74 \'$PKG_CONFIG --version\' failed to run - make sure it is inside one of the
75 directories in your PATH environment variable!
77 pkg-config comes with the developement packages for GTK+-2.4, available at:
82 AC_DEFUN(ROX_REQUIRE, [
83 AC_MSG_CHECKING(that $1 (version >= $2) is installed)
84 if "$PKG_CONFIG" --atleast-version=$2 $1 ; then
88 if "$PKG_CONFIG" --exists $1 ; then
89 AC_MSG_ERROR(Current version is only `"$PKG_CONFIG" "$1" --modversion`)
91 AC_MSG_ERROR(Package is not installed)
97 ROX_REQUIRE(gtk+-2.0, 2.12.0)
98 ROX_REQUIRE(libxml-2.0, 2.0.0)
99 ROX_REQUIRE(shared-mime-info, 0.14)
101 GTK_VERSION=`"$PKG_CONFIG" --modversion gtk+-2.0`
102 AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION")
104 AC_MSG_CHECKING(if pango (version >= 1.1.2) is installed)
105 if "$PKG_CONFIG" --atleast-version=1.1.2 pango ; then
106 AC_DEFINE(USE_PANGO_WRAP_WORD_CHAR)
107 AC_MSG_RESULT(yes; enabling better wrapping)
109 AC_MSG_RESULT(no; better wrapping not enabled)
112 dnl Find the X libraries
114 if test x$no_x = xyes ; then
115 AC_MSG_ERROR([X development libraries not found])
117 LIBS="$LIBS $X_LIBS -lX11 -lm $X_EXTRA_LIBS"
118 CFLAGS="$CFLAGS $X_CFLAGS"
120 dnl Does file(1) support '-b' ?
121 AC_MSG_CHECKING(whether file -b works)
122 if file -b / > /dev/null 2> /dev/null
124 AC_DEFINE(FILE_B_FLAG)
130 AC_MSG_CHECKING(for large file support)
134 AC_DEFINE(LARGE_FILE_SUPPORT)
138 AC_DEFINE(LARGE_FILE_SUPPORT)
141 if getconf LFS64_CFLAGS > /dev/null 2> /dev/null; then
143 LFS_CFLAGS="`getconf LFS_CFLAGS`"
144 LFS_LDFLAGS="`getconf LFS_LDFLAGS`"
145 LFS_LIBS="`getconf LFS_LIBS`"
146 AC_DEFINE(LARGE_FILE_SUPPORT)
157 AC_SUBST(LFS_LDFLAGS)
160 dnl Checks for header files.
164 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 libintl.h sys/inotify.h)
166 dnl Checks for typedefs, structures, and compiler characteristics.
171 dnl Checks for library functions.
172 AC_CHECK_FUNCS(gethostname unsetenv mkdir rmdir strdup strtol statvfs statfs mbrtowc)
173 dnl Math functions and dlsym() could be defined outside the standard C library
174 AC_CHECK_LIB(m, floor)
175 AC_CHECK_LIB(dl, dlsym)
176 dnl Since we're using libintl.h, check if libintl needs to be linked in
177 AC_CHECK_LIB(intl, gettext)
179 dnl getopt_long may be in an addtional library
180 AC_CHECK_LIB(gnugetopt, getopt_long)
181 AC_CHECK_FUNCS(getopt_long)
183 dnl Check for extended attribute support
184 AC_CHECK_FUNCS(attropen getxattr)
185 AC_CHECK_HEADERS(attr/xattr.h sys/xattr.h)
187 dnl Extract version info from AppInfo.xml
188 AC_MSG_CHECKING(extracting version information)
190 VERSION=`sed -n 's/^.*<Version>\([.0-9]*\).*<\/Version>.*$/\1/p' ${srcdir}/../AppInfo.xml`
192 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
193 AC_MSG_RESULT(version $VERSION)