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 -L option to file
119 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
120 if $HAVE_FILECMD; then
121 AC_MSG_CHECKING([for -L option to file command])
122 AC_CACHE_VAL(mc_cv_filel, [
123 file -L . > /dev/null 2>&1
130 if test x$mc_cv_filel = xyes; then
131 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
134 AC_MSG_RESULT([$filel])
137 dnl Only list browsers here that can be run in background (i.e. with `&')
138 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
141 dnl ############################################################################
142 dnl Check for other tools
143 dnl ############################################################################
145 AC_CHECK_TOOL(AR, ar, ar)
149 dnl ############################################################################
150 dnl Check for main libraies
151 dnl ############################################################################
154 mc_G_MODULE_SUPPORTED
157 dnl X11 support. Used to read keyboard modifiers when running under X11.
161 dnl ############################################################################
162 dnl Check for header files
163 dnl ############################################################################
165 AC_CHECK_HEADERS([string.h memory.h limits.h malloc.h \
166 utime.h sys/statfs.h sys/vfs.h \
167 sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
169 dnl This macro is redefined in m4.include/gnulib/sys_types_h.m4
170 dnl to work around a buggy version in autoconf <= 2.69.
174 dnl ############################################################################
176 dnl ############################################################################
178 dnl Check largefile before type sizeof checks
181 AC_CHECK_SIZEOF(long)
183 AC_CHECK_SIZEOF(uintmax_t)
185 AC_CHECK_SIZEOF(off_t)
187 gl_PROMOTED_TYPE_MODE_T
192 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev, struct stat.st_mtim])
195 AH_TEMPLATE([sig_atomic_t],
196 [/* Define to `int' if <signal.h> doesn't define.])
197 AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
198 [Some systems declare sig_atomic_t as volatile, some others -- no.
199 This define will have value `sig_atomic_t' or
200 `volatile sig_atomic_t' accordingly.])
202 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
203 AC_EGREP_HEADER(sig_atomic_t,signal.h,
205 ac_cv_type_sig_atomic_t=yes;
206 AC_EGREP_HEADER(volatile.*sig_atomic_t,
209 is_sig_atomic_t_volatile=yes;
210 AC_MSG_RESULT([yes, volatile])
213 is_sig_atomic_t_volatile=no;
214 AC_MSG_RESULT([yes, non volatile])
219 AC_CHECK_TYPE(sig_atomic_t, int)
220 is_sig_atomic_t_volatile=no
222 if test $is_sig_atomic_t_volatile = 'yes'
224 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
226 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
230 dnl ############################################################################
231 dnl Check for functions
232 dnl ############################################################################
240 dnl getpt is a GNU Extension (glibc 2.1.x)
241 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
242 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
244 dnl replacing lstat with statlstat on sco makes it more portable between
246 AC_CHECK_FUNCS(statlstat)
248 dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
249 dnl We use only part of the functionality of mmap, so on AIX,
250 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
252 AS_HELP_STRING([--with-mmap], [Use the mmap call @<:@yes if found@:>@]))
253 if test x$with_mmap != xno; then
254 if test x$with_mmap = x; then
257 AC_DEFINE(HAVE_MMAP, 1)
261 dnl Sequent wants getprocessstats
262 AC_CHECK_LIB(seq, get_process_stats, [
264 AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
265 [Define if you have function `get_process_stats' and
266 have to use that instead of gettimeofday])])
271 dnl ############################################################################
272 dnl Internationalization
273 dnl ############################################################################
275 AC_CHECK_FUNCS([setlocale])
277 AM_GNU_GETTEXT([external], [need-ngettext])
278 AM_GNU_GETTEXT_VERSION([0.18.1])
282 dnl ############################################################################
283 dnl OS specific stuff
284 dnl ############################################################################
288 AC_PATH_PROG([PERL], [perl], [/QOpenSys/pkgs/bin/perl])
289 AC_PATH_PROG([PYTHON], [python], [/QOpenSys/pkgs/bin/python2])
290 AC_PATH_PROG([RUBY], [ruby], [/QOpenSys/pkgs/bin/ruby])
293 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
294 AC_PATH_PROG([PYTHON], [python], [/usr/bin/python])
295 AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby])
302 AC_DEFINE(_POSIX_SOURCE)
306 dnl If running under AIX, AC_AIX does not tell us that
307 AC_MSG_CHECKING([for AIX defines])
310 #if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
315 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
322 dnl utimensat is supported since glibc 2.6 and specified in POSIX.1-2008
323 dnl utimensat() causes different timespec structures to cause failures on IBM i and AIX
328 AC_CHECK_FUNCS([utimensat])
334 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
337 dnl Check linux/fs.h for FICLONE to support BTRFS's file clone operation
340 AC_CHECK_HEADERS([linux/fs.h])
343 dnl Check if the OS is supported by the console saver.
350 dnl Check for gpm mouse support (Linux only)
351 mouse_lib="xterm only"
352 AC_ARG_WITH([gpm-mouse],
353 AS_HELP_STRING([--with-gpm-mouse], [Compile with gpm mouse support (Linux only) @<:@yes if found@:>@]))
357 if test x$with_gpm_mouse != xno; then
358 AC_CHECK_LIB(gpm, Gpm_Repeat,
359 [AC_DEFINE(HAVE_LIBGPM, 1,
360 [Define to enable gpm mouse support on Linux])
361 mouse_lib="gpm and xterm"
362 MCLIBS="$MCLIBS -lgpm"],
363 if test "x$with_gpm_mouse" = "xyes"; then
364 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
366 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
374 dnl ############################################################################
376 dnl ############################################################################
378 LIBMC_VERSION="0.0.1"
380 AC_SUBST(LIBMC_VERSION)
381 AC_SUBST(LIBMC_RELEASE)
383 AC_ARG_ENABLE([mclib],
384 [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
386 if test "x$enableval" = "xno" ; then
389 if test "x$enable_shared" = "xno" ; then
390 AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
399 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
402 dnl ############################################################################
403 dnl Where config files should be placed
404 dnl ############################################################################
406 AC_ARG_WITH([homedir],
407 AS_HELP_STRING([--with-homedir],
408 [Choose any place of user settings relative to home dir, or XDG for respect XDG standards @<:@XDG@:>@]),
410 dnl Unfortunately, there is no way to tell AC_ARG_WITH that the
411 dnl argument value is required, so we can't differentiate
412 dnl between `--with-homedir` and `--with-homedir=yes`, because
413 dnl `with_homedir` is set to `yes` in both cases.
415 dnl We opt to set `with_homedir` to `.mc` if the value is `yes`
416 dnl in order to avoid the surprise for users using
417 dnl `--with-homedir` w/o any value and then getting mc to store
418 dnl settings in the `yes` directory.
420 if test "x$withval" = "xXDG"; then
422 elif test "x$withval" = "xyes"; then
425 with_homedir=$withval
431 if test x$with_homedir = xXDG; then
432 AC_DEFINE(MC_HOMEDIR_XDG, 1, [Define to enable XDG standard support])
434 AC_DEFINE(MC_HOMEDIR_XDG, 0, [Define to disable XDG standard support])
435 AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
439 dnl ############################################################################
441 dnl ############################################################################
445 mc_WITH_INTERNAL_EDIT
447 dnl Diff viewer support.
448 AC_ARG_WITH([diff_viewer],
449 AS_HELP_STRING([--with-diff-viewer], [Compile with diff viewer @<:@yes@:>@]))
451 if test x$with_diff_viewer != xno; then
452 AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
455 AC_MSG_NOTICE([using diff viewer])
464 dnl ############################################################################
466 dnl ############################################################################
468 dnl ${prefix} and ${exec_prefix} are undefined here if --prefix is not used in command line
469 dnl Let define ${prefix} and ${exec_prefix}
470 test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"
471 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
473 if test x${libexecdir} = x'${exec_prefix}/libexec'; then
474 EXTHELPERSDIR=${prefix}/libexec/${PACKAGE}/ext.d
475 elif test x${libexecdir} = x'${exec_prefix}/lib'; then
476 EXTHELPERSDIR=${prefix}/lib/${PACKAGE}/ext.d
478 EXTHELPERSDIR=${libexecdir}/${PACKAGE}/ext.d
480 AC_SUBST(EXTHELPERSDIR)
483 dnl ############################################################################
485 dnl ############################################################################
487 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
490 dnl Determine which help translations we want to install.
491 ALL_DOC_LINGUAS="es hu it pl ru sr"
494 if test "x$USE_NLS" = xyes; then
495 if test -z "$LINGUAS"; then
496 langs="`grep -v '^#' $srcdir/po/LINGUAS`"
504 for h_lang in $ALL_DOC_LINGUAS; do
505 for lang in $langs; do
506 if test "$lang" = "$h_lang"; then
507 DOC_LINGUAS="$DOC_LINGUAS $lang"
512 AC_SUBST(DOC_LINGUAS)
522 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
525 dnl ############################################################################
526 dnl Configure results
527 dnl ############################################################################
529 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
537 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
538 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
539 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
540 AM_CONDITIONAL(USE_INTERNAL_EDIT, [test x"$use_internal_edit" = xyes ])
541 AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
542 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
543 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
544 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
545 dnl Clarify do we really need GModule
546 AM_CONDITIONAL([HAVE_GMODULE], [test -n "$g_module_supported" && \
547 test x"$textmode_x11_support" = x"yes" -o x"$enable_aspell" = x"yes"])
549 AC_ARG_ENABLE([configure-args],
550 AS_HELP_STRING([--enable-configure-args], [Handle all compiler warnings as errors]))
551 if test "x$enable_configure_args" != xno; then
552 AC_DEFINE([ENABLE_CONFIGURE_ARGS], 1, [Define to enable showing configure arguments in help])
553 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS], ["$ac_configure_args"], [MC configure arguments])
562 chmod +x src/man2hlp/man2hlp
569 contrib/dist/Makefile
570 contrib/dist/gentoo/Makefile
571 contrib/dist/redhat/Makefile
572 contrib/dist/redhat/mc.spec
574 contrib/dist/prototype
586 misc/macros.d/Makefile
590 src/consaver/Makefile
593 src/subshell/Makefile
595 src/diffviewer/Makefile
596 src/filemanager/Makefile
600 src/vfs/cpio/Makefile
602 src/vfs/extfs/Makefile
603 src/vfs/extfs/helpers/Makefile
604 src/vfs/extfs/helpers/a+
605 src/vfs/extfs/helpers/apt+
606 src/vfs/extfs/helpers/audio
607 src/vfs/extfs/helpers/deb
608 src/vfs/extfs/helpers/deba
609 src/vfs/extfs/helpers/debd
610 src/vfs/extfs/helpers/dpkg+
611 src/vfs/extfs/helpers/iso9660
612 src/vfs/extfs/helpers/hp48+
613 src/vfs/extfs/helpers/lslR
614 src/vfs/extfs/helpers/mailfs
615 src/vfs/extfs/helpers/patchfs
616 src/vfs/extfs/helpers/rpms+
617 src/vfs/extfs/helpers/s3+
618 src/vfs/extfs/helpers/uace
619 src/vfs/extfs/helpers/ualz
620 src/vfs/extfs/helpers/uar
621 src/vfs/extfs/helpers/uarc
622 src/vfs/extfs/helpers/uarj
623 src/vfs/extfs/helpers/ucab
624 src/vfs/extfs/helpers/uha
625 src/vfs/extfs/helpers/ulha
626 src/vfs/extfs/helpers/ulib
627 src/vfs/extfs/helpers/urar
628 src/vfs/extfs/helpers/uzip
629 src/vfs/extfs/helpers/uzoo
631 src/vfs/fish/Makefile
632 src/vfs/fish/helpers/Makefile
634 src/vfs/ftpfs/Makefile
636 src/vfs/sftpfs/Makefile
638 src/vfs/local/Makefile
642 src/vfs/smbfs/Makefile
646 src/vfs/undelfs/Makefile
650 lib/filehighlight/Makefile
651 lib/mcconfig/Makefile
667 doc/hints/l10n/Makefile
691 tests/lib/mcconfig/Makefile
692 tests/lib/search/Makefile
693 tests/lib/strutil/Makefile
694 tests/lib/vfs/Makefile
695 tests/lib/widget/Makefile
697 tests/src/filemanager/Makefile
698 tests/src/editor/Makefile
699 tests/src/editor/test-data.txt
700 tests/src/vfs/Makefile
701 tests/src/vfs/extfs/Makefile
702 tests/src/vfs/extfs/helpers-list/Makefile
703 tests/src/vfs/extfs/helpers-list/data/config.sh
704 tests/src/vfs/extfs/helpers-list/misc/Makefile
713 Source code location: ${srcdir}
715 Compiler flags: ${CFLAGS}
716 Assertions: ${enable_assert}
717 Unit tests: ${tests_msg}
718 File system: ${vfs_type}
720 Screen library: ${screen_msg}
721 Mouse support: ${mouse_lib}
722 X11 events support: ${textmode_x11_support}
723 With subshell support: ${subshell}
724 With background operations: ${enable_background}
725 Internal editor: ${edit_msg}
726 Diff viewer: ${diff_msg}
727 Support for charset: ${charset_msg}
728 Search type: ${SEARCH_TYPE}
731 dnl option checking is disable by default due to AC_CONFIG_SUBDIRS
732 dnl we enable it back for top-level ./configure
733 if test -n "$ac_unrecognized_opts"; then
734 case $enable_option_checking in
735 fatal) AC_MSG_ERROR([unrecognized options: $ac_unrecognized_opts]) ;;
736 *) AC_MSG_WARN( [unrecognized options: $ac_unrecognized_opts]) ;;