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