Jaegeuk Kim | 036d45e | 2012-10-26 21:56:34 +0900 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
| 4 | AC_PREREQ([2.68]) |
Sven-Göran Bergh | dd1ba07 | 2012-12-07 10:20:27 +0900 | [diff] [blame] | 5 | |
| 6 | # Get version from file VERSION |
| 7 | m4_define([f2fs_tools_version], m4_esyscmd([sed -n '1p' VERSION | tr -d '\n'])) |
| 8 | m4_define([f2fs_tools_date], m4_esyscmd([sed -n '2p' VERSION | tr -d '\n'])) |
| 9 | m4_define([f2fs_tools_gitdate], |
| 10 | m4_esyscmd([git log -1 --pretty=format:%ci 2> /dev/null])) |
| 11 | |
| 12 | AC_INIT([F2FS tools], [f2fs_tools_version], |
| 13 | [linux-f2fs-devel@lists.sourceforge.net]) |
| 14 | |
| 15 | AC_DEFINE([F2FS_TOOLS_VERSION], "f2fs_tools_version", [f2fs-tools version]) |
| 16 | AC_DEFINE([F2FS_MAJOR_VERSION], m4_bpatsubst(f2fs_tools_version, |
| 17 | [\([0-9]*\)\(\w\|\W\)*], [\1]), |
| 18 | [Major version for f2fs-tools]) |
| 19 | AC_DEFINE([F2FS_MINOR_VERSION], m4_bpatsubst(f2fs_tools_version, |
| 20 | [\([0-9]*\).\([0-9]*\)\(\w\|\W\)*], [\2]), |
| 21 | [Minor version for f2fs-tools]) |
| 22 | |
| 23 | AC_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 | |
Jaegeuk Kim | e69e437 | 2013-01-25 17:20:16 +0900 | [diff] [blame] | 32 | AC_CONFIG_SRCDIR([config.h.in]) |
Jan Engelhardt | 8471b6a | 2012-12-12 03:59:16 +0100 | [diff] [blame] | 33 | AC_CONFIG_HEADER([config.h]) |
Jaegeuk Kim | e69e437 | 2013-01-25 17:20:16 +0900 | [diff] [blame] | 34 | AC_CONFIG_MACRO_DIR([m4]) |
Jan Engelhardt | ec1a5da | 2012-12-12 03:55:42 +0100 | [diff] [blame] | 35 | AC_CONFIG_AUX_DIR([build-aux]) |
Jan Engelhardt | 2a8c4b1 | 2012-12-12 03:57:11 +0100 | [diff] [blame] | 36 | AM_INIT_AUTOMAKE([foreign tar-pax dist-xz]) |
Jaegeuk Kim | e69e437 | 2013-01-25 17:20:16 +0900 | [diff] [blame] | 37 | |
Sergey Kvachonok | 0d6ce1f | 2017-01-13 11:02:02 +0300 | [diff] [blame] | 38 | # Test configure options. |
| 39 | AC_ARG_WITH([selinux], |
| 40 | AS_HELP_STRING([--without-selinux], |
Jaegeuk Kim | ddd7ebd | 2017-02-04 14:45:59 +0800 | [diff] [blame] | 41 | [Ignore presence of libselinux and disable selinux support])) |
| 42 | |
| 43 | AC_ARG_WITH([blkid], |
| 44 | AS_HELP_STRING([--without-blkid], |
| 45 | [Ignore presence of libblkid and disable blkid support])) |
Sergey Kvachonok | 0d6ce1f | 2017-01-13 11:02:02 +0300 | [diff] [blame] | 46 | |
Jaegeuk Kim | 036d45e | 2012-10-26 21:56:34 +0900 | [diff] [blame] | 47 | # Checks for programs. |
| 48 | AC_PROG_CC |
Jaegeuk Kim | e69e437 | 2013-01-25 17:20:16 +0900 | [diff] [blame] | 49 | AC_PROG_LIBTOOL |
| 50 | AC_PATH_PROG([LDCONFIG], [ldconfig], |
| 51 | [AC_MSG_ERROR([ldconfig not found])], |
| 52 | [$PATH:/sbin]) |
Jaegeuk Kim | 036d45e | 2012-10-26 21:56:34 +0900 | [diff] [blame] | 53 | |
| 54 | # Checks for libraries. |
Jan Engelhardt | fe2928a | 2012-12-12 03:53:28 +0100 | [diff] [blame] | 55 | PKG_CHECK_MODULES([libuuid], [uuid]) |
Sergey Kvachonok | 0d6ce1f | 2017-01-13 11:02:02 +0300 | [diff] [blame] | 56 | |
| 57 | AS_IF([test "x$with_selinux" != "xno"], |
| 58 | [PKG_CHECK_MODULES([libselinux], [libselinux], |
| 59 | [have_selinux=yes], [have_selinux=no])], |
| 60 | [have_selinux=no] |
| 61 | ) |
| 62 | |
| 63 | AS_IF([test "x$have_selinux" = "xyes"], |
Christian Hesse | b0a2386 | 2016-10-22 22:06:54 +0200 | [diff] [blame] | 64 | [AC_DEFINE([HAVE_LIBSELINUX], [1], [Use libselinux])], |
Sergey Kvachonok | 0d6ce1f | 2017-01-13 11:02:02 +0300 | [diff] [blame] | 65 | [AS_IF([test "x$with_selinux" = "xyes"], |
| 66 | [AC_MSG_ERROR([selinux support requested but libselinux not found])] |
| 67 | )] |
| 68 | ) |
Jaegeuk Kim | 036d45e | 2012-10-26 21:56:34 +0900 | [diff] [blame] | 69 | |
Jaegeuk Kim | ddd7ebd | 2017-02-04 14:45:59 +0800 | [diff] [blame] | 70 | AS_IF([test "x$with_blkid" != "xno"], |
| 71 | [PKG_CHECK_MODULES([libblkid], [blkid], |
| 72 | [have_blkid=yes], [have_blkid=no])], |
| 73 | [have_blkid=no] |
| 74 | ) |
| 75 | |
| 76 | AS_IF([test "x$have_blkid" = "xyes"], |
| 77 | [AC_DEFINE([HAVE_LIBBLKID], [1], [Use blkid])], |
| 78 | [AS_IF([test "x$with_blkid" = "xyes"], |
| 79 | [AC_MSG_ERROR([blkid support requested but libblkid not found])] |
| 80 | )] |
| 81 | ) |
| 82 | |
Jaegeuk Kim | 036d45e | 2012-10-26 21:56:34 +0900 | [diff] [blame] | 83 | # Checks for header files. |
Jaegeuk Kim | 1067207 | 2017-11-14 10:53:32 -0800 | [diff] [blame] | 84 | AC_CHECK_HEADERS(m4_flatten([ |
| 85 | attr/xattr.h |
| 86 | byteswap.h |
| 87 | fcntl.h |
| 88 | linux/blkzoned.h |
| 89 | linux/falloc.h |
| 90 | linux/fs.h |
| 91 | linux/hdreg.h |
| 92 | linux/limits.h |
| 93 | linux/posix_acl.h |
| 94 | linux/types.h |
| 95 | linux/xattr.h |
| 96 | mntent.h |
| 97 | scsi/sg.h |
| 98 | stdlib.h |
| 99 | string.h |
| 100 | sys/acl.h |
| 101 | sys/ioctl.h |
| 102 | sys/syscall.h |
| 103 | sys/mount.h |
| 104 | sys/sysmacros.h |
Jaegeuk Kim | 9e7f252 | 2018-05-01 13:54:25 -0700 | [diff] [blame] | 105 | sys/utsname.h |
Jaegeuk Kim | 1067207 | 2017-11-14 10:53:32 -0800 | [diff] [blame] | 106 | sys/xattr.h |
| 107 | unistd.h |
| 108 | ])) |
Jaegeuk Kim | 036d45e | 2012-10-26 21:56:34 +0900 | [diff] [blame] | 109 | |
| 110 | # Checks for typedefs, structures, and compiler characteristics. |
| 111 | AC_C_INLINE |
| 112 | AC_TYPE_INT32_T |
| 113 | AC_TYPE_INT8_T |
| 114 | AC_TYPE_SIZE_T |
| 115 | |
| 116 | # Checks for library functions. |
| 117 | AC_FUNC_GETMNTENT |
Jan Engelhardt | b1bce4d | 2012-12-12 03:52:24 +0100 | [diff] [blame] | 118 | AC_CHECK_FUNCS_ONCE([ |
Jaegeuk Kim | 1067207 | 2017-11-14 10:53:32 -0800 | [diff] [blame] | 119 | add_key |
Gustavo Zacarias | 3c160e7 | 2015-03-10 15:53:17 -0300 | [diff] [blame] | 120 | fallocate |
Sheng Yong | 9713013 | 2017-11-02 11:56:07 +0800 | [diff] [blame] | 121 | fsetxattr |
Jaegeuk Kim | 1067207 | 2017-11-14 10:53:32 -0800 | [diff] [blame] | 122 | fstat |
| 123 | fstat64 |
| 124 | getmntent |
| 125 | keyctl |
| 126 | llseek |
| 127 | lseek64 |
| 128 | memset |
| 129 | setmntent |
Jan Engelhardt | b1bce4d | 2012-12-12 03:52:24 +0100 | [diff] [blame] | 130 | ]) |
Jaegeuk Kim | 036d45e | 2012-10-26 21:56:34 +0900 | [diff] [blame] | 131 | |
Yann E. MORIN | dc532e5 | 2014-12-25 18:52:00 +0100 | [diff] [blame] | 132 | AS_IF([test "$ac_cv_header_byteswap_h" = "yes"], |
| 133 | [AC_CHECK_DECLS([bswap_64],,,[#include <byteswap.h>])]) |
| 134 | |
Jaegeuk Kim | 1067207 | 2017-11-14 10:53:32 -0800 | [diff] [blame] | 135 | dnl |
| 136 | dnl Check to see if llseek() is declared in unistd.h. On some libc's |
| 137 | dnl it is, and on others it isn't..... Thank you glibc developers.... |
| 138 | dnl |
| 139 | AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1, |
| 140 | [Define to 1 if llseek declared in unistd.h])],, |
| 141 | [#include <unistd.h>]) |
| 142 | dnl |
| 143 | dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files |
| 144 | dnl are so convoluted that I can't tell whether it will always be defined, |
| 145 | dnl and if it isn't defined while lseek64 is defined in the library, |
| 146 | dnl disaster will strike. |
| 147 | dnl |
| 148 | dnl Warning! Use of --enable-gcc-wall may throw off this test. |
| 149 | dnl |
| 150 | dnl |
| 151 | AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1, |
| 152 | [Define to 1 if lseek64 declared in unistd.h])],, |
| 153 | [#define _LARGEFILE_SOURCE |
| 154 | #define _LARGEFILE64_SOURCE |
| 155 | #include <unistd.h>]) |
| 156 | dnl |
| 157 | dnl Word sizes... |
| 158 | dnl |
| 159 | |
| 160 | # AC_CANONICAL_HOST is needed to access the 'host_os' variable |
| 161 | AC_CANONICAL_HOST |
| 162 | |
| 163 | build_linux=no |
| 164 | build_windows=no |
| 165 | build_mac=no |
| 166 | |
| 167 | # Detect the target system |
| 168 | case "${host_os}" in |
| 169 | linux*) |
| 170 | build_linux=yes |
| 171 | ;; |
| 172 | cygwin*|mingw*) |
| 173 | build_windows=yes |
| 174 | ;; |
| 175 | darwin*) |
| 176 | build_mac=yes |
| 177 | ;; |
| 178 | *) |
| 179 | AC_MSG_ERROR(["OS $host_os is not supported"]) |
| 180 | ;; |
| 181 | esac |
| 182 | |
| 183 | # Pass the conditionals to automake |
| 184 | AM_CONDITIONAL([LINUX], [test "$build_linux" = "yes"]) |
| 185 | AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"]) |
| 186 | AM_CONDITIONAL([OSX], [test "$build_mac" = "yes"]) |
| 187 | |
Jaegeuk Kim | e69e437 | 2013-01-25 17:20:16 +0900 | [diff] [blame] | 188 | # Install directories |
Anthony G. Basile | 5792951 | 2015-03-07 11:16:54 -0500 | [diff] [blame] | 189 | #AC_PREFIX_DEFAULT([/usr]) |
| 190 | #AC_SUBST([sbindir], [/sbin]) |
| 191 | #AC_SUBST([sysconfdir], [/etc]) |
| 192 | #AC_SUBST([localstatedir], [/var]) |
Jan Engelhardt | b1bce4d | 2012-12-12 03:52:24 +0100 | [diff] [blame] | 193 | AC_CONFIG_FILES([ |
Mike Frysinger | 0903d1e | 2012-10-30 07:38:59 +0900 | [diff] [blame] | 194 | Makefile |
| 195 | man/Makefile |
Jaegeuk Kim | e69e437 | 2013-01-25 17:20:16 +0900 | [diff] [blame] | 196 | lib/Makefile |
Mike Frysinger | 0903d1e | 2012-10-30 07:38:59 +0900 | [diff] [blame] | 197 | mkfs/Makefile |
Changman Lee | 7f35b54 | 2013-07-04 17:11:32 +0900 | [diff] [blame] | 198 | fsck/Makefile |
Changman Lee | a0a5567 | 2014-01-10 17:44:59 +0900 | [diff] [blame] | 199 | tools/Makefile |
Hyojun Kim | 2aca5ff | 2018-03-01 13:42:44 -0800 | [diff] [blame] | 200 | tools/sg_write_buffer/Makefile |
Jan Engelhardt | b1bce4d | 2012-12-12 03:52:24 +0100 | [diff] [blame] | 201 | ]) |
Mike Frysinger | 0903d1e | 2012-10-30 07:38:59 +0900 | [diff] [blame] | 202 | |
Jaegeuk Kim | 85aa525 | 2015-12-09 10:30:25 -0800 | [diff] [blame] | 203 | # export library version info for mkfs/libf2fs_format_la |
Jaegeuk Kim | 6956bba | 2018-01-30 14:35:10 -0800 | [diff] [blame] | 204 | AC_SUBST(FMT_CURRENT, 3) |
Jaegeuk Kim | 1e7aedf | 2017-02-03 16:00:20 -0800 | [diff] [blame] | 205 | AC_SUBST(FMT_REVISION, 0) |
Jaegeuk Kim | 85aa525 | 2015-12-09 10:30:25 -0800 | [diff] [blame] | 206 | AC_SUBST(FMT_AGE, 0) |
| 207 | |
| 208 | # export library version info for lib/libf2fs_la |
Jaegeuk Kim | 6956bba | 2018-01-30 14:35:10 -0800 | [diff] [blame] | 209 | AC_SUBST(LIBF2FS_CURRENT, 4) |
Jaegeuk Kim | d244656 | 2016-07-28 13:10:46 -0700 | [diff] [blame] | 210 | AC_SUBST(LIBF2FS_REVISION, 0) |
Jaegeuk Kim | 85aa525 | 2015-12-09 10:30:25 -0800 | [diff] [blame] | 211 | AC_SUBST(LIBF2FS_AGE, 0) |
| 212 | |
Jaegeuk Kim | 036d45e | 2012-10-26 21:56:34 +0900 | [diff] [blame] | 213 | AC_OUTPUT |