2 dnl Configure.in file for the Midnight Commander
5 dnl 2.64 is required at least for m4_esyscmd_s()
8 AC_INIT([GNU Midnight Commander], m4_esyscmd_s([./version.sh .]),
9 [https://www.midnight-commander.org/wiki/NewTicket], [mc],
10 [https://www.midnight-commander.org/])
12 m4_pattern_forbid(MC_)
13 AC_CONFIG_MACRO_DIR([m4])
14 AC_CONFIG_AUX_DIR(config)
15 AC_CONFIG_SRCDIR(src/main.c)
16 AC_CONFIG_HEADERS(config.h)
18 dnl Apply "no-define" to avoid defining the VERSION macro in config.h
19 AM_INIT_AUTOMAKE([no-define])
20 dnl PACKAGE macro isn't defined if "no-define" is applied
21 AC_DEFINE([PACKAGE], ["mc"], [Name of package])
23 dnl Enable silent rules by default (if yes)
24 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
32 AC_USE_SYSTEM_EXTENSIONS
35 dnl ############################################################################
36 dnl Check for compiler
37 dnl ############################################################################
45 if test "x$CFLAGS" = "x"; then
48 if test x$USE_MAINTAINER_MODE = xyes; then
49 CFLAGS_OPTS="-g3 -O -ggdb"
50 AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
53 AC_ARG_ENABLE([werror],
54 AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors]))
55 if test "x$enable_werror" = xyes; then
56 AX_APPEND_COMPILE_FLAGS([-Werror], [mc_configured_cflags])
59 dnl Compiler can generate warnings for unrecognized flags added to CFLAGS
60 dnl which causes attribute checks to fail
61 ax_gcc_func_attribute_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
62 _AC_LANG_PREFIX[]FLAGS=
63 AX_GCC_FUNC_ATTRIBUTE([fallthrough])
64 _AC_LANG_PREFIX[]FLAGS=$ax_gcc_func_attribute_save_flags
65 unset ax_gcc_func_attribute_save_flags
70 dnl ############################################################################
71 dnl Check for programs
72 dnl ############################################################################
77 dnl See also the "OS specific stuff" section below.
79 dnl Check nroff and the options it supports
80 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
85 AC_MSG_CHECKING([for manual formatting macros])
86 AC_CACHE_VAL(mc_cv_mandoc, [
87 nroff -mandoc < /dev/null > /dev/null 2>&1
95 AC_MSG_RESULT([$MANDOC])
97 AC_MSG_CHECKING([for option to disable ANSI color in manuals])
98 AC_CACHE_VAL(mc_cv_man_nocolor, [
99 nroff -c < /dev/null > /dev/null 2>&1
106 MAN_FLAGS=$mc_cv_man_nocolor
107 AC_MSG_RESULT([${MAN_NOCOLOR-none}])
109 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
110 AC_CACHE_VAL(mc_cv_nroff_tascii, [
112 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
114 mc_cv_nroff_tascii=-Tlatin1
116 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
118 mc_cv_nroff_tascii=-Tascii
122 AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
123 MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
129 dnl Check for -z, -b, -L, and -S options to file
130 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
131 if $HAVE_FILECMD; then
132 dnl Don't use the file command if it doesn't accept the -z option
133 AC_MSG_CHECKING([for -z option to file command])
134 AC_CACHE_VAL(mc_cv_file_z, [
135 file -z . > /dev/null 2>&1
142 AC_MSG_RESULT([$mc_cv_file_z])
144 if test x$mc_cv_file_z = xyes; then
145 AC_DEFINE(USE_FILE_CMD, 1, [Define if the file command accepts the -z option])
147 AC_MSG_WARN([The file command doesn't accept the -z option and will not be used])
150 if test x$mc_cv_file_z = xyes; then
151 dnl file is used; check -b, -L and -S options
153 AC_MSG_CHECKING([for -b option to file command])
154 AC_CACHE_VAL(mc_cv_file_b, [
155 file -b . > /dev/null 2>&1
162 AC_MSG_RESULT([$mc_cv_file_b])
164 if test x$mc_cv_file_b = xyes; then
165 AC_DEFINE(FILE_B, "-b ", [Define if the file command accepts the -b option])
168 AC_MSG_CHECKING([for -L option to file command])
169 AC_CACHE_VAL(mc_cv_file_L, [
170 file -L . > /dev/null 2>&1
177 AC_MSG_RESULT([$mc_cv_file_L])
179 if test x$mc_cv_file_L = xyes; then
180 AC_DEFINE(FILE_L, "-L ", [Define if the file command accepts the -L option])
182 AC_DEFINE(FILE_L, "", [Define if the file command accepts the -L option])
185 dnl The file command accepts the -S option since 5.33
186 AC_MSG_CHECKING([for -S option to file command])
187 AC_CACHE_VAL(mc_cv_file_S, [
188 file -S . > /dev/null 2>&1
195 AC_MSG_RESULT([$mc_cv_file_S])
197 if test x$mc_cv_file_S = xyes; then
198 AC_DEFINE(FILE_S, "-S ", [Define if file command accepts the -S option])
200 AC_DEFINE(FILE_S, "", [Define if file command accepts the -S option])
205 dnl Only list browsers here that can be run in background (i.e. with `&')
206 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
209 dnl ############################################################################
210 dnl Check for other tools
211 dnl ############################################################################
213 AC_CHECK_TOOL(AR, ar, ar)
217 dnl ############################################################################
218 dnl Check for main libraies
219 dnl ############################################################################
222 mc_G_MODULE_SUPPORTED
225 dnl X11 support. Used to read keyboard modifiers when running under X11.
229 dnl ############################################################################
230 dnl Check for header files
231 dnl ############################################################################
233 AC_CHECK_HEADERS([string.h memory.h limits.h malloc.h \
234 utime.h sys/statfs.h sys/vfs.h \
235 sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
237 dnl This macro is redefined in m4.include/gnulib/sys_types_h.m4
238 dnl to work around a buggy version in autoconf <= 2.69.
242 dnl ############################################################################
244 dnl ############################################################################
246 dnl Check largefile before type sizeof checks
249 AC_CHECK_SIZEOF(long)
251 AC_CHECK_SIZEOF(uintmax_t)
253 AC_CHECK_SIZEOF(off_t)
255 gl_PROMOTED_TYPE_MODE_T
260 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev, struct stat.st_mtim])
263 AH_TEMPLATE([sig_atomic_t],
264 [/* Define to `int' if <signal.h> doesn't define.])
265 AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
266 [Some systems declare sig_atomic_t as volatile, some others -- no.
267 This define will have value `sig_atomic_t' or
268 `volatile sig_atomic_t' accordingly.])
270 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
271 AC_EGREP_HEADER(sig_atomic_t,signal.h,
273 ac_cv_type_sig_atomic_t=yes;
274 AC_EGREP_HEADER(volatile.*sig_atomic_t,
277 is_sig_atomic_t_volatile=yes;
278 AC_MSG_RESULT([yes, volatile])
281 is_sig_atomic_t_volatile=no;
282 AC_MSG_RESULT([yes, non volatile])
287 AC_CHECK_TYPE(sig_atomic_t, int)
288 is_sig_atomic_t_volatile=no
290 if test $is_sig_atomic_t_volatile = 'yes'
292 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
294 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
298 dnl ############################################################################
299 dnl Check for functions
300 dnl ############################################################################
308 dnl getpt is a GNU Extension (glibc 2.1.x)
309 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
310 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
312 dnl replacing lstat with statlstat on sco makes it more portable between
314 AC_CHECK_FUNCS(statlstat)
316 dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
317 dnl We use only part of the functionality of mmap, so on AIX,
318 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
320 AS_HELP_STRING([--with-mmap], [Use the mmap call @<:@yes if found@:>@]))
321 if test x$with_mmap != xno; then
322 if test x$with_mmap = x; then
325 AC_DEFINE(HAVE_MMAP, 1)
332 dnl ############################################################################
333 dnl Internationalization
334 dnl ############################################################################
336 AC_CHECK_FUNCS([setlocale])
338 AM_GNU_GETTEXT([external], [need-ngettext])
339 AM_GNU_GETTEXT_VERSION([0.18.2])
343 dnl ############################################################################
344 dnl OS specific stuff
345 dnl ############################################################################
349 AC_PATH_PROG([PERL], [perl], [/QOpenSys/pkgs/bin/perl])
350 AC_PATH_PROG([PYTHON], [python], [/QOpenSys/pkgs/bin/python2])
351 AC_PATH_PROG([RUBY], [ruby], [/QOpenSys/pkgs/bin/ruby])
354 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
355 AC_PATH_PROG([PYTHON], [python], [/usr/bin/python])
356 AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby])
363 AC_DEFINE(_POSIX_SOURCE)
367 dnl If running under AIX, AC_AIX does not tell us that
368 AC_MSG_CHECKING([for AIX defines])
371 #if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
376 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
383 dnl utimensat is supported since glibc 2.6 and specified in POSIX.1-2008
384 dnl utimensat() causes different timespec structures to cause failures on IBM i and AIX
389 AC_CHECK_FUNCS([utimensat])
395 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
398 dnl Check linux/fs.h for FICLONE to support BTRFS's file clone operation
401 AC_CHECK_HEADERS([linux/fs.h])
404 dnl Check if the OS is supported by the console saver.
411 dnl Check for gpm mouse support (Linux only)
412 mouse_lib="xterm only"
413 AC_ARG_WITH([gpm-mouse],
414 AS_HELP_STRING([--with-gpm-mouse], [Compile with gpm mouse support (Linux only) @<:@yes if found@:>@]))
418 if test x$with_gpm_mouse != xno; then
419 AC_CHECK_LIB(gpm, Gpm_Repeat,
420 [AC_DEFINE(HAVE_LIBGPM, 1,
421 [Define to enable gpm mouse support on Linux])
422 mouse_lib="gpm and xterm"
423 MCLIBS="$MCLIBS -lgpm"],
424 if test "x$with_gpm_mouse" = "xyes"; then
425 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
427 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
435 dnl ############################################################################
437 dnl ############################################################################
439 LIBMC_VERSION="0.0.1"
441 AC_SUBST(LIBMC_VERSION)
442 AC_SUBST(LIBMC_RELEASE)
444 AC_ARG_ENABLE([mclib],
445 [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
447 if test "x$enableval" = "xno" ; then
450 if test "x$enable_shared" = "xno" ; then
451 AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
460 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
463 dnl ############################################################################
465 dnl ############################################################################
469 mc_WITH_INTERNAL_EDIT
471 dnl Diff viewer support.
472 AC_ARG_WITH([diff_viewer],
473 AS_HELP_STRING([--with-diff-viewer], [Compile with diff viewer @<:@yes@:>@]))
475 if test x$with_diff_viewer != xno; then
476 AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
479 AC_MSG_NOTICE([using diff viewer])
489 dnl ############################################################################
491 dnl ############################################################################
493 dnl ${prefix} and ${exec_prefix} are undefined here if --prefix is not used in command line
494 dnl Let define ${prefix} and ${exec_prefix}
495 test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"
496 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
498 if test x${libexecdir} = x'${exec_prefix}/libexec'; then
499 EXTHELPERSDIR=${prefix}/libexec/${PACKAGE}/ext.d
500 elif test x${libexecdir} = x'${exec_prefix}/lib'; then
501 EXTHELPERSDIR=${prefix}/lib/${PACKAGE}/ext.d
503 EXTHELPERSDIR=${libexecdir}/${PACKAGE}/ext.d
505 AC_SUBST(EXTHELPERSDIR)
508 dnl ############################################################################
510 dnl ############################################################################
512 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
515 dnl Determine which help translations we want to install.
516 ALL_DOC_LINGUAS="es hu it pl ru sr"
519 if test "x$USE_NLS" = xyes; then
520 if test -z "$LINGUAS"; then
521 langs="`grep -v '^#' $srcdir/po/LINGUAS`"
529 for h_lang in $ALL_DOC_LINGUAS; do
530 for lang in $langs; do
531 if test "$lang" = "$h_lang"; then
532 DOC_LINGUAS="$DOC_LINGUAS $lang"
537 AC_SUBST(DOC_LINGUAS)
547 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
550 dnl ############################################################################
551 dnl Configure results
552 dnl ############################################################################
554 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
562 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
563 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
564 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
565 AM_CONDITIONAL(USE_INTERNAL_EDIT, [test x"$use_internal_edit" = xyes ])
566 AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
567 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
568 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
569 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
570 dnl Clarify do we really need GModule
571 AM_CONDITIONAL([HAVE_GMODULE], [test -n "$g_module_supported" && \
572 test x"$textmode_x11_support" = x"yes" -o x"$enable_aspell" = x"yes"])
574 AC_ARG_ENABLE([configure-args],
575 AS_HELP_STRING([--enable-configure-args], [Handle all compiler warnings as errors]))
576 if test "x$enable_configure_args" != xno; then
577 AC_DEFINE([ENABLE_CONFIGURE_ARGS], 1, [Define to enable showing configure arguments in help])
578 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS], ["$ac_configure_args"], [MC configure arguments])
587 chmod +x src/man2hlp/man2hlp
605 misc/macros.d/Makefile
609 src/consaver/Makefile
612 src/subshell/Makefile
614 src/diffviewer/Makefile
615 src/filemanager/Makefile
619 src/vfs/cpio/Makefile
621 src/vfs/extfs/Makefile
622 src/vfs/extfs/helpers/Makefile
623 src/vfs/extfs/helpers/a+
624 src/vfs/extfs/helpers/apt+
625 src/vfs/extfs/helpers/audio
626 src/vfs/extfs/helpers/deb
627 src/vfs/extfs/helpers/deba
628 src/vfs/extfs/helpers/debd
629 src/vfs/extfs/helpers/dpkg+
630 src/vfs/extfs/helpers/iso9660
631 src/vfs/extfs/helpers/hp48+
632 src/vfs/extfs/helpers/lslR
633 src/vfs/extfs/helpers/mailfs
634 src/vfs/extfs/helpers/patchfs
635 src/vfs/extfs/helpers/rpms+
636 src/vfs/extfs/helpers/s3+
637 src/vfs/extfs/helpers/uace
638 src/vfs/extfs/helpers/ualz
639 src/vfs/extfs/helpers/uar
640 src/vfs/extfs/helpers/uarc
641 src/vfs/extfs/helpers/uarj
642 src/vfs/extfs/helpers/ucab
643 src/vfs/extfs/helpers/uha
644 src/vfs/extfs/helpers/ulha
645 src/vfs/extfs/helpers/ulib
646 src/vfs/extfs/helpers/unar
647 src/vfs/extfs/helpers/urar
648 src/vfs/extfs/helpers/uwim
649 src/vfs/extfs/helpers/uzip
650 src/vfs/extfs/helpers/uzoo
652 src/vfs/fish/Makefile
653 src/vfs/fish/helpers/Makefile
655 src/vfs/ftpfs/Makefile
657 src/vfs/sftpfs/Makefile
659 src/vfs/local/Makefile
665 src/vfs/undelfs/Makefile
669 lib/filehighlight/Makefile
670 lib/mcconfig/Makefile
686 doc/hints/l10n/Makefile
710 tests/lib/mcconfig/Makefile
711 tests/lib/search/Makefile
712 tests/lib/strutil/Makefile
713 tests/lib/vfs/Makefile
714 tests/lib/widget/Makefile
716 tests/src/filemanager/Makefile
717 tests/src/editor/Makefile
718 tests/src/editor/test-data.txt
719 tests/src/vfs/Makefile
720 tests/src/vfs/extfs/Makefile
721 tests/src/vfs/extfs/helpers-list/Makefile
722 tests/src/vfs/extfs/helpers-list/data/config.sh
723 tests/src/vfs/extfs/helpers-list/misc/Makefile
724 tests/src/vfs/ftpfs/Makefile
733 Source code location: ${srcdir}
735 Compiler flags: ${CFLAGS}
736 Assertions: ${enable_assert}
737 Unit tests: ${tests_msg}
738 File system: ${vfs_type}
740 Screen library: ${screen_msg}
741 Mouse support: ${mouse_lib}
742 X11 events support: ${textmode_x11_support}
743 With subshell support: ${subshell}
744 With background operations: ${enable_background}
745 With ext2fs attributes support: ${ext2fs_attr_msg}
746 Internal editor: ${edit_msg}
747 Diff viewer: ${diff_msg}
748 Support for charset: ${charset_msg}
749 Search type: ${SEARCH_TYPE}
752 dnl option checking is disable by default due to AC_CONFIG_SUBDIRS
753 dnl we enable it back for top-level ./configure
754 if test -n "$ac_unrecognized_opts"; then
755 case $enable_option_checking in
756 fatal) AC_MSG_ERROR([unrecognized options: $ac_unrecognized_opts]) ;;
757 *) AC_MSG_WARN( [unrecognized options: $ac_unrecognized_opts]) ;;