1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_HEADER(config.h)
6 [ --with-platform platform name, as detected by AppRun],
7 [AC_SUBST(with_platform)],
11 Please do not run 'configure' manually - instead, run the AppRun script with
12 the --compile option, like this:
13 $ ROX-Filer/AppRun --compile
20 [ --with-gtk2 Use Gtk+-2.0 API instead of Gtk+-1.2], gtk2=1, gtk2=0)
23 dnl rox_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
24 dnl This macro does the same thing as AC_ARG_WITH, but it also defines
25 dnl with_PACKAGE_arg and with_PACKAGE_sign to avoid complicated logic later.
26 dnl Stolen from icewm's configure.in
27 AC_DEFUN(rox_ARG_WITH, [
28 AC_ARG_WITH([$1], [$2], [
29 case "[${with_]patsubst([$1], -, _)}" in
31 [with_]patsubst([$1], -, _)_sign=no
34 [with_]patsubst([$1], -, _)_sign=yes
37 [with_]patsubst([$1], -, _)_arg="[${with_]patsubst([$1], -, _)}"
38 [with_]patsubst([$1], -, _)_sign=yes
44 dnl rox_CHECK_EXISTS(PROGRAM, ERROR)
45 dnl Ensure that PROGRAM --version works.
46 dnl Stops and displays ERROR if it's missing.
47 AC_DEFUN(rox_CHECK_EXISTS, [
48 AC_MSG_CHECKING(that $1 runs)
49 if "$1" --version > /dev/null 2>&1 ; then
53 AC_MSG_ERROR([*** Missing program ***
55 $1 failed to run - make sure it is inside one of the
56 directories in your PATH environment variable!
62 dnl Checks for programs.
65 dnl Use -Wall if possible
67 if test "x$GCC" = "xyes"; then
69 *[\ \ ]-Wall[\ \ ]*) ;;
70 *) CFLAGS="$CFLAGS -Wall" ;;
75 if test -z "$PKG_CONFIG"; then
80 if test -z "$XML_CONFIG"; then
81 AC_CHECK_PROG(XML_CONFIG, xml2-config, xml2-config, xml-config)
85 if test -z "$GTK_CONFIG"; then
89 dnl See if we've got Gtk+ 2.0 (or 1.3 developement version)
90 dnl AC_MSG_CHECKING(for Gtk+-1.3.13 or later)
92 dnl if $PKG_CONFIG "--atleast-version=1.3.13" "gtk+-2.0"; then
94 if test "$gtk2" = "1"; then
95 dnl AC_MSG_RESULT(yes)
96 AC_MSG_WARN([Using EXPERIMENTAL Gtk+-2.0 API])
99 GTK_CFLAGS="$PKG_CONFIG gtk+-2.0 --cflags"
100 GTK_LIBS="$PKG_CONFIG gtk+-2.0 --libs"
101 GDK_PIXBUF_LIBS=`$PKG_CONFIG gdk-pixbuf-2.0 --libs`
102 GDK_PIXBUF_CFLAGS=`$PKG_CONFIG gdk-pixbuf-2.0 --cflags`
104 dnl AC_MSG_RESULT(no)
106 GTK_CFLAGS="$GTK_CONFIG --cflags"
107 GTK_LIBS="$GTK_CONFIG --libs"
109 dnl Warn the user if stuff is missing...
110 rox_CHECK_EXISTS([$GTK_CONFIG],
111 [You need to install the gtk-devel package before compiling:
114 dnl Make sure we have gdk-pixbuf
115 AC_MSG_CHECKING(for gdk-pixbuf library)
116 if test -z "$GDK_PIXBUF_CONFIG"; then
117 GDK_PIXBUF_CONFIG=gdk-pixbuf-config
119 GDK_PIXBUF_CFLAGS=`$GDK_PIXBUF_CONFIG --cflags`
120 GDK_PIXBUF_LIBS=`$GDK_PIXBUF_CONFIG --libs`
122 if [ -n "$GDK_PIXBUF_LIBS" ]; then
124 AC_MSG_RESULT(yes - use '$GDK_PIXBUF_LIBS')
126 AC_MSG_ERROR(can't run '$GDK_PIXBUF_CONFIG --libs' - make sure it is in your PATH)
131 AC_SUBST(GDK_PIXBUF_CFLAGS)
132 AC_SUBST(GDK_PIXBUF_LIBS)
134 rox_CHECK_EXISTS([$XML_CONFIG],
135 [You need to install the xml-devel package before compiling:
136 http://xmlsoft.org/])
138 dnl Does file(1) support '-b' ?
139 AC_MSG_CHECKING(whether file -b works)
140 if file -b / > /dev/null 2> /dev/null
142 AC_DEFINE(FILE_B_FLAG)
148 AC_MSG_CHECKING(for large file support)
149 if getconf LFS64_CFLAGS > /dev/null 2> /dev/null; then
151 LFS_CFLAGS="`getconf LFS_CFLAGS`"
152 LFS_LDFLAGS="`getconf LFS_LDFLAGS`"
153 LFS_LIBS="`getconf LFS_LIBS`"
155 AC_DEFINE(LARGE_FILE_SUPPORT)
164 AC_SUBST(LFS_LDFLAGS)
167 dnl Checks for header files.
172 AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h mntent.h sys/ucred.h sys/mntent.h)
173 AC_CHECK_HEADERS(regex.h iconv.h)
176 [ --with-vfs[=prefix] use libvfs for virtual file system [search it in prefix/include and prefix/lib]])
178 dnl Checks for typedefs, structures, and compiler characteristics.
183 dnl Checks for library functions.
184 AC_CHECK_FUNCS(gethostname unsetenv mkdir rmdir strdup strtol getopt_long)
188 if test "$disable_vfs" != "yes" ; then
189 AC_MSG_CHECKING(for vfs library)
190 if test x"$with_vfs_sign" = xyes; then
191 if test x"$with_vfs_arg" != x; then
192 vfs_includes="-I${with_vfs_arg}/include"
193 vfs_libs="-L${with_vfs_arg}/lib -R${with_vfs_arg}/lib"
194 AC_MSG_RESULT(yes - use '$vfs_libs')
200 CFLAGS="$CFLAGS $vfs_includes"
201 LDFLAGS="$LDFLAGS $vfs_libs"
202 VFS_CFLAGS="$vfs_includes"
211 dnl Extract version info from AppInfo.xml
212 AC_MSG_CHECKING(extracting version information)
214 VERSION=`sed -n 's/^.*<Version>\([.0-9]*\).*<\/Version>.*$/\1/p' ../AppInfo.xml`
216 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
217 AC_MSG_RESULT(version $VERSION)
219 dnl Check for the Midnight Commander VFS library
220 if test "$disable_vfs" != "yes" ; then
221 AC_CHECK_LIB(vfs, mc_stat, , , `$GTK_CONFIG --libs`)
226 if test "$gtk2" != "1" ; then
227 AC_CHECK_LIB(png, png_read_info,
228 AC_TRY_CPP([#include <png.h>], png=yes, png=no),
231 if test "$png" = "yes" ; then
232 AC_MSG_CHECKING([if libpng version is >= 1.0.1])
234 LIBS="$LIBS -lpng -lz -lm"
238 int main(int argc, char **argv)
240 #ifdef PNG_LIBPNG_VER
241 if (PNG_LIBPNG_VER >= 10001)
249 ], png=yes, png=no, png=no)
252 if test "$png" = "yes" ; then
253 LIBPNG="-lpng -lz -lm"
254 AC_DEFINE(HAVE_LIBPNG)