2 m4_esyscmd([./version.sh --configure]),
3 [linux-btrfs@vger.kernel.org],,
4 [http://btrfs.wiki.kernel.org])
6 if test "x$PACKAGE_URL" = "x"; then
7 AC_DEFINE([PACKAGE_URL], ["http://btrfs.wiki.kernel.org"], [URL])
15 CFLAGS=${CFLAGS:-"-g -O1 -Wall -D_FORTIFY_SOURCE=2"}
20 AC_CONFIG_AUX_DIR([config])
21 dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
22 dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
23 AC_USE_SYSTEM_EXTENSIONS
25 AC_CONFIG_SRCDIR([btrfs.c])
26 AC_PREFIX_DEFAULT([/usr])
38 AC_PATH_PROG([AR], [ar])
39 AC_PATH_PROG([RM], [rm], [rm])
40 AC_PATH_PROG([RMDIR], [rmdir], [rmdir])
42 AC_CHECK_FUNCS([openat], [],
43 [AC_MSG_ERROR([cannot find openat() function])])
45 m4_ifndef([PKG_PROG_PKG_CONFIG],
46 [m4_fatal([Could not locate the pkg-config autoconf
47 macros. These are usually located in /usr/share/aclocal/pkg.m4.
48 If your macros are in a different location, try setting the
49 environment variable AL_OPTS="-I/other/macro/dir" before running
50 ./autogen.sh or autoreconf again.])])
55 dnl Calls pkg-config --static
57 AC_DEFUN([PKG_STATIC], [
58 if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then
59 $1=`pkg-config --libs --static "$2"`
62 AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
67 AC_ARG_ENABLE([backtrace],
68 AS_HELP_STRING([--disable-backtrace], [disable btrfs backtrace]),
69 [], [enable_backtrace=yes]
72 AS_IF([test "x$enable_backtrace" = xno], [
73 AC_DEFINE([BTRFS_DISABLE_BACKTRACE], [1], [disable backtrace stuff in kerncompat.h ])
76 if test "x$enable_backtrace" = xyes; then
77 AC_CHECK_HEADERS([execinfo.h])
78 AC_CHECK_FUNCS([backtrace backtrace_symbols_fd], [],
79 AC_MSG_ERROR([standard library does not have backtrace support]))
83 AC_ARG_ENABLE([documentation],
84 AS_HELP_STRING([--disable-documentation], [do not build domumentation]),
85 [], [enable_documentation=yes]
87 AS_IF([test "x$enable_documentation" = xyes], [DISABLE_DOCUMENTATION=0], [DISABLE_DOCUMENTATION=1])
88 AC_SUBST([DISABLE_DOCUMENTATION])
90 dnl detect tools to build documentation
91 if test "x$enable_documentation" = xyes; then
92 AC_PATH_PROG([ASCIIDOC], [asciidoc], [asciidoc])
93 AC_PATH_PROG([XMLTO], [xmlto], [xmlto])
94 AC_PATH_PROG([GZIP], [gzip], [gzip])
95 AC_PATH_PROG([MV], [mv], [mv])
99 AC_ARG_ENABLE([convert],
100 AS_HELP_STRING([--disable-convert], [do not build btrfs-convert]),
101 [], [enable_convert=yes]
104 AS_IF([test "x$enable_convert" = xyes], [DISABLE_BTRFSCONVERT=0], [DISABLE_BTRFSCONVERT=1])
105 AC_SUBST([DISABLE_BTRFSCONVERT])
107 if test "x$enable_convert" = xyes; then
108 PKG_CHECK_MODULES(EXT2FS, [ext2fs])
109 PKG_CHECK_MODULES(COM_ERR, [com_err])
113 dnl Define <NAME>_LIBS= and <NAME>_CFLAGS= by pkg-config
115 dnl The default PKG_CHECK_MODULES() action-if-not-found is end the
116 dnl execution with error. The static libs are optional.
118 PKG_CHECK_MODULES(BLKID, [blkid])
119 PKG_STATIC(BLKID_LIBS_STATIC, [blkid])
121 PKG_CHECK_MODULES(UUID, [uuid])
122 PKG_STATIC(UUID_LIBS_STATIC, [uuid])
124 PKG_CHECK_MODULES(ZLIB, [zlib])
125 PKG_STATIC(ZLIB_LIBS_STATIC, [zlib])
127 dnl lzo library does not provide pkg-config, let use classic way
128 AC_CHECK_LIB([lzo2], [lzo_version], [
131 LZO2_LIBS_STATIC="-llzo2"],[
132 AC_MSG_ERROR([cannot find lzo2 library])
134 AC_SUBST([LZO2_LIBS])
135 AC_SUBST([LZO2_LIBS_STATIC])
136 AC_SUBST([LZO2_CFLAGS])
140 AC_SUBST([LIBBTRFS_MAJOR])
141 AC_SUBST([LIBBTRFS_MINOR])
142 AC_SUBST([LIBBTRFS_PATCHLEVEL])
144 AC_CONFIG_HEADERS([config.h])
148 Documentation/Makefile
155 ${PACKAGE_NAME} ${PACKAGE_VERSION}
158 exec prefix: ${exec_prefix}
162 includedir: ${includedir}
168 documentation: ${enable_documentation}
169 backtrace support: ${enable_backtrace}
170 btrfs-convert: ${enable_convert}
172 Type 'make' to compile.