(fish_file_store): type accuracy to avoid counter overflow while copiyng huge files.
[midnight-commander.git] / configure.ac
blob798a6b6eeb55ed1998c3598dc662c112361c004b
1 dnl
2 dnl Configure.in file for the Midnight Commander
3 dnl
5 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
6 AC_PREREQ(2.60)
7 m4_pattern_forbid(MC_)
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_SRCDIR(src/main.c)
10 AC_CONFIG_AUX_DIR(config)
11 MC_VERSION
12 AM_INIT_AUTOMAKE(mc, ${VERSION} )
14 LIBMC_VERSION="0.0.1"
15 LIBMC_RELEASE="1"
16 AC_SUBST(LIBMC_VERSION)
17 AC_SUBST(LIBMC_RELEASE)
19 dnl Enable silent rules by default (if yes)
20 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
22 AM_CONFIG_HEADER(config.h)
23 AM_MAINTAINER_MODE
24 AC_CANONICAL_HOST
26 AC_USE_SYSTEM_EXTENSIONS
28 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS],["$ac_configure_args"],[MC configure arguments])
30 AC_PROG_LIBTOOL
31 PKG_PROG_PKG_CONFIG
32 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
33 AC_PATH_PROG([PYTHON], [python], [/usr/bin/python])
34 AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby])
36 AC_ISC_POSIX
38 AC_PROG_CC_STDC
39 AM_PROG_CC_C_O
41 dnl Doxygen
43 DX_HTML_FEATURE(ON)
44 DX_CHM_FEATURE(OFF)
45 DX_CHI_FEATURE(OFF)
46 DX_MAN_FEATURE(OFF)
47 DX_RTF_FEATURE(OFF)
48 DX_XML_FEATURE(OFF)
49 DX_PDF_FEATURE(OFF)
50 DX_PS_FEATURE(OFF)
51 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
53 dnl PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
55 AC_CHECK_GLIB
57 AC_ARG_ENABLE([mclib],
58         [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
59         [
60             if test "x$enableval" = "xno" ; then
61                 enable_mclib=no
62             else
63                 if test "x$enable_shared" = "xno" ; then
64                     AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
65                     enable_mclib=no
66                 else
67                     enable_mclib=yes
68                 fi
69             fi
70         ],
71         [enable_mclib=no])
73 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
75 AC_HEADER_MAJOR
76 AC_C_CONST
77 dnl Check this before type sizeof checks
78 AC_SYS_LARGEFILE
80 AC_PROG_LN_S
81 AC_CHECK_TOOL(AR, ar, ar)
83 dnl Only list browsers here that can be run in background (i.e. with `&')
84 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
86 dnl
87 dnl Ovverriding mmap support.  This has to be before AC_FUNC_MMAP is used.
88 dnl We use only part of the functionality of mmap, so on AIX,
89 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
90 dnl
91 AC_ARG_WITH(mmap,
92         [  --with-mmap              Use the mmap call [[yes if found]]])
93 if test x$with_mmap != xno; then
94     if test x$with_mmap = x; then
95         AC_FUNC_MMAP
96     else
97         AC_DEFINE(HAVE_MMAP, 1)
98     fi
102 dnl Internationalization
104 AM_GNU_GETTEXT(no-libtool, need-ngettext)
105 AM_GNU_GETTEXT_VERSION(0.14.3)
107 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
108     CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
111 dnl Determine which help translations we want to install.
112 ALL_DOC_LINGUAS="es hu it pl ru sr"
114 DOC_LINGUAS=
115 if test "x$USE_NLS" = xyes; then
116     if test -z "$LINGUAS"; then
117         langs="`grep -v '^#' $srcdir/po/LINGUAS`"
118     else
119         langs="$LINGUAS"
120     fi
121 else
122     langs=
125 for h_lang in $ALL_DOC_LINGUAS; do
126     for lang in $langs; do
127         if test "$lang" = "$h_lang"; then
128             DOC_LINGUAS="$DOC_LINGUAS $lang"
129             break
130         fi
131     done
132 done
133 AC_SUBST(DOC_LINGUAS)
136 dnl OS specific flags.
138 case $host_os in
139 aux*)
140     # A/UX
141     LIBS="$LIBS -lposix"
142     AC_DEFINE(_POSIX_SOURCE)
143     ;;
144 esac
146 AC_PROG_INSTALL
147 AC_CHECK_HEADERS([unistd.h string.h memory.h limits.h malloc.h \
148         utime.h fcntl.h sys/statfs.h sys/vfs.h sys/time.h \
149         sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
150         sys/socket.h sys/sysmacros.h sys/types.h sys/mkdev.h])
152 AC_HEADER_TIME
153 AC_HEADER_DIRENT
154 AC_HEADER_ASSERT
156 dnl Missing structure components
157 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
158 AC_STRUCT_ST_BLOCKS
161 dnl Check availability of some functions
164 AC_CHECK_FUNCS([\
165         atoll \
166         isascii \
167         statfs sysconf \
168         tcgetattr tcsetattr \
169         ftruncate \
170         strverscmp \
171         strncasecmp \
172         realpath
176 dnl getpt is a GNU Extension (glibc 2.1.x)
178 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
179 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
181 dnl replacing lstat with statlstat on sco makes it more portable between
182 dnl sco clones
183 AC_CHECK_FUNCS(statlstat)
186 dnl If running under AIX, AC_AIX does not tell us that
188 AC_MSG_CHECKING([for AIX defines])
189 AC_EGREP_CPP(yes,
190 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
192 #endif
193 ], [
194 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
195 AC_MSG_RESULT(yes)
196 ], [AC_MSG_RESULT(no)])
199 dnl Missing typedefs and replacements
202 AC_CHECK_SIZEOF(long)
203 AC_TYPE_UINTMAX_T
204 AC_CHECK_SIZEOF(uintmax_t)
205 AC_TYPE_OFF_T
206 AC_CHECK_SIZEOF(off_t)
207 AC_TYPE_MODE_T
208 AC_TYPE_PID_T
209 AC_TYPE_UID_T
211 AC_FUNC_STRCOLL
213 mc_AC_GET_FS_INFO
216 dnl X11 support.
217 dnl Used to read keyboard modifiers when running under X11.
218 AC_PATH_XTRA
221 dnl Check if the gmodule functionality supported on this system.
222 AC_G_MODULE_SUPPORTED
225 dnl Sequent wants getprocessstats
227 AC_CHECK_LIB(seq, get_process_stats, [
228         LIBS="$LIBS -lseq"
229         AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
230                   [Define if you have function `get_process_stats' and
231 have to use that instead of gettimeofday])])
233 AC_MC_VFS_CHECKS
236 dnl Check for gpm mouse support (Linux only)
238 mouse_lib="xterm only"
239 AC_ARG_WITH(gpm-mouse,
240         [  --with-gpm-mouse         Compile with gpm mouse support (Linux only)
241                            [[yes if found]]])
243 case $host_os in
244 linux*)
245     if test x$with_gpm_mouse != xno; then
246         AC_CHECK_LIB(gpm, Gpm_Repeat,
247             [AC_DEFINE(HAVE_LIBGPM, 1,
248                        [Define to enable gpm mouse support on Linux])
249             mouse_lib="gpm and xterm"
250             MCLIBS="$MCLIBS -lgpm"],
251             if test "x$with_gpm_mouse" = "xyes"; then
252                 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
253             else
254                 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
255             fi
256         )
257     fi
258     ;;
259 esac
261 MC_CHECK_SEARCH_TYPE
264 dnl Check nroff and the options it supports
266 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
268 dnl Default values
269 MANDOC=-man
270 MAN_FLAGS=
272 if $HAVE_nroff; then
273     AC_MSG_CHECKING([for manual formatting macros])
274     AC_CACHE_VAL(mc_cv_mandoc, [
275     nroff -mandoc < /dev/null > /dev/null 2>&1
276     if test $? = 0; then
277         mc_cv_mandoc=-mandoc
278     else
279         mc_cv_mandoc=-man
280     fi
281     ])
282     MANDOC=$mc_cv_mandoc
283     AC_MSG_RESULT([$MANDOC])
285     AC_MSG_CHECKING([for option to disable ANSI color in manuals])
286     AC_CACHE_VAL(mc_cv_man_nocolor, [
287     nroff -c < /dev/null > /dev/null 2>&1
288     if test $? = 0; then
289         mc_cv_man_nocolor=-c
290     else
291         mc_cv_man_nocolor=
292     fi
293     ])
294     MAN_FLAGS=$mc_cv_man_nocolor
295     AC_MSG_RESULT([${MAN_NOCOLOR-none}])
297     AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
298     AC_CACHE_VAL(mc_cv_nroff_tascii, [
299     mc_cv_nroff_tascii=
300     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
301     if test $? = 0; then
302         mc_cv_nroff_tascii=-Tlatin1
303     else
304         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
305         if test $? = 0; then
306             mc_cv_nroff_tascii=-Tascii
307         fi
308     fi
309     ])
310     AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
311     MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
314 AC_SUBST(MANDOC)
315 AC_SUBST(MAN_FLAGS)
319 dnl Check for -L option to file
321 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
322 if $HAVE_FILECMD; then
323     AC_MSG_CHECKING([for -L option to file command])
324     AC_CACHE_VAL(mc_cv_filel, [
325     file -L . > /dev/null 2>&1
326     if test $? = 0; then
327         mc_cv_filel=yes
328     else
329         mc_cv_filel=no
330     fi
331     ])
332     if test x$mc_cv_filel = xyes; then
333         AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
334     fi
335     filel=$mc_cv_filel
336     AC_MSG_RESULT([$filel])
340 AC_MSG_CHECKING([for subshell support])
341 AC_ARG_WITH(subshell,
342         [  --with-subshell          Compile in concurrent subshell [[yes]]
343   --with-subshell=optional Don't run concurrent shell by default [[no]]],
344         [result=no
345         if test x$withval = xoptional
346         then
347                 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
348                           [Define to make subshell support optional])
349                 result="optional"
350         fi
351         if test x$withval = xyes
352         then
353                 result="yes"
354         fi],
355         [dnl Default: enable the subshell support
356         result="yes"
358 if test "x$result" != xno; then
359         AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
360                   [Define to enable subshell support])
362 AM_CONDITIONAL(HAVE_SUBSHELL_SUPPORT, [test "x$result" != xno])
363 AC_MSG_RESULT([$result])
364 subshell="$result"
367 MC_WITH_SCREEN
371 dnl Internal editor support.
373 AC_ARG_WITH(edit,
374         [  --with-edit              Enable internal editor [[yes]]])
376 if test x$with_edit != xno; then
377         AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
378         use_edit=yes
379         edit_msg="yes"
380         AC_MSG_NOTICE([using internal editor])
381 else
382         edit_msg="no"
386 dnl Diff viewer support.
388 AC_ARG_WITH(diff_viewer,
389         [  --with-diff-viewer       Compile with diff viewer [[yes]]])
391 if test x$with_diff_viewer != xno; then
392         AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
393         use_diff=yes
394         diff_msg="yes"
395         AC_MSG_NOTICE([using diff viewer])
396 else
397         diff_msg="no"
401 dnl Check if the OS is supported by the console saver.
402 cons_saver=""
403 case $host_os in
404 linux*)
405     cons_saver=yes
406 esac
410 dnl Where config files should be placed
413 AC_ARG_WITH([homedir],
414     AS_HELP_STRING([--with-homedir], [Choose any place of user settings relative to home dir, or XDG for respect XDG standards @<:@XDG@:>@]),
415     [
416         if test "x$withval" = "xXDG"; then
417             with_homedir=XDG
418         else
419             with_homedir=$withval
420         fi
421     ],
422     [with_homedir=XDG])
425 if test x$with_homedir = xXDG; then
426     AC_DEFINE(MC_HOMEDIR_XDG, 1,
427         [Define to enable XDG standard support])
428 else
429     AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
433 MC_BACKGROUND
437 dnl User visible support for charset conversion.
439 AC_ARG_ENABLE([charset],
440               [  --enable-charset        Support for charset selection and conversion [[yes]]])
441 have_charset=
442 charset_msg="no"
443 if test "x$enable_charset" != "xno"; then
444     AC_DEFINE(HAVE_CHARSET, 1,
445               [Define to enable charset selection and conversion])
446     have_charset=yes
447     charset_msg="yes"
450 if test "$GLIBC21" != yes; then
451     AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
454 MC_CHECK_CFLAGS
456 CFLAGS_OPTS=""
458 if test "x$CFLAGS" = "x"; then
459     CFLAGS_OPTS=" -O2 "
462 if test x$USE_MAINTAINER_MODE = xyes; then
463     CFLAGS_OPTS="-g3 -O -ggdb"
464     AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
467 AC_ARG_ENABLE(
468     [werror],
469     AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors])
472 if test "x$enable_werror" = xyes; then
473     MC_CHECK_ONE_CFLAG([-Werror])
475 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
477 MC_UNIT_TESTS
479 AC_SUBST(CFLAGS)
480 AC_SUBST(CPPFLAGS)
481 AC_SUBST(LDFLAGS)
482 AC_SUBST(LIBS)
484 dnl Libraries used only when building the mc binary
485 AC_SUBST(MCLIBS)
487 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
488 AC_SUBST(MAN_DATE)
490 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
491 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
492 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
493 AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
494 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
495 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
496 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
498 AC_CONFIG_FILES(
500 src/man2hlp/man2hlp
503 chmod +x src/man2hlp/man2hlp
506 AC_CONFIG_FILES([
507 Makefile
509 contrib/Makefile
510 contrib/dist/Makefile
511 contrib/dist/gentoo/Makefile
512 contrib/dist/redhat/Makefile
513 contrib/dist/redhat/mc.spec
514 contrib/dist/pkginfo
515 contrib/dist/prototype
517 misc/Makefile
518 misc/skins/Makefile
519 misc/macros.d/Makefile
520 misc/mc.ext
522 src/Makefile
523 src/consaver/Makefile
524 src/editor/Makefile
525 src/man2hlp/Makefile
526 src/viewer/Makefile
527 src/diffviewer/Makefile
528 src/filemanager/Makefile
530 src/vfs/Makefile
532 src/vfs/cpio/Makefile
534 src/vfs/extfs/Makefile
535 src/vfs/extfs/helpers/Makefile
536 src/vfs/extfs/helpers/a+
537 src/vfs/extfs/helpers/apt+
538 src/vfs/extfs/helpers/audio
539 src/vfs/extfs/helpers/deb
540 src/vfs/extfs/helpers/deba
541 src/vfs/extfs/helpers/debd
542 src/vfs/extfs/helpers/dpkg+
543 src/vfs/extfs/helpers/iso9660
544 src/vfs/extfs/helpers/hp48+
545 src/vfs/extfs/helpers/lslR
546 src/vfs/extfs/helpers/mailfs
547 src/vfs/extfs/helpers/patchfs
548 src/vfs/extfs/helpers/rpms+
549 src/vfs/extfs/helpers/s3+
550 src/vfs/extfs/helpers/uace
551 src/vfs/extfs/helpers/ualz
552 src/vfs/extfs/helpers/uar
553 src/vfs/extfs/helpers/uarc
554 src/vfs/extfs/helpers/uarj
555 src/vfs/extfs/helpers/uc1541
556 src/vfs/extfs/helpers/ucab
557 src/vfs/extfs/helpers/uha
558 src/vfs/extfs/helpers/ulha
559 src/vfs/extfs/helpers/urar
560 src/vfs/extfs/helpers/uzip
561 src/vfs/extfs/helpers/uzoo
563 src/vfs/fish/Makefile
564 src/vfs/fish/helpers/Makefile
566 src/vfs/ftpfs/Makefile
568 src/vfs/local/Makefile
570 src/vfs/sfs/Makefile
572 src/vfs/smbfs/Makefile
574 src/vfs/tar/Makefile
576 src/vfs/undelfs/Makefile
578 lib/Makefile
579 lib/event/Makefile
580 lib/filehighlight/Makefile
581 lib/mcconfig/Makefile
582 lib/search/Makefile
583 lib/skin/Makefile
584 lib/strutil/Makefile
585 lib/tty/Makefile
587 lib/vfs/Makefile
589 lib/widget/Makefile
591 misc/syntax/Makefile
592 misc/syntax/Syntax
594 doc/Makefile
595 doc/hints/Makefile
596 doc/man/Makefile
597 doc/man/es/Makefile
598 doc/man/hu/Makefile
599 doc/man/it/Makefile
600 doc/man/pl/Makefile
601 doc/man/ru/Makefile
602 doc/man/sr/Makefile
604 doc/hlp/Makefile
605 doc/hlp/es/Makefile
606 doc/hlp/hu/Makefile
607 doc/hlp/it/Makefile
608 doc/hlp/pl/Makefile
609 doc/hlp/ru/Makefile
610 doc/hlp/sr/Makefile
612 intl/Makefile
613 po/Makefile.in
616 if test x$enable_tests != xno; then
617     AC_CONFIG_FILES([
618 tests/Makefile
619 tests/lib/Makefile
620 tests/lib/mcconfig/Makefile
621 tests/lib/search/Makefile
622 tests/lib/vfs/Makefile
623 tests/src/Makefile
624 tests/src/filemanager/Makefile
629 AC_OUTPUT
631 AC_MSG_NOTICE([
633 Configuration:
635   Source code location:       ${srcdir}
636   Compiler:                   ${CC}
637   Compiler flags:             ${CFLAGS}
638   File system:                ${vfs_type}
639                               ${vfs_flags}
640   Screen library:             ${screen_msg}
641   Mouse support:              ${mouse_lib}
642   X11 events support:         ${textmode_x11_support}
643   With subshell support:      ${subshell}
644   With background operations: ${enable_background}
645   Internal editor:            ${edit_msg}
646   Diff viewer:                ${diff_msg}
647   Support for charset:        ${charset_msg}
648   Search type:                ${SEARCH_TYPE}