r940: Updated to Gtk+-1.3.11.
[rox-filer.git] / ROX-Filer / src / configure.in
blobac335239f7e931daf0dc79466f1f1aabc88fb106
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(main.c)
3 AC_CONFIG_HEADER(config.h)
5 AC_ARG_WITH(platform,
6 [  --with-platform        platform name, as detected by AppRun],
7 [AC_SUBST(with_platform)],
9 AC_MSG_ERROR([
11 Please do not run 'configure' manually - instead, run the AppRun script with
12 the --compile option, like this:
13         $ ROX-Filer/AppRun --compile
15 Thank you.
19 dnl rox_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
20 dnl This macro does the same thing as AC_ARG_WITH, but it also defines
21 dnl with_PACKAGE_arg and with_PACKAGE_sign to avoid complicated logic later.
22 dnl Stolen from icewm's configure.in
23 AC_DEFUN(rox_ARG_WITH, [
24 AC_ARG_WITH([$1], [$2], [
25 case "[${with_]patsubst([$1], -, _)}" in
26 [no)]
27  [with_]patsubst([$1], -, _)_sign=no
28  ;;
29 [yes)]
30  [with_]patsubst([$1], -, _)_sign=yes
31  ;;
32 [*)] 
33  [with_]patsubst([$1], -, _)_arg="[${with_]patsubst([$1], -, _)}"
34  [with_]patsubst([$1], -, _)_sign=yes
35  ;;
36 esac
38 ], [$4])])
40 dnl rox_CHECK_EXISTS(PROGRAM, ERROR)
41 dnl Ensure that PROGRAM --version works.
42 dnl Stops and displays ERROR if it's missing.
43 AC_DEFUN(rox_CHECK_EXISTS, [
44 AC_MSG_CHECKING(that $1 runs)
45 if "$1" --version > /dev/null 2>&1 ; then
46   AC_MSG_RESULT(yes)
47 else
48   AC_MSG_RESULT(no)
49   AC_MSG_ERROR([*** Missing program ***
51 $1 failed to run - make sure it is inside one of the
52 directories in your PATH environment variable!
54 $2)
58 dnl Checks for programs.
59 AC_PROG_CC
61 dnl Use -Wall if possible
63 if test "x$GCC" = "xyes"; then
64   case " $CFLAGS " in
65   *[\ \ ]-Wall[\ \      ]*) ;;
66   *) CFLAGS="$CFLAGS -Wall" ;;
67   esac
71 if test -z "$PKG_CONFIG"; then
72   PKG_CONFIG=pkg-config
74 AC_SUBST(PKG_CONFIG)
76 if test -z "$XML_CONFIG"; then
77   AC_CHECK_PROG(XML_CONFIG, xml2-config, xml2-config, xml-config)
79 AC_SUBST(XML_CONFIG)
81 if test -z "$GTK_CONFIG"; then
82   GTK_CONFIG=gtk-config
85 dnl See if we've got Gtk+ 2.0 (or 1.3 developement version)
86 AC_MSG_CHECKING(for Gtk+-2.0)
87 if $PKG_CONFIG "--atleast-version=1.3.11" "gtk+-2.0"; then
88   AC_MSG_RESULT(yes)
89   AC_DEFINE(GTK2)
90   GTK_CFLAGS="$PKG_CONFIG gtk+-2.0 --cflags"
91   GTK_LIBS="$PKG_CONFIG gtk+-2.0 --libs"
92   GDK_PIXBUF_LIBS=`$PKG_CONFIG gdk-pixbuf-2.0 --libs`
93   GDK_PIXBUF_CFLAGS=`$PKG_CONFIG gdk-pixbuf-2.0 --cflags`
94 else
95   AC_MSG_RESULT(no)
97   GTK_CFLAGS="$GTK_CONFIG --cflags"
98   GTK_LIBS="$GTK_CONFIG --libs"
100   dnl Warn the user if stuff is missing...
101   rox_CHECK_EXISTS([$GTK_CONFIG],
102                    [You need to install the gtk-devel package before compiling:
103                     http://www.gtk.org])
105   dnl Make sure we have gdk-pixbuf
106   AC_MSG_CHECKING(for gdk-pixbuf library)
107   if test -z "$GDK_PIXBUF_CONFIG"; then
108     GDK_PIXBUF_CONFIG=gdk-pixbuf-config
109   fi
110   GDK_PIXBUF_CFLAGS=`$GDK_PIXBUF_CONFIG --cflags`
111   GDK_PIXBUF_LIBS=`$GDK_PIXBUF_CONFIG --libs`
112   [
113   if [ -n "$GDK_PIXBUF_LIBS" ]; then
114   ]
115     AC_MSG_RESULT(yes - use '$GDK_PIXBUF_LIBS')
116   else
117     AC_MSG_ERROR(can't run '$GDK_PIXBUF_CONFIG --libs' - make sure it is in your PATH)
118   fi
120 AC_SUBST(GTK_CFLAGS)
121 AC_SUBST(GTK_LIBS)
122 AC_SUBST(GDK_PIXBUF_CFLAGS)
123 AC_SUBST(GDK_PIXBUF_LIBS)
125 rox_CHECK_EXISTS([$XML_CONFIG],
126            [You need to install the xml-devel package before compiling:
127             http://xmlsoft.org/])
129 dnl Does file(1) support '-b' ?
130 AC_MSG_CHECKING(whether file -b works)
131 if file -b / > /dev/null 2> /dev/null
132 then
133   AC_DEFINE(FILE_B_FLAG)
134   AC_MSG_RESULT(yes)
135 else
136   AC_MSG_RESULT(no)
139 dnl Checks for header files.
140 AC_PATH_X
141 AC_HEADER_DIRENT
142 AC_HEADER_STDC
143 AC_HEADER_SYS_WAIT
144 AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h mntent.h sys/ucred.h sys/mntent.h)
145 AC_CHECK_HEADERS(locale.h regex.h)
147 rox_ARG_WITH(vfs,
148   [  --with-vfs[=prefix]     use libvfs for virtual file system [search it in prefix/include and prefix/lib]])
150 dnl Checks for typedefs, structures, and compiler characteristics.
151 AC_C_CONST
152 AC_TYPE_UID_T
153 AC_TYPE_SIZE_T
155 dnl Checks for library functions.
156 AC_CHECK_FUNCS(gethostname unsetenv mkdir rmdir strdup strtol getopt_long)
157 AC_CHECK_LIB(regex, re_compile_pattern)
158 AC_CHECK_FUNCS(re_compile_pattern re_search re_set_syntax)
160 AC_MSG_CHECKING(for vfs library)
161 VFS_LIBS=""
162 VFS_CFLAGS=""
163 if test x"$with_vfs_sign" = xyes; then
164   if test x"$with_vfs_arg" != x; then
165     vfs_includes="-I${with_vfs_arg}/include"
166     vfs_libs="-L${with_vfs_arg}/lib -R${with_vfs_arg}/lib"
167     AC_MSG_RESULT(yes - use '$vfs_libs')
168   else
169     vfs_includes=""
170     vfs_libs=""
171     AC_MSG_RESULT(yes)
172   fi
173   CFLAGS="$CFLAGS $vfs_includes"
174   LDFLAGS="$LDFLAGS $vfs_libs"
175   VFS_CFLAGS=$vfs_includes
176   VFS_LIBS=$vfs_libs
177 else
178   AC_MSG_RESULT(no)
180 AC_SUBST(VFS_CFLAGS)
181 AC_SUBST(VFS_LIBS)
183 dnl Extract version info from AppInfo.xml
184 AC_MSG_CHECKING(extracting version information)
186 VERSION=`sed -n 's/^.*<Version>\([.0-9]*\).*<\/Version>.*$/\1/p' ../AppInfo.xml`
188 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
189 AC_MSG_RESULT(version $VERSION)
191 dnl Check for the Midnight Commander VFS library
192 AC_CHECK_LIB(vfs, mc_stat, , , `$GTK_CONFIG --libs`)
194 AC_OUTPUT(Makefile)