cfb90dd01356856f11204c63d918f72b8f03b89d
[ntfsprogs.git] / configure.ac
1 AC_PREREQ(2.57)
2 AC_INIT(ntfsprogs, 1.7.2-WIP-200307311516, linux-ntfs-dev@lists.sourceforge.net)
3 AC_CANONICAL_TARGET([])
4 AC_CONFIG_SRCDIR([config.h.in])
5 AM_CONFIG_HEADER([config.h])
6 AM_INIT_AUTOMAKE
7
8 # This is required to get past a stupid configure bug when making the rpm.
9 # Basically it is broken to specify the host as a command line argument to
10 # configure on its own, i.e. without giving --host=. It is supposed to work
11 # but doesn't. So this sets host and erases nonopt effectively moving the
12 # standalone command line option into the --host= form.
13 if test "x$nonopt" != "xNONE"; then
14   host="$nonopt"
15   nonopt="NONE"
16 fi
17
18 AM_MAINTAINER_MODE
19
20 AC_PREFIX_DEFAULT(/usr/local)
21 if test "x$prefix" = "xNONE"; then
22   prefix=$ac_default_prefix
23   ac_configure_args="$ac_configure_args --prefix $prefix"
24 fi
25
26 # Command-line options.
27 AC_ARG_ENABLE(debug,
28         [  --enable-debug          enable debugging], ,
29         enable_debug=no
30 )
31
32 AC_ARG_ENABLE(really-static,
33         [  --enable-really-static  completely static binaries], ,
34         enable_really_static=no
35 )
36
37 AM_CONDITIONAL(DEBUG, test "$enable_debug" = yes)
38 AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes)
39
40 # Checks for programs.
41 AC_PROG_CXX
42 AC_PROG_CC
43 AC_PROG_INSTALL
44 AC_PROG_LN_S
45 AC_PROG_MAKE_SET
46 AC_PROG_RANLIB
47
48 # create a working libtool-script
49 if test -z "$LIBTOOL"; then
50   AC_LANG_PUSH(C)
51   AM_PROG_LIBTOOL
52   #LIBTOOL="$LIBTOOL --silent"
53   AC_LANG_POP
54   AC_SUBST(LIBTOOL_DEPS)
55   LIBTOOL_SHELL='/bin/sh ./libtool'
56 else
57   LIBTOOL_SHELL=$LIBTOOL
58 fi
59
60 # add --with-extra-includes and --with-extra-libs switch to ./configure
61 all_libraries="$all_libraries $USER_LDFLAGS"
62 all_includes="$all_includes $USER_INCLUDES"
63 AC_SUBST(all_includes)
64 AC_SUBST(all_libraries)
65
66 AC_SUBST(CFLAGS)
67 AC_SUBST(CPPFLAGS)
68 AC_SUBST(LDFLAGS)
69
70 AC_SUBST(AUTODIRS)
71
72 # Get compiler name
73 if test ! -z "$CC"; then
74         _cc="$CC"
75 else
76         _cc="gcc"
77 fi
78
79 # Check for gcc version being >= 2.96.
80 AC_MSG_CHECKING(version of $_cc)
81 cc_version=`./getgccver $_cc`
82 cc_major=`echo $cc_version | cut -d'.' -f1`
83 cc_minor=`echo $cc_version | cut -d'.' -f2`
84 if test -z "$cc_version"; then
85         cc_version="v. ?.??"
86         cc_major=1
87         cc_minor=1
88 fi
89 if test $cc_major -lt 2 -o \( $cc_major -eq 2 -a $cc_minor -lt 96 \) ; then
90 cc_version="$cc_version, bad"
91 AC_MSG_RESULT($cc_version)
92 AC_MSG_ERROR(Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\
93  Earlier compiler versions will NOT work as these do not support \
94 unnamed/annonymous structures and unions which are used heavily in linux-ntfs.)
95 fi
96 cc_version="$cc_version, ok"
97 AC_MSG_RESULT($cc_version)
98
99 # Add -fms-extensions for gcc-3.2+.
100 AM_CONDITIONAL(GCC_NEEDS_MS_EXTENSIONS, test $cc_major -gt 3 -o \( $cc_major -eq 3 -a $cc_minor -ge 2 \))
101
102 # Checks for libraries.
103
104 # Checks for header files.
105 AC_HEADER_STDC
106 AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \
107         stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \
108         sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h getopt.h sys/stat.h \
109         sys/types.h asm/byteorder.h linux/major.h linux/fd.h])
110
111 # Checks for typedefs, structures, and compiler characteristics.
112 AC_HEADER_STDBOOL
113 AC_C_CONST
114 AC_C_INLINE
115 AC_C_LONG_DOUBLE
116 AC_TYPE_OFF_T
117 AC_TYPE_SIZE_T
118 AC_STRUCT_ST_BLOCKS
119 AC_CHECK_MEMBERS([struct stat.st_rdev])
120
121 # Checks for library functions.
122 AC_FUNC_GETMNTENT
123 AC_PROG_GCC_TRADITIONAL
124 AC_FUNC_MALLOC
125 AC_FUNC_MBRTOWC
126 AC_FUNC_MEMCMP
127 AC_FUNC_REALLOC
128 AC_FUNC_STAT
129 AC_FUNC_STRFTIME
130 AC_FUNC_UTIME_NULL
131 AC_FUNC_VPRINTF
132 AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \
133         strcasecmp strchr strdup strerror strtol strtoul utime])
134
135 # Makefiles to be created by configure.
136 AC_CONFIG_FILES([
137         Makefile
138         doc/Makefile
139         include/Makefile
140         libntfs/Makefile
141         ntfsprogs/Makefile
142         ntfsprogs/mkntfs.8
143         ntfsprogs/ntfsfix.8
144         ntfsprogs/ntfsinfo.8
145         ntfsprogs/ntfslabel.8
146         ntfsprogs/ntfsprogs.8
147         ntfsprogs/ntfsresize.8
148         ntfsprogs/ntfsundelete.8
149         ntfsprogs.spec
150 ])
151 AC_OUTPUT