OSDN Git Service

Work with automake-1.10.
[android-x86/external-parted.git] / configure.ac
1 dnl GNU Parted - a library and front end for manipulation hard disk partitions
2 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007
3 dnl                     Free Software Foundation, Inc.
4 dnl
5 dnl This file may be modified and/or distributed without restriction.
6
7 AC_PREREQ(2.50)
8
9 AC_INIT(include/parted/parted.h)
10
11 dnl Versioning
12 dnl Shamelessly pulled straight from glib's configure.in ...
13 dnl Making releases:
14 dnl    PED_MICRO_VERSION += 1;
15 dnl    PED_INTERFACE_AGE += 1;
16 dnl    PED_BINARY_AGE += 1;
17 dnl if any functions have been added, set PED_INTERFACE_AGE to 0.
18 dnl if backwards compatibility has been broken (eg. functions removed,
19 dnl function signatures changed),
20 dnl set PED_BINARY_AGE _and_ PED_INTERFACE_AGE to 0.
21 PED_MAJOR_VERSION=1
22 PED_MINOR_VERSION=9
23 PED_MICRO_VERSION=9
24 PED_INTERFACE_AGE=1
25 PED_BINARY_AGE=1
26 PED_VERSION_SUFFIX=
27 PED_VERSION=$PED_MAJOR_VERSION.$PED_MINOR_VERSION.$PED_MICRO_VERSION$PED_VERSION_SUFFIX
28
29 LT_RELEASE=$PED_MAJOR_VERSION.$PED_MINOR_VERSION
30 LT_CURRENT=`expr $PED_MICRO_VERSION - $PED_INTERFACE_AGE`
31 LT_REVISION=$PED_INTERFACE_AGE
32 LT_AGE=`expr $PED_BINARY_AGE - $PED_INTERFACE_AGE`
33
34 AC_SUBST(LT_RELEASE)
35 AC_SUBST(LT_CURRENT)
36 AC_SUBST(LT_REVISION)
37 AC_SUBST(LT_AGE)
38
39 PACKAGE=parted
40 VERSION=$PED_VERSION
41
42 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
43
44 AM_CONFIG_HEADER(config.h)
45
46 AC_CANONICAL_HOST
47 case "$host_os" in
48         linux*) OS=linux ;;
49         gnu*)   OS=gnu ;;
50         beos*)  OS=beos ;;
51         *)      AC_MSG_ERROR([Unknown or unsupported OS "$host_os".  Only "linux", "gnu" and "beos" are supported in this version of GNU Parted.]) ;;
52 esac
53 AC_SUBST(OS)
54
55 dnl Command-line options
56 AC_ARG_WITH(readline,
57         [  --with-readline         support fancy command line editing], ,
58         with_readline=yes
59 )
60
61 AC_ARG_ENABLE(mtrace,
62         [  --enable-mtrace         enable malloc() debugging], ,
63         enable_mtrace=no
64 )
65 if test "$enable_mtrace" = yes; then
66         AC_DEFINE(ENABLE_MTRACE, 1, [Mtrace malloc() debugging])
67 fi
68
69 AC_ARG_ENABLE(device-mapper,
70         [  --enable-device-mapper  enable device mapper support [default=no]], ,
71         enable_device_mapper=no
72 )
73 if test "$enable_device_mapper" = yes; then
74         AC_DEFINE(ENABLE_DEVICE_MAPPER, 1, [device mapper (libdevmapper) support])
75 fi
76
77 AC_ARG_ENABLE(selinux,
78         [  --enable-selinux        enable SELinux support [default=no]], ,
79         enable_selinux=no
80 )
81
82 AC_ARG_ENABLE(discover-only,
83         [  --enable-discover-only  support only reading/probing [default=no]], ,
84         enable_discover_only=no
85 )
86 if test "$enable_discover_only" = yes; then
87         AC_DEFINE(DISCOVER_ONLY, 1, [Probing functionality only])
88 fi
89
90 PARTED_LIBS=""
91 AC_ARG_ENABLE(dynamic-loading,
92 [  --enable-dynamic-loading  support dynamic fs libraries [default=yes]], ,
93         if test "$enable_discover_only" = yes; then
94                 enable_dynamic_loading=no
95         else
96                 enable_dynamic_loading=yes
97         fi
98 )
99 if test "$enable_discover_only" = yes -a "$enable_dynamic_loading" = yes; then
100         AC_MSG_ERROR(
101 [You can't use --enable-dynamic-loading and --disable-discover-only together]
102         )
103 fi
104
105 AC_ARG_ENABLE(fs,
106         [  --enable-fs             include filesystem support [default=yes]], ,
107         enable_fs=yes
108 )
109 if test "$enable_fs" = yes; then
110         AC_DEFINE(ENABLE_FS, 1,
111                   [Include file system support.  i.e. libparted/fs_...])
112 fi
113
114 AC_ARG_ENABLE(debug,
115         [  --enable-debug          compile in assertions [default=yes]], ,
116         enable_debug=yes
117 )
118
119 if test "$enable_debug" = yes; then
120         AC_DEFINE(DEBUG, 1, [Enable assertions, etc.])
121 fi
122
123 AC_ARG_ENABLE(read-only,
124         [  --enable-read-only      disable writing (for debugging) [default=no]]
125         , ,
126         enable_read_only=no
127 )
128 if test "$enable_read_only" = yes; then
129         AC_DEFINE(READ_ONLY, 1, [Disable all writing code])
130 fi
131
132 PARTEDLDFLAGS=
133 AC_SUBST(PARTEDLDFLAGS)
134
135 AC_ARG_ENABLE(pc98,
136         [  --enable-pc98          build with pc98 support [default=yes]], ,
137         enable_pc98=yes
138 )
139 if test "$enable_pc98" = yes; then
140         AC_DEFINE(ENABLE_PC98, 1,
141                   [Include PC98 partition tables.  (Sometimes excluded to avoid
142                    collisions with msdos partition tables])
143 fi
144
145 AC_ARG_ENABLE(Werror,
146         [  --enable-Werror         build with gcc -Werror [default=yes]], ,
147         enable_Werror=yes
148 )
149
150 AC_ARG_ENABLE(hfs-extract-fs,
151         [  --enable-hfs-extract-fs Extract special HFS files for debugging [default=no]], ,
152         enable_hfs_extract_fs=no
153 )
154 if test "$enable_hfs_extract_fs" = yes; then
155        AC_DEFINE(HFS_EXTRACT_FS, 1,
156                  [Extract low level special HFS(+) files for debugging purposes
157                   when using the "check" command (NOT FOR PACKAGING)])
158 fi
159
160 dnl make libc threadsafe (not required for us, but useful other users of
161 dnl libparted)
162 CFLAGS="$CFLAGS -D_REENTRANT"
163
164 dnl Check for programs.
165 AC_ISC_POSIX
166 AC_PROG_CC
167 AC_PROG_GCC_TRADITIONAL
168 AM_PROG_CC_C_O
169
170 dnl This test must come as early as possible after the compiler configuration
171 dnl tests, because the choice of the file model can (in principle) affect
172 dnl whether functions and headers are available, whether they work, etc.
173 AC_SYS_LARGEFILE
174
175 CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=${ac_cv_sys_file_offset_bits}"
176 AC_CHECK_SIZEOF(off_t, 64, [
177         #include <stdio.h>
178         #include <sys/types.h>
179         #include <unistd.h>
180 ])
181
182 AM_ENABLE_SHARED
183 if test "$OS" = linux -a $ac_cv_sizeof_off_t -lt 8; then
184         dnl Need to disable shared libraries, to get llseek() to work.  Long
185         dnl story.  The short story is: lseek() isn't in glibc, so a syscall
186         dnl must be made.  syscalls can't be made from within shared libraries,
187         dnl because of a bug (?) in gcc.
188         AC_MSG_WARN(
189 off_t is less than 8 bytes.  Using llseek syscall, and disabling shared
190 libraries.)
191         AM_DISABLE_SHARED
192 fi
193 AM_PROG_LIBTOOL
194
195 dnl Initialize i18n:
196 ALL_LINGUAS="ca cs da de es fr gl id it ja nl nn hu pl pt pt_BR ru sv tr uk vi zh_CN zh_TW"
197 AM_GNU_GETTEXT_VERSION([0.12.1])
198 AM_GNU_GETTEXT([external])
199 CFLAGS="$CFLAGS -DLOCALEDIR=\"\\\"$datadir/locale\\\"\""
200 if test "$USE_INCLUDED_LIBINTL" = "yes"; then
201         AC_MSG_ERROR(
202 GNU Parted requires gettext to be installed for compilation -
203 if native language support is desired.  Either disable native language support
204 with:
205         $ ./configure --disable-nls
206 Or install gettext.  GNU gettext is available from
207         http://ftp.gnu.org/gnu/gettext
208 )
209         exit
210 fi
211
212 dnl Check for libdl, if we are doing dynamic loading
213 DL_LIBS=""
214 if test "$enable_dynamic_loading" = yes; then
215         AC_CHECK_LIB(dl, dlopen,
216                 DL_LIBS="-ldl"
217                 PARTED_LIBS="$PARTED_LIBS -ldl"
218                 AC_DEFINE(DYNAMIC_LOADING, 1, [Lazy linking to fs libs]),
219                 AC_MSG_ERROR(
220                         [-ldl not found!  Try using --disable-dynamic-loading]
221                 )
222                 exit
223         )
224 fi
225 AC_SUBST(DL_LIBS)
226
227 dnl Check for libuuid
228 UUID_LIBS=""
229 AC_CHECK_LIB(uuid, uuid_generate, UUID_LIBS="-luuid",
230         AC_MSG_ERROR(
231 GNU Parted requires libuuid - a part of the e2fsprogs package (but
232 sometimes distributed separately in uuid-devel or similar)
233 This can probably be found on your distribution's CD or FTP site or at:
234          http://web.mit.edu/tytso/www/linux/e2fsprogs.html
235 Note: if you are using precompiled packages you will also need the development
236 package as well (which may be called e2fsprogs-devel or something similar).
237 If you compile e2fsprogs yourself then you need to do 'make install' and
238 'make install-libs'.
239         )
240         exit
241 )
242 AC_SUBST(UUID_LIBS)
243
244 dnl Check for libdevmapper
245 DM_LIBS=""
246 if test "$enable_device_mapper" = yes; then
247         AC_CHECK_LIB(devmapper, dm_task_create,
248                 DM_LIBS="-ldevmapper",
249                 AC_MSG_ERROR(
250                         [libdevmapper not found!  Try using --disable-device-mapper]
251                 )
252                 exit
253         )
254 fi
255 AC_SUBST(DM_LIBS)
256
257 dnl Check for SELinux
258 SELINUX_LIBS=""
259 if test "$enable_selinux" = yes; then
260         SELINUX_LIBS="-lselinux -lsepol"
261 fi
262 AC_SUBST(SELINUX_LIBS)
263
264 dnl Check for libreiserfs
265 REISER_LIBS=""
266 if test "$enable_dynamic_loading" = no -a "$enable_discover_only" = no; then
267         OLD_LIBS="$LIBS"
268         AC_CHECK_LIB(dal, dal_equals,
269                 LIBS="-ldal"
270                 AC_CHECK_LIB(reiserfs, reiserfs_fs_probe,
271                         REISER_LIBS="-ldal -lreiserfs"
272                         AC_DEFINE(HAVE_LIBREISERFS, 1, [Have libreiserfs])
273                 )
274                 AC_CHECK_LIB(reiserfs, reiserfs_fs_check,
275                         AC_DEFINE(HAVE_REISERFS_FS_CHECK, 1, [Have reiserfs_fs_check()])
276                 )
277         )
278         LIBS="$OLD_LIBS"
279 fi
280 AC_SUBST(REISER_LIBS)
281
282 dnl Check for termcap
283 if test "$with_readline" = yes; then
284         OLD_LIBS="$LIBS"
285         LIBS=""
286         AC_SEARCH_LIBS(tgetent, ncurses curses termcap termlib,
287                 PARTED_LIBS="$PARTED_LIBS $LIBS",
288                 AC_MSG_ERROR(
289 termcap could not be found which is required for the
290 --with-readline option (which is enabled by default).  Either disable readline
291 support with --without-readline or download and install termcap from:
292         ftp.gnu.org/gnu/termcap
293 Note: if you are using precompiled packages you will also need the development
294   package as well (which may be called termcap-devel or something similar).
295 Note: (n)curses also seems to work as a substitute for termcap.  This was
296   not found either - but you could try installing that as well.
297 )
298         exit
299         )
300         LIBS="$OLD_LIBS"
301 fi
302
303 dnl Check for readline
304 if test "$with_readline" = yes; then
305         OLD_LIBS="$LIBS"
306         LIBS="$LIBS $PARTED_LIBS"
307         AC_CHECK_LIB(readline, readline,
308                 PARTED_LIBS="-lreadline $PARTED_LIBS"
309                 AC_DEFINE(HAVE_LIBREADLINE, 1, [have readline]),
310                 AC_MSG_ERROR(
311 GNU Readline could not be found which is required for the
312 --with-readline (which is enabled by default).  Either disable readline support with
313 --without-readline or downloaded and install it from:
314         ftp.gnu.org/gnu/readline
315 Note: if you are using precompiled packages you will also need the development
316 package as well (which may be called readline-devel or something similar).
317 )
318                 exit,
319                 $PARTED_LIBS
320         )
321         LIBS="$OLD_LIBS"
322 fi
323
324 AC_SUBST(PARTED_LIBS)
325
326 dnl Check for OS specific libraries
327
328 dnl GNU/Hurd:
329 if test "$OS" = gnu; then
330         CFLAGS="$CFLAGS -D_GNU_SOURCE=1"
331
332 dnl libshouldbeinlibc
333         AC_CHECK_LIB(shouldbeinlibc, vm_deallocate,
334                 OS_LIBS="$OS_LIBS -lshouldbeinlibc",
335                 AC_MSG_ERROR(
336 GNU Parted requires libshouldbeinlibc when running on
337 GNU/Hurd systems.  It is a standard part of a GNU/Hurd system.
338                 )
339                 exit
340         )
341
342 dnl libstore may depend on libparted being present.
343 dnl Aren't circular dependencies wonderful?
344         OLD_LIBS="$LIBS"
345         LIBS=
346
347         AC_CHECK_LIB(parted, ped_device_read)
348
349 dnl libstore
350         AC_CHECK_LIB(store, store_open,
351                 OS_LIBS="$OS_LIBS -lstore",
352                 AC_MSG_ERROR(
353 GNU Parted requires libstore when running on GNU/Hurd
354 systems.  It is a standard part of a GNU/Hurd system.
355                 )
356                 exit,
357                 $OS_LIBS $UUID_LIBS $DM_LIBS $LIBS
358         )
359         LIBS="$OLD_LIBS"
360 fi
361
362 dnl BeOS/ZETA/Haiku:
363
364 if test "$OS" = beos; then
365         dnl Include the socket library, as it is a depedency of libuuid
366         dnl and so also of us (due to socket() call in libuuid)
367         OS_LIBS="$OS_LIBS -lsocket"
368 fi
369
370 AC_SUBST(OS_LIBS)
371
372 dnl One day, gettext might support libtool...
373 dnl if test "$USE_INCLUDED_LIBINTL" = "yes"; then
374 dnl     INTLINCS='-I$(top_srcdir)/intl'
375 dnl fi
376 AC_SUBST(INTLINCS)
377
378
379 dnl Checks for header files.
380 AC_CHECK_HEADER(uuid/uuid.h, ,
381         AC_MSG_ERROR(
382 GNU Parted requires libuuid - a part of the e2fsprogs package.
383 You seem to have the library installed but not the headers.  These are usually
384 found in a corresponding development package (usually called e2fsprogs-devel).
385 If you can't find one try:
386         http://web.mit.edu/tytso/www/linux/e2fsprogs.html
387 )
388         exit
389 )
390
391 AC_CHECK_HEADERS(getopt.h)
392
393 dnl required for libparted/llseek.c  (TODO: make linux-x86 only)
394 if test "$OS" = linux; then
395         AC_CHECK_HEADER(linux/unistd.h)
396 fi
397
398 if test "$with_readline" = yes; then
399         AC_CHECK_HEADERS(readline/readline.h readline/history.h, ,
400                 AC_MSG_ERROR(
401 The headers for GNU Readline could not be found which
402 are required for the --with-readline option.  You seem to have the GNU readline
403 library installed but not the headers.  These are usually found in a
404 corresponding development package (usually called readline-devel).  If you can't
405 find one try:
406         ftp.gnu.org/gnu/readline
407 Alternatively you can disable readline support with --without-readline
408 )
409         exit
410         )
411 fi
412
413 AC_CHECK_HEADERS(termcap.h)
414
415 if test "$USE_NLS" = yes; then
416         AC_CHECK_HEADERS(wctype.h, ,
417                 AC_MSG_ERROR(
418 One or more of the header files that are required for
419 native language support (wctype.h) could not be found.  Either get a newer
420 version of GNU libc and its headers - which can be obtained from:
421         ftp.gnu.org/gnu/glibc
422 Or disable native language support with the --disable-nls option
423 )
424         exit
425         )
426 fi
427
428 AC_CHECK_HEADER([execinfo.h], [
429         AC_CHECK_LIB(c, backtrace, [
430                 AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
431                 LDFLAGS="$LDFLAGS -rdynamic"
432         ])
433 ])
434
435 dnl check for "check", unit testing library/header
436 PKG_CHECK_MODULES([CHECK], [check >= 0.9.3], have_check=yes, have_check=no)
437 if test "$have_scintilla" != "yes"; then
438     AC_MSG_RESULT([Unable to locate check version 0.9.3 or higher: not building])
439 fi
440 AM_CONDITIONAL([HAVE_CHECK], [test "$have_check" = yes])
441
442 dnl Checks for typedefs, structures and compiler characteristics.
443 AC_PROG_LD
444
445 AC_C_BIGENDIAN
446 AC_C_INLINE
447 AC_C_CONST
448 AC_C_RESTRICT
449
450
451 dnl Checks for library functions.
452 AC_CHECK_FUNCS(sigaction)
453 AC_CHECK_FUNCS(getuid)
454
455 if test "$with_readline" = yes; then
456         OLD_LIBS="$LIBS"
457         LIBS="$LIBS $PARTED_LIBS -lreadline"
458         AC_CHECK_FUNCS(rl_completion_matches)
459         LIBS="$OLD_LIBS"
460 fi
461
462 OLD_CFLAGS="$CFLAGS"
463 CFLAGS=-D_GNU_SOURCE=1
464 AC_CHECK_FUNCS(canonicalize_file_name)
465 CFLAGS="$OLD_CFLAGS"
466
467 CFLAGS="$CFLAGS -W -Wall -Wno-unused -Wno-switch -Wno-format"
468
469 if test "$enable_Werror" = yes; then
470         CFLAGS="$CFLAGS -Werror"
471 fi
472
473 DATE=$(date '+%d %b %Y %H:%M')
474 USER=$(whoami)
475 HOST=$(hostname)
476 BUILDINFO="$USER@$HOST, $DATE"
477 AC_SUBST(BUILDINFO)
478
479 AC_OUTPUT([
480 Makefile
481 include/Makefile
482 include/parted/Makefile
483 libparted/Makefile
484 libparted/labels/Makefile
485 libparted/fs/Makefile
486 libparted/fs/amiga/Makefile
487 libparted/fs/ext2/Makefile
488 libparted/fs/fat/Makefile
489 libparted/fs/hfs/Makefile
490 libparted/fs/jfs/Makefile
491 libparted/fs/linux_swap/Makefile
492 libparted/fs/ntfs/Makefile
493 libparted/fs/reiserfs/Makefile
494 libparted/fs/ufs/Makefile
495 libparted/fs/xfs/Makefile
496 libparted/tests/Makefile
497 libparted.pc
498 parted/Makefile
499 partprobe/Makefile
500 doc/Makefile
501 doc/C/Makefile
502 doc/pt_BR/Makefile
503 debug/Makefile
504 debug/clearfat/Makefile
505 debug/test/Makefile
506 po/Makefile.in
507 parted.spec
508 ])
509
510 echo
511 echo Type \'make\' to compile parted.