2 dnl Configure.in file for the Midnight Commander
6 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_AUX_DIR(config)
10 AC_CONFIG_SRCDIR(src/main.c)
11 AC_CONFIG_HEADERS(config.h)
13 AM_INIT_AUTOMAKE(mc, ${VERSION} )
14 dnl Enable silent rules by default (if yes)
15 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
21 AC_USE_SYSTEM_EXTENSIONS
24 dnl ############################################################################
25 dnl Check for compiler
26 dnl ############################################################################
34 if test "x$CFLAGS" = "x"; then
37 if test x$USE_MAINTAINER_MODE = xyes; then
38 CFLAGS_OPTS="-g3 -O -ggdb"
39 AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
42 AC_ARG_ENABLE([werror],
43 AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors]))
44 if test "x$enable_werror" = xyes; then
45 mc_CHECK_ONE_CFLAG([-Werror])
48 dnl Compiler can generate warnings for unrecognized flags added to CFLAGS
49 dnl which causes attribute checks to fail
50 ax_gcc_func_attribute_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
51 _AC_LANG_PREFIX[]FLAGS=
52 AX_GCC_FUNC_ATTRIBUTE([fallthrough])
53 _AC_LANG_PREFIX[]FLAGS=$ax_gcc_func_attribute_save_flags
54 unset ax_gcc_func_attribute_save_flags
59 dnl ############################################################################
60 dnl Check for programs
61 dnl ############################################################################
66 dnl See also the "OS specific stuff" section below.
68 dnl Check nroff and the options it supports
69 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
74 AC_MSG_CHECKING([for manual formatting macros])
75 AC_CACHE_VAL(mc_cv_mandoc, [
76 nroff -mandoc < /dev/null > /dev/null 2>&1
84 AC_MSG_RESULT([$MANDOC])
86 AC_MSG_CHECKING([for option to disable ANSI color in manuals])
87 AC_CACHE_VAL(mc_cv_man_nocolor, [
88 nroff -c < /dev/null > /dev/null 2>&1
95 MAN_FLAGS=$mc_cv_man_nocolor
96 AC_MSG_RESULT([${MAN_NOCOLOR-none}])
98 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
99 AC_CACHE_VAL(mc_cv_nroff_tascii, [
101 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
103 mc_cv_nroff_tascii=-Tlatin1
105 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
107 mc_cv_nroff_tascii=-Tascii
111 AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
112 MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
118 dnl Check for -z, -L, and -S options to file
119 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
120 if $HAVE_FILECMD; then
121 dnl Don't use the file command if it doesn't accept the -z option
122 AC_MSG_CHECKING([for -z option to file command])
123 AC_CACHE_VAL(mc_cv_file_z, [
124 file -z . > /dev/null 2>&1
131 AC_MSG_RESULT([$mc_cv_file_z])
133 if test x$mc_cv_file_z = xyes; then
134 AC_DEFINE(USE_FILE_CMD, 1, [Define if the file command accepts the -z option])
136 AC_MSG_WARN([The file command doesn't accept the -z option and will not be used])
139 if test x$mc_cv_file_z = xyes; then
140 dnl file is used; check -L and -S options
142 AC_MSG_CHECKING([for -L option to file command])
143 AC_CACHE_VAL(mc_cv_file_L, [
144 file -L . > /dev/null 2>&1
151 AC_MSG_RESULT([$mc_cv_file_L])
153 if test x$mc_cv_file_L = xyes; then
154 AC_DEFINE(FILE_L, "-L ", [Define if the file command accepts the -L option])
156 AC_DEFINE(FILE_L, "", [Define if the file command accepts the -L option])
159 dnl The file command accepts the -S option since 5.33
160 AC_MSG_CHECKING([for -S option to file command])
161 AC_CACHE_VAL(mc_cv_file_S, [
162 file -S . > /dev/null 2>&1
169 AC_MSG_RESULT([$mc_cv_file_S])
171 if test x$mc_cv_file_S = xyes; then
172 AC_DEFINE(FILE_S, "-S ", [Define if file command accepts the -S option])
174 AC_DEFINE(FILE_S, "", [Define if file command accepts the -S option])
179 dnl Only list browsers here that can be run in background (i.e. with `&')
180 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
183 dnl ############################################################################
184 dnl Check for other tools
185 dnl ############################################################################
187 AC_CHECK_TOOL(AR, ar, ar)
191 dnl ############################################################################
192 dnl Check for main libraies
193 dnl ############################################################################
196 mc_G_MODULE_SUPPORTED
199 dnl X11 support. Used to read keyboard modifiers when running under X11.
203 dnl ############################################################################
204 dnl Check for header files
205 dnl ############################################################################
207 AC_CHECK_HEADERS([string.h memory.h limits.h malloc.h \
208 utime.h sys/statfs.h sys/vfs.h \
209 sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
211 dnl This macro is redefined in m4.include/gnulib/sys_types_h.m4
212 dnl to work around a buggy version in autoconf <= 2.69.
216 dnl ############################################################################
218 dnl ############################################################################
220 dnl Check largefile before type sizeof checks
223 AC_CHECK_SIZEOF(long)
225 AC_CHECK_SIZEOF(uintmax_t)
227 AC_CHECK_SIZEOF(off_t)
229 gl_PROMOTED_TYPE_MODE_T
234 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev, struct stat.st_mtim])
237 AH_TEMPLATE([sig_atomic_t],
238 [/* Define to `int' if <signal.h> doesn't define.])
239 AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
240 [Some systems declare sig_atomic_t as volatile, some others -- no.
241 This define will have value `sig_atomic_t' or
242 `volatile sig_atomic_t' accordingly.])
244 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
245 AC_EGREP_HEADER(sig_atomic_t,signal.h,
247 ac_cv_type_sig_atomic_t=yes;
248 AC_EGREP_HEADER(volatile.*sig_atomic_t,
251 is_sig_atomic_t_volatile=yes;
252 AC_MSG_RESULT([yes, volatile])
255 is_sig_atomic_t_volatile=no;
256 AC_MSG_RESULT([yes, non volatile])
261 AC_CHECK_TYPE(sig_atomic_t, int)
262 is_sig_atomic_t_volatile=no
264 if test $is_sig_atomic_t_volatile = 'yes'
266 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
268 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
272 dnl ############################################################################
273 dnl Check for functions
274 dnl ############################################################################
282 dnl getpt is a GNU Extension (glibc 2.1.x)
283 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
284 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
286 dnl replacing lstat with statlstat on sco makes it more portable between
288 AC_CHECK_FUNCS(statlstat)
290 dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
291 dnl We use only part of the functionality of mmap, so on AIX,
292 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
294 AS_HELP_STRING([--with-mmap], [Use the mmap call @<:@yes if found@:>@]))
295 if test x$with_mmap != xno; then
296 if test x$with_mmap = x; then
299 AC_DEFINE(HAVE_MMAP, 1)
303 dnl Sequent wants getprocessstats
304 AC_CHECK_LIB(seq, get_process_stats, [
306 AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
307 [Define if you have function `get_process_stats' and
308 have to use that instead of gettimeofday])])
313 dnl ############################################################################
314 dnl Internationalization
315 dnl ############################################################################
317 AC_CHECK_FUNCS([setlocale])
319 AM_GNU_GETTEXT([external], [need-ngettext])
320 AM_GNU_GETTEXT_VERSION([0.18.1])
324 dnl ############################################################################
325 dnl OS specific stuff
326 dnl ############################################################################
330 AC_PATH_PROG([PERL], [perl], [/QOpenSys/pkgs/bin/perl])
331 AC_PATH_PROG([PYTHON], [python], [/QOpenSys/pkgs/bin/python2])
332 AC_PATH_PROG([RUBY], [ruby], [/QOpenSys/pkgs/bin/ruby])
335 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
336 AC_PATH_PROG([PYTHON], [python], [/usr/bin/python])
337 AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby])
344 AC_DEFINE(_POSIX_SOURCE)
348 dnl If running under AIX, AC_AIX does not tell us that
349 AC_MSG_CHECKING([for AIX defines])
352 #if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
357 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
364 dnl utimensat is supported since glibc 2.6 and specified in POSIX.1-2008
365 dnl utimensat() causes different timespec structures to cause failures on IBM i and AIX
370 AC_CHECK_FUNCS([utimensat])
376 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
379 dnl Check linux/fs.h for FICLONE to support BTRFS's file clone operation
382 AC_CHECK_HEADERS([linux/fs.h])
385 dnl Check if the OS is supported by the console saver.
392 dnl Check for gpm mouse support (Linux only)
393 mouse_lib="xterm only"
394 AC_ARG_WITH([gpm-mouse],
395 AS_HELP_STRING([--with-gpm-mouse], [Compile with gpm mouse support (Linux only) @<:@yes if found@:>@]))
399 if test x$with_gpm_mouse != xno; then
400 AC_CHECK_LIB(gpm, Gpm_Repeat,
401 [AC_DEFINE(HAVE_LIBGPM, 1,
402 [Define to enable gpm mouse support on Linux])
403 mouse_lib="gpm and xterm"
404 MCLIBS="$MCLIBS -lgpm"],
405 if test "x$with_gpm_mouse" = "xyes"; then
406 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
408 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
416 dnl ############################################################################
418 dnl ############################################################################
420 LIBMC_VERSION="0.0.1"
422 AC_SUBST(LIBMC_VERSION)
423 AC_SUBST(LIBMC_RELEASE)
425 AC_ARG_ENABLE([mclib],
426 [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
428 if test "x$enableval" = "xno" ; then
431 if test "x$enable_shared" = "xno" ; then
432 AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
441 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
444 dnl ############################################################################
446 dnl ############################################################################
450 mc_WITH_INTERNAL_EDIT
452 dnl Diff viewer support.
453 AC_ARG_WITH([diff_viewer],
454 AS_HELP_STRING([--with-diff-viewer], [Compile with diff viewer @<:@yes@:>@]))
456 if test x$with_diff_viewer != xno; then
457 AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
460 AC_MSG_NOTICE([using diff viewer])
470 dnl ############################################################################
472 dnl ############################################################################
474 dnl ${prefix} and ${exec_prefix} are undefined here if --prefix is not used in command line
475 dnl Let define ${prefix} and ${exec_prefix}
476 test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"
477 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
479 if test x${libexecdir} = x'${exec_prefix}/libexec'; then
480 EXTHELPERSDIR=${prefix}/libexec/${PACKAGE}/ext.d
481 elif test x${libexecdir} = x'${exec_prefix}/lib'; then
482 EXTHELPERSDIR=${prefix}/lib/${PACKAGE}/ext.d
484 EXTHELPERSDIR=${libexecdir}/${PACKAGE}/ext.d
486 AC_SUBST(EXTHELPERSDIR)
489 dnl ############################################################################
491 dnl ############################################################################
493 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
496 dnl Determine which help translations we want to install.
497 ALL_DOC_LINGUAS="es hu it pl ru sr"
500 if test "x$USE_NLS" = xyes; then
501 if test -z "$LINGUAS"; then
502 langs="`grep -v '^#' $srcdir/po/LINGUAS`"
510 for h_lang in $ALL_DOC_LINGUAS; do
511 for lang in $langs; do
512 if test "$lang" = "$h_lang"; then
513 DOC_LINGUAS="$DOC_LINGUAS $lang"
518 AC_SUBST(DOC_LINGUAS)
528 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
531 dnl ############################################################################
532 dnl Configure results
533 dnl ############################################################################
535 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
543 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
544 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
545 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
546 AM_CONDITIONAL(USE_INTERNAL_EDIT, [test x"$use_internal_edit" = xyes ])
547 AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
548 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
549 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
550 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
551 dnl Clarify do we really need GModule
552 AM_CONDITIONAL([HAVE_GMODULE], [test -n "$g_module_supported" && \
553 test x"$textmode_x11_support" = x"yes" -o x"$enable_aspell" = x"yes"])
555 AC_ARG_ENABLE([configure-args],
556 AS_HELP_STRING([--enable-configure-args], [Handle all compiler warnings as errors]))
557 if test "x$enable_configure_args" != xno; then
558 AC_DEFINE([ENABLE_CONFIGURE_ARGS], 1, [Define to enable showing configure arguments in help])
559 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS], ["$ac_configure_args"], [MC configure arguments])
568 chmod +x src/man2hlp/man2hlp
575 contrib/dist/Makefile
576 contrib/dist/gentoo/Makefile
577 contrib/dist/redhat/Makefile
578 contrib/dist/redhat/mc.spec
580 contrib/dist/prototype
592 misc/macros.d/Makefile
596 src/consaver/Makefile
599 src/subshell/Makefile
601 src/diffviewer/Makefile
602 src/filemanager/Makefile
606 src/vfs/cpio/Makefile
608 src/vfs/extfs/Makefile
609 src/vfs/extfs/helpers/Makefile
610 src/vfs/extfs/helpers/a+
611 src/vfs/extfs/helpers/apt+
612 src/vfs/extfs/helpers/audio
613 src/vfs/extfs/helpers/deb
614 src/vfs/extfs/helpers/deba
615 src/vfs/extfs/helpers/debd
616 src/vfs/extfs/helpers/dpkg+
617 src/vfs/extfs/helpers/iso9660
618 src/vfs/extfs/helpers/hp48+
619 src/vfs/extfs/helpers/lslR
620 src/vfs/extfs/helpers/mailfs
621 src/vfs/extfs/helpers/patchfs
622 src/vfs/extfs/helpers/rpms+
623 src/vfs/extfs/helpers/s3+
624 src/vfs/extfs/helpers/uace
625 src/vfs/extfs/helpers/ualz
626 src/vfs/extfs/helpers/uar
627 src/vfs/extfs/helpers/uarc
628 src/vfs/extfs/helpers/uarj
629 src/vfs/extfs/helpers/ucab
630 src/vfs/extfs/helpers/uha
631 src/vfs/extfs/helpers/ulha
632 src/vfs/extfs/helpers/ulib
633 src/vfs/extfs/helpers/unar
634 src/vfs/extfs/helpers/urar
635 src/vfs/extfs/helpers/uwim
636 src/vfs/extfs/helpers/uzip
637 src/vfs/extfs/helpers/uzoo
639 src/vfs/fish/Makefile
640 src/vfs/fish/helpers/Makefile
642 src/vfs/ftpfs/Makefile
644 src/vfs/sftpfs/Makefile
646 src/vfs/local/Makefile
650 src/vfs/smbfs/Makefile
654 src/vfs/undelfs/Makefile
658 lib/filehighlight/Makefile
659 lib/mcconfig/Makefile
675 doc/hints/l10n/Makefile
699 tests/lib/mcconfig/Makefile
700 tests/lib/search/Makefile
701 tests/lib/strutil/Makefile
702 tests/lib/vfs/Makefile
703 tests/lib/widget/Makefile
705 tests/src/filemanager/Makefile
706 tests/src/editor/Makefile
707 tests/src/editor/test-data.txt
708 tests/src/vfs/Makefile
709 tests/src/vfs/extfs/Makefile
710 tests/src/vfs/extfs/helpers-list/Makefile
711 tests/src/vfs/extfs/helpers-list/data/config.sh
712 tests/src/vfs/extfs/helpers-list/misc/Makefile
713 tests/src/vfs/ftpfs/Makefile
722 Source code location: ${srcdir}
724 Compiler flags: ${CFLAGS}
725 Assertions: ${enable_assert}
726 Unit tests: ${tests_msg}
727 File system: ${vfs_type}
729 Screen library: ${screen_msg}
730 Mouse support: ${mouse_lib}
731 X11 events support: ${textmode_x11_support}
732 With subshell support: ${subshell}
733 With background operations: ${enable_background}
734 With ext2fs attributes support: ${ext2fs_attr_msg}
735 Internal editor: ${edit_msg}
736 Diff viewer: ${diff_msg}
737 Support for charset: ${charset_msg}
738 Search type: ${SEARCH_TYPE}
741 dnl option checking is disable by default due to AC_CONFIG_SUBDIRS
742 dnl we enable it back for top-level ./configure
743 if test -n "$ac_unrecognized_opts"; then
744 case $enable_option_checking in
745 fatal) AC_MSG_ERROR([unrecognized options: $ac_unrecognized_opts]) ;;
746 *) AC_MSG_WARN( [unrecognized options: $ac_unrecognized_opts]) ;;