1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ([2.68]) 5 6# Get version from file VERSION 7m4_define([f2fs_tools_version], m4_esyscmd([sed -n '1p' VERSION | tr -d '\n'])) 8m4_define([f2fs_tools_date], m4_esyscmd([sed -n '2p' VERSION | tr -d '\n'])) 9m4_define([f2fs_tools_gitdate], 10 m4_esyscmd([git log -1 --pretty=format:%ci 2> /dev/null])) 11 12AC_INIT([F2FS tools], [f2fs_tools_version], 13 [linux-f2fs-devel@lists.sourceforge.net]) 14 15AC_DEFINE([F2FS_TOOLS_VERSION], "f2fs_tools_version", [f2fs-tools version]) 16AC_DEFINE([F2FS_MAJOR_VERSION], m4_bpatsubst(f2fs_tools_version, 17 [\([0-9]*\)\(\w\|\W\)*], [\1]), 18 [Major version for f2fs-tools]) 19AC_DEFINE([F2FS_MINOR_VERSION], m4_bpatsubst(f2fs_tools_version, 20 [\([0-9]*\).\([0-9]*\)\(\w\|\W\)*], [\2]), 21 [Minor version for f2fs-tools]) 22 23AC_CHECK_FILE(.git, 24 AC_DEFINE([F2FS_TOOLS_DATE], 25 "m4_bpatsubst(f2fs_tools_gitdate, 26 [\([0-9-]*\)\(\w\|\W\)*], [\1])", 27 [f2fs-tools date based on Git commits]), 28 AC_DEFINE([F2FS_TOOLS_DATE], 29 "f2fs_tools_date", 30 [f2fs-tools date based on Source releases])) 31 32AC_CONFIG_SRCDIR([config.h.in]) 33AC_CONFIG_HEADER([config.h]) 34AC_CONFIG_MACRO_DIR([m4]) 35AC_CONFIG_AUX_DIR([build-aux]) 36AM_INIT_AUTOMAKE([foreign tar-pax dist-xz]) 37 38AC_CHECK_HEADERS_ONCE([ 39 fcntl.h 40 mntent.h 41 stdlib.h 42 string.h 43 unistd.h 44 sys/ioctl.h 45 sys/mount.h 46]) 47 48# Test configure options. 49AC_ARG_WITH([selinux], 50 AS_HELP_STRING([--without-selinux], 51 [Ignore presence of libselinux and disable selinux support])) 52 53AC_ARG_WITH([blkid], 54 AS_HELP_STRING([--without-blkid], 55 [Ignore presence of libblkid and disable blkid support])) 56 57# Checks for programs. 58AC_PROG_CC 59AC_PROG_LIBTOOL 60AC_PATH_PROG([LDCONFIG], [ldconfig], 61 [AC_MSG_ERROR([ldconfig not found])], 62 [$PATH:/sbin]) 63 64# Checks for libraries. 65PKG_CHECK_MODULES([libuuid], [uuid]) 66 67AS_IF([test "x$with_selinux" != "xno"], 68 [PKG_CHECK_MODULES([libselinux], [libselinux], 69 [have_selinux=yes], [have_selinux=no])], 70 [have_selinux=no] 71) 72 73AS_IF([test "x$have_selinux" = "xyes"], 74 [AC_DEFINE([HAVE_LIBSELINUX], [1], [Use libselinux])], 75 [AS_IF([test "x$with_selinux" = "xyes"], 76 [AC_MSG_ERROR([selinux support requested but libselinux not found])] 77 )] 78) 79 80AS_IF([test "x$with_blkid" != "xno"], 81 [PKG_CHECK_MODULES([libblkid], [blkid], 82 [have_blkid=yes], [have_blkid=no])], 83 [have_blkid=no] 84) 85 86AS_IF([test "x$have_blkid" = "xyes"], 87 [AC_DEFINE([HAVE_LIBBLKID], [1], [Use blkid])], 88 [AS_IF([test "x$with_blkid" = "xyes"], 89 [AC_MSG_ERROR([blkid support requested but libblkid not found])] 90 )] 91) 92 93# Checks for header files. 94AC_CHECK_HEADERS([linux/fs.h linux/blkzoned.h fcntl.h mntent.h stdlib.h string.h \ 95 sys/ioctl.h sys/mount.h unistd.h linux/falloc.h byteswap.h]) 96 97# Checks for typedefs, structures, and compiler characteristics. 98AC_C_INLINE 99AC_TYPE_INT32_T 100AC_TYPE_INT8_T 101AC_TYPE_SIZE_T 102 103# Checks for library functions. 104AC_FUNC_GETMNTENT 105AC_CHECK_FUNCS_ONCE([ 106 fallocate 107 getmntent 108 memset 109]) 110 111AS_IF([test "$ac_cv_header_byteswap_h" = "yes"], 112 [AC_CHECK_DECLS([bswap_64],,,[#include <byteswap.h>])]) 113 114# Install directories 115#AC_PREFIX_DEFAULT([/usr]) 116#AC_SUBST([sbindir], [/sbin]) 117#AC_SUBST([sysconfdir], [/etc]) 118#AC_SUBST([localstatedir], [/var]) 119AC_CONFIG_FILES([ 120 Makefile 121 man/Makefile 122 lib/Makefile 123 mkfs/Makefile 124 fsck/Makefile 125 tools/Makefile 126]) 127 128# export library version info for mkfs/libf2fs_format_la 129AC_SUBST(FMT_CURRENT, 1) 130AC_SUBST(FMT_REVISION, 0) 131AC_SUBST(FMT_AGE, 0) 132 133# export library version info for lib/libf2fs_la 134AC_SUBST(LIBF2FS_CURRENT, 2) 135AC_SUBST(LIBF2FS_REVISION, 0) 136AC_SUBST(LIBF2FS_AGE, 0) 137 138AC_OUTPUT 139