Converted README to markdown
[rox-filer.git] / ROX-Filer / src / configure.in
blob581dac72d9c9b95173efeb2dabfdf4640e636d06
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 
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`
28     AC_MSG_RESULT($ver)
30     case $major in
31       [1-3]) 
32         gcc_pointer=no
33         gcc_stack=no;;
34       4)
35         gcc_pointer=yes
36         if test "$minor" -ge 1 ; then gcc_stack=yes; else gcc_stack=no; fi ;;
37       [5-9])
38         gcc_pointer=yes
39         gcc_stack=yes;;
40       *)
41         gcc_pointer=no
42         gcc_stack=no;;
43     esac
45     AC_MSG_CHECKING(whether to disable pointer sign warning)
46     if test "$gcc_pointer" = yes ; then
47       AC_MSG_RESULT(yes)
48       CFLAGS="$CFLAGS -Wno-pointer-sign"
49     else
50       AC_MSG_RESULT(no)
51     fi
52     AC_MSG_CHECKING(whether to disable stack protector)
53     if test "$gcc_stack" = yes ; then
54       AC_MSG_RESULT(yes)
55       CFLAGS="$CFLAGS -fno-stack-protector"
56     else
57       AC_MSG_RESULT(no)
58     fi
59   fi
62 if test -z "$PKG_CONFIG"; then
63   PKG_CONFIG=pkg-config
65 AC_SUBST(PKG_CONFIG)
67 AC_MSG_CHECKING(that pkg-config runs)
68 if "$PKG_CONFIG" --version > /dev/null 2>&1 ; then
69   AC_MSG_RESULT(yes)
70 else
71   AC_MSG_RESULT(no)
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:
79     http://www.gtk.org])
82 AC_DEFUN(ROX_REQUIRE, [
83 AC_MSG_CHECKING(that $1 (version >= $2) is installed)
84 if "$PKG_CONFIG" --atleast-version=$2 $1 ; then
85   AC_MSG_RESULT(yes)
86 else
87   AC_MSG_RESULT(no)
88   if "$PKG_CONFIG" --exists $1 ; then
89     AC_MSG_ERROR(Current version is only `"$PKG_CONFIG" "$1" --modversion`)
90   else
91     AC_MSG_ERROR(Package is not installed)
92   fi
96 ROX_REQUIRE(sm, 1)
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)
108 else
109   AC_MSG_RESULT(no; better wrapping not enabled)
112 dnl Find the X libraries
113 AC_PATH_XTRA
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
123 then
124   AC_DEFINE(FILE_B_FLAG)
125   AC_MSG_RESULT(yes)
126 else
127   AC_MSG_RESULT(no)
130 AC_MSG_CHECKING(for large file support)
131 case `uname -s` in
132 OpenBSD*)
133   AC_MSG_RESULT(yes)
134   AC_DEFINE(LARGE_FILE_SUPPORT)
135   ;;
136 FreeBSD*)
137   AC_MSG_RESULT(yes)
138   AC_DEFINE(LARGE_FILE_SUPPORT)
139   ;;
141   if getconf LFS64_CFLAGS > /dev/null 2> /dev/null; then
142     AC_MSG_RESULT(yes)
143     LFS_CFLAGS="`getconf LFS_CFLAGS`"
144     LFS_LDFLAGS="`getconf LFS_LDFLAGS`"
145     LFS_LIBS="`getconf LFS_LIBS`"
146     AC_DEFINE(LARGE_FILE_SUPPORT)
147   else
148     AC_MSG_RESULT(no)
149     LFS_CFLAGS=""
150     LFS_LDFLAGS=""
151     LFS_LIBS=""
152   fi
153   ;;
154 esac
156 AC_SUBST(LFS_CFLAGS)
157 AC_SUBST(LFS_LDFLAGS)
158 AC_SUBST(LFS_LIBS)
160 dnl Checks for header files.
161 AC_HEADER_DIRENT
162 AC_HEADER_STDC
163 AC_HEADER_SYS_WAIT
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.
167 AC_C_CONST
168 AC_TYPE_UID_T
169 AC_TYPE_SIZE_T
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)
195 AC_OUTPUT(Makefile)