1
2AC_INIT([fuse-ext2], [0.0.9], [alper.akcan@gmail.com])
3AC_CANONICAL_TARGET
4AM_INIT_AUTOMAKE([-Wall -Werror foreign])
5AC_CONFIG_HEADER([config.h])
6
7# Checks for programs.
8AC_PROG_CXX
9AC_PROG_AWK
10AC_PROG_CC
11AC_PROG_INSTALL
12m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
13m4_ifdef([AC_PROG_LIB],[AC_PROG_LIB],[m4_warn(portability,[Missing AC_PROJ_LIB])])
14AC_PROG_OBJC
15AC_PROG_LIBTOOL
16AC_PATH_PROG(CHMOD, chmod, :)
17
18case $target_os in
19     *linux*)	arch=linux;;
20     *darwin*)	arch=darwin;;
21     *)			arch=unknown;;
22esac
23
24# Large file support
25AC_TYPE_SIZE_T
26AC_TYPE_OFF_T
27AC_DEFINE([_LARGE_FILE_SOURCE], [], [Large files support])
28AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
29
30# Checks for header files.
31AC_HEADER_DIRENT
32AC_HEADER_STDC
33AC_HEADER_MAJOR
34AC_CHECK_HEADERS([	\
35	fcntl.h		\
36	malloc.h	\
37	mntent.h	\
38	netinet/in.h	\
39	paths.h		\
40	stddef.h	\
41	stdlib.h	\
42	string.h	\
43	linux/fd.h	\
44	sys/file.h	\
45	sys/ioctl.h	\
46	sys/mount.h	\
47	sys/param.h	\
48	sys/statvfs.h	\
49	sys/time.h	\
50	sys/types.h	\
51	sys/stat.h	\
52	sys/mkdev.h	\
53	sys/ioctl.h	\
54	sys/syscall.h	\
55	sys/resource.h	\
56	sys/mman.h	\
57	sys/prctl.h	\
58	sys/disklabel.h \
59	sys/queue.h	\
60	sys/socket.h	\
61	sys/un.h	\
62	sys/sockio.h	\
63	net/if.h	\
64	netinet/in.h	\
65	net/if_dl.h	\
66	errno.h		\
67	unistd.h	\
68	utime.h		\
69	getopt.h	\
70	inttypes.h	\
71])
72
73AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
74[[
75#if HAVE_SYS_QUEUE_H
76#include <sys/queue.h>
77#endif
78]])
79
80# Checks for typedefs, structures, and compiler characteristics.
81AC_C_CONST
82AC_C_INLINE
83AC_TYPE_MODE_T
84AC_TYPE_OFF_T
85AC_TYPE_SIZE_T
86AC_TYPE_SSIZE_T
87AC_CHECK_MEMBERS([struct stat.st_blksize])
88AC_STRUCT_ST_BLOCKS
89AC_CHECK_MEMBERS([struct stat.st_rdev])
90AC_HEADER_TIME
91AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1, [Define to 1 if you have the `llseek' prototype.])],,
92		[#include <unistd.h>])
93AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1, [Define to 1 if you have the `lseek64' prototype.])],,
94		[#define _LARGEFILE_SOURCE
95		 #define _LARGEFILE64_SOURCE
96		 #include <unistd.h>])
97
98dnl Check to see if ssize_t was decleared
99AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T, 1, [Define to 1 if you have the `ssize_t' prototype.])],,
100		[#include <sys/types.h>])
101
102# Checks for library functions.
103AC_FUNC_VPRINTF
104AC_FUNC_CHOWN
105AC_FUNC_CLOSEDIR_VOID
106AC_FUNC_GETMNTENT
107AC_PROG_GCC_TRADITIONAL
108AC_FUNC_MALLOC
109AC_FUNC_MEMCMP
110AC_FUNC_MMAP
111AC_FUNC_REALLOC
112AC_FUNC_SELECT_ARGTYPES
113AC_FUNC_STAT
114AC_FUNC_UTIME_NULL
115AC_CHECK_FUNCS([	\
116	ftruncate		\
117	getmntent		\
118	getmntinfo		\
119	getpagesize		\
120	hasmntopt		\
121	memmove			\
122	memset			\
123	munmap			\
124	random			\
125	select			\
126	srand			\
127	srandom			\
128	strcasecmp      	\
129	strchr			\
130	strdup			\
131	strerror		\
132	strrchr			\
133	strtol			\
134	strtoul			\
135	strtoull		\
136	uname			\
137	utime			\
138	llseek			\
139	lseek64			\
140])
141
142# Checks for libraries
143AC_SEARCH_LIBS([sem_post], [pthread], [], [AC_MSG_ERROR([Can't find pthreads, please install it])])
144AC_SEARCH_LIBS([fuse_main], [osxfuse fuse], [], [AC_MSG_ERROR([Can't find libfuse, please install it])])
145AC_SEARCH_LIBS([com_err], [com_err], [], [AC_MSG_ERROR([Can't find comerr, please install it])])
146AC_SEARCH_LIBS([ext2fs_open], [ext2fs], [], [AC_MSG_ERROR([Can't find e2fslibs, please install it])])
147
148AC_MSG_CHECKING([if FUSE on this system is too new for us])
149AC_EGREP_CPP([fuse_version_yes], [
150#define _FILE_OFFSET_BITS 64
151#define FUSE_USE_VERSION 27
152#include "fuse.h"
153#if FUSE_VERSION > 27
154fuse_version_yes
155#endif
156], AC_DEFINE([FUSE_USE_VERSION], [27], [Version of FUSE interface]) AC_MSG_RESULT([yes]),
157   AC_DEFINE([FUSE_USE_VERSION], [FUSE_VERSION], [Version of FUSE interface]) AC_MSG_RESULT([no]))
158
159# Check extra parameters
160AC_ARG_ENABLE([debug],
161[  --enable-debug    	  enable noisy debug],
162if test "$enableval" = "no"
163then
164	DEBUG_CMT=#
165	echo "Disabling debug support"
166else
167	DEBUG_CMT=
168	AC_DEFINE(ENABLE_DEBUG, 1, [Define to 1 if you want 'debug' support.])
169	echo "Enabling debug support"
170fi
171,
172DEBUG_CMT=
173echo "Disabling debug support by default"
174	AC_DEFINE(ENABLE_DEBUG, 0, [Define to 1 if you want 'debug' support.])
175)
176
177AC_ARG_WITH(pkgconfigdir,
178            [  --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
179            [pkgconfigdir=$withval],
180            [pkgconfigdir='${libdir}/pkgconfig'])
181AC_SUBST(pkgconfigdir)
182
183AM_CONDITIONAL(LINUX, test "$arch" = linux)
184AM_CONDITIONAL(DARWIN, test "$arch" = darwin)
185
186AC_CONFIG_FILES([
187	fuse-ext2.pc
188	Makefile
189	fuse-ext2/Makefile
190	tools/Makefile
191	tools/macosx/Makefile
192])
193
194AC_OUTPUT
195