r3535: Fix portability of new build system and ensure configure can find the version...
[rox-filer/dt.git] / ROX-Filer / src / configure.in
blob3ceb5300cc956dae54852caff16217cc49cdb32b
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 if test -z "$PKG_CONFIG"; then
20   PKG_CONFIG=pkg-config
22 AC_SUBST(PKG_CONFIG)
24 AC_MSG_CHECKING(that pkg-config runs)
25 if "$PKG_CONFIG" --version > /dev/null 2>&1 ; then
26   AC_MSG_RESULT(yes)
27 else
28   AC_MSG_RESULT(no)
29   AC_MSG_ERROR([*** $PKG_CONFIG missing ***
31 \'$PKG_CONFIG --version\' failed to run - make sure it is inside one of the
32 directories in your PATH environment variable!
34 pkg-config comes with the developement packages for GTK+-2.0, available at:
36     http://www.gtk.org])
39 AC_DEFUN(ROX_REQUIRE, [
40 AC_MSG_CHECKING(that $1 (version >= $2) is installed)
41 if "$PKG_CONFIG" --atleast-version=$2 $1 ; then
42   AC_MSG_RESULT(yes)
43 else
44   AC_MSG_RESULT(no)
45   if "$PKG_CONFIG" --exists $1 ; then
46     AC_MSG_ERROR(Current version is only `"$PKG_CONFIG" "$1" --modversion`)
47   else
48     AC_MSG_ERROR(Package is not installed)
49   fi
53 ROX_REQUIRE(gtk+-2.0, 2.0.1)
54 ROX_REQUIRE(glib-2.0, 2.0.3)
55 ROX_REQUIRE(libxml-2.0, 2.0.0)
57 GTK_VERSION=`"$PKG_CONFIG" --modversion gtk+-2.0`
58 AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION")
60 AC_MSG_CHECKING(if pango (version >= 1.1.2) is installed)
61 if "$PKG_CONFIG" --atleast-version=1.1.2 pango ; then
62   AC_DEFINE(USE_PANGO_WRAP_WORD_CHAR)
63   AC_MSG_RESULT(yes; enabling better wrapping)
64 else
65   AC_MSG_RESULT(no; better wrapping not enabled)
68 dnl Checks for programs.
69 AC_PROG_CC
71 dnl Use -Wall, etc if possible
72 dnl Note: GTK uses func(), so can't use -Wstrict-prototypes 
74 if test "x$GCC" = "xyes"; then
75   case " $CFLAGS " in
76   *[\ \ ]-Wall[\ \      ]*) ;;
77   *) CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" ;;
78   esac
82 dnl Find the X libraries
83 AC_PATH_XTRA
84 if test x$no_x = xyes ; then
85   AC_MSG_ERROR([X development libraries not found])
87 LIBS="$LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
88 CFLAGS="$CFLAGS $X_CFLAGS"
90 dnl Does file(1) support '-b' ?
91 AC_MSG_CHECKING(whether file -b works)
92 if file -b / > /dev/null 2> /dev/null
93 then
94   AC_DEFINE(FILE_B_FLAG)
95   AC_MSG_RESULT(yes)
96 else
97   AC_MSG_RESULT(no)
100 AC_MSG_CHECKING(for large file support)
101 case "$with_platform" in
102 OpenBSD*)
103   AC_MSG_RESULT(yes)
104   AC_DEFINE(LARGE_FILE_SUPPORT)
105   ;;
106 FreeBSD*)
107   AC_MSG_RESULT(yes)
108   AC_DEFINE(LARGE_FILE_SUPPORT)
109   ;;
111   if getconf LFS64_CFLAGS > /dev/null 2> /dev/null; then
112     AC_MSG_RESULT(yes)
113     LFS_CFLAGS="`getconf LFS_CFLAGS`"
114     LFS_LDFLAGS="`getconf LFS_LDFLAGS`"
115     LFS_LIBS="`getconf LFS_LIBS`"
116     AC_DEFINE(LARGE_FILE_SUPPORT)
117   else
118     AC_MSG_RESULT(no)
119     LFS_CFLAGS=""
120     LFS_LDFLAGS=""
121     LFS_LIBS=""
122   fi
123   ;;
124 esac
126 AC_SUBST(LFS_CFLAGS)
127 AC_SUBST(LFS_LDFLAGS)
128 AC_SUBST(LFS_LIBS)
130 dnl Checks for header files.
131 AC_PATH_X
132 AC_HEADER_DIRENT
133 AC_HEADER_STDC
134 AC_HEADER_SYS_WAIT
135 AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h mntent.h sys/ucred.h sys/mntent.h apsymbols.h)
137 dnl Checks for typedefs, structures, and compiler characteristics.
138 AC_C_CONST
139 AC_TYPE_UID_T
140 AC_TYPE_SIZE_T
142 dnl Checks for library functions.
143 AC_CHECK_FUNCS(gethostname unsetenv mkdir rmdir strdup strtol getopt_long)
145 dnl Check for extended attribute support
146 AC_CHECK_FUNCS(attropen getxattr)
147 AC_CHECK_HEADERS(attr/xattr.h sys/xattr.h)
149 dnl Extract version info from AppInfo.xml
150 AC_MSG_CHECKING(extracting version information)
152 VERSION=`sed -n 's/^.*<Version>\([.0-9]*\).*<\/Version>.*$/\1/p' $APP_DIR/AppInfo.xml`
154 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
155 AC_MSG_RESULT(version $VERSION)
157 AC_OUTPUT(Makefile)