Add support of reading parameters for external editor/viewer from main config.
[midnight-commander.git] / configure.ac
blob6e2bc486f75f575f21c73325821fb70f9a5e01a4
1 dnl
2 dnl Configure.in file for the Midnight Commander
3 dnl
5 AC_PREREQ(2.60)
6 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
7 m4_pattern_forbid(MC_)
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)
12 MC_VERSION
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])])
17 AM_MAINTAINER_MODE
19 AC_CANONICAL_HOST
21 AC_USE_SYSTEM_EXTENSIONS
24 dnl ############################################################################
25 dnl Check for compiler
26 dnl ############################################################################
28 AC_PROG_CC_STDC
29 AM_PROG_CC_C_O
31 MC_CHECK_CFLAGS
33 CFLAGS_OPTS=""
34 if test "x$CFLAGS" = "x"; then
35     CFLAGS_OPTS=" -O2 "
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 AC_PROG_LIBTOOL
51 dnl ############################################################################
52 dnl Check for programs
53 dnl ############################################################################
55 PKG_PROG_PKG_CONFIG
56 AC_PROG_INSTALL
57 AC_PROG_LN_S
58 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
59 AC_PATH_PROG([PYTHON], [python], [/usr/bin/python])
60 AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby])
62 dnl Check nroff and the options it supports
63 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
64 dnl Default values
65 MANDOC=-man
66 MAN_FLAGS=
67 if $HAVE_nroff; then
68     AC_MSG_CHECKING([for manual formatting macros])
69     AC_CACHE_VAL(mc_cv_mandoc, [
70     nroff -mandoc < /dev/null > /dev/null 2>&1
71     if test $? = 0; then
72         mc_cv_mandoc=-mandoc
73     else
74         mc_cv_mandoc=-man
75     fi
76     ])
77     MANDOC=$mc_cv_mandoc
78     AC_MSG_RESULT([$MANDOC])
80     AC_MSG_CHECKING([for option to disable ANSI color in manuals])
81     AC_CACHE_VAL(mc_cv_man_nocolor, [
82     nroff -c < /dev/null > /dev/null 2>&1
83     if test $? = 0; then
84         mc_cv_man_nocolor=-c
85     else
86         mc_cv_man_nocolor=
87     fi
88     ])
89     MAN_FLAGS=$mc_cv_man_nocolor
90     AC_MSG_RESULT([${MAN_NOCOLOR-none}])
92     AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
93     AC_CACHE_VAL(mc_cv_nroff_tascii, [
94     mc_cv_nroff_tascii=
95     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
96     if test $? = 0; then
97         mc_cv_nroff_tascii=-Tlatin1
98     else
99         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
100         if test $? = 0; then
101             mc_cv_nroff_tascii=-Tascii
102         fi
103     fi
104     ])
105     AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
106     MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
109 AC_SUBST(MANDOC)
110 AC_SUBST(MAN_FLAGS)
112 dnl Check for -L option to file
113 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
114 if $HAVE_FILECMD; then
115     AC_MSG_CHECKING([for -L option to file command])
116     AC_CACHE_VAL(mc_cv_filel, [
117     file -L . > /dev/null 2>&1
118     if test $? = 0; then
119         mc_cv_filel=yes
120     else
121         mc_cv_filel=no
122     fi
123     ])
124     if test x$mc_cv_filel = xyes; then
125         AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
126     fi
127     filel=$mc_cv_filel
128     AC_MSG_RESULT([$filel])
131 dnl Only list browsers here that can be run in background (i.e. with `&')
132 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
135 dnl ############################################################################
136 dnl Check for other tools
137 dnl ############################################################################
139 AC_CHECK_TOOL(AR, ar, ar)
140 MC_UNIT_TESTS
143 dnl ############################################################################
144 dnl Check for main libraies
145 dnl ############################################################################
147 AC_CHECK_GLIB
148 AC_G_MODULE_SUPPORTED
149 MC_WITH_SCREEN
150 MC_CHECK_SEARCH_TYPE
151 dnl X11 support. Used to read keyboard modifiers when running under X11.
152 MC_WITH_X
155 dnl ############################################################################
156 dnl Check for header files
157 dnl ############################################################################
159 AC_CHECK_HEADERS([unistd.h string.h memory.h limits.h malloc.h \
160         utime.h fcntl.h sys/statfs.h sys/vfs.h sys/time.h \
161         sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
162         sys/socket.h sys/sysmacros.h sys/types.h sys/mkdev.h])
163 AC_HEADER_MAJOR
164 AC_HEADER_TIME
165 AC_HEADER_DIRENT
166 AC_HEADER_ASSERT
169 dnl ############################################################################
170 dnl Check for types
171 dnl ############################################################################
173 AC_C_CONST
174 dnl Check largefile before type sizeof checks
175 AC_SYS_LARGEFILE
177 AC_CHECK_SIZEOF(long)
178 AC_TYPE_UINTMAX_T
179 AC_CHECK_SIZEOF(uintmax_t)
180 AC_TYPE_OFF_T
181 AC_CHECK_SIZEOF(off_t)
182 AC_TYPE_MODE_T
183 AC_TYPE_PID_T
184 AC_TYPE_UID_T
186 AC_STRUCT_ST_BLOCKS
187 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
189 AH_TEMPLATE([sig_atomic_t],
190             [/* Define to `int' if <signal.h> doesn't define.])
191 AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
192             [Some systems declare sig_atomic_t as volatile, some others -- no.
193              This define will have value `sig_atomic_t' or
194              `volatile sig_atomic_t' accordingly.])
196 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
197 AC_EGREP_HEADER(sig_atomic_t,signal.h,
198   [
199     ac_cv_type_sig_atomic_t=yes;
200     AC_EGREP_HEADER(volatile.*sig_atomic_t,
201                     signal.h,
202                     [
203                         is_sig_atomic_t_volatile=yes;
204                         AC_MSG_RESULT([yes, volatile])
205                     ],
206                     [
207                         is_sig_atomic_t_volatile=no;
208                         AC_MSG_RESULT([yes, non volatile])
209                     ])
210   ],
211   [
212     AC_MSG_RESULT(no)
213     AC_CHECK_TYPE(sig_atomic_t, int)
214     is_sig_atomic_t_volatile=no
215   ])
216 if test $is_sig_atomic_t_volatile = 'yes'
217 then
218     AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
219 else
220     AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
224 dnl ############################################################################
225 dnl Check for functions
226 dnl ############################################################################
228 AC_CHECK_FUNCS([\
229         isascii \
230         statfs sysconf \
231         tcgetattr tcsetattr \
232         ftruncate \
233         strverscmp \
234         strncasecmp \
235         realpath
237 AC_FUNC_STRCOLL
239 dnl getpt is a GNU Extension (glibc 2.1.x)
240 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
241 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
243 dnl replacing lstat with statlstat on sco makes it more portable between
244 dnl sco clones
245 AC_CHECK_FUNCS(statlstat)
247 dnl Ovverriding mmap support.  This has to be before AC_FUNC_MMAP is used.
248 dnl We use only part of the functionality of mmap, so on AIX,
249 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
250 AC_ARG_WITH([mmap],
251         AS_HELP_STRING([--with-mmap], [Use the mmap call @<:@yes if found@:>@]))
252 if test x$with_mmap != xno; then
253     if test x$with_mmap = x; then
254         AC_FUNC_MMAP
255     else
256         AC_DEFINE(HAVE_MMAP, 1)
257     fi
260 dnl Sequent wants getprocessstats
261 AC_CHECK_LIB(seq, get_process_stats, [
262         LIBS="$LIBS -lseq"
263         AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
264                   [Define if you have function `get_process_stats' and
265 have to use that instead of gettimeofday])])
267 mc_AC_GET_FS_INFO
270 dnl ############################################################################
271 dnl Internationalization
272 dnl ############################################################################
274 AM_GNU_GETTEXT(no-libtool, need-ngettext)
275 AM_GNU_GETTEXT_VERSION(0.14.3)
277 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
278     CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
281 dnl User visible support for charset conversion.
282 AC_ARG_ENABLE([charset],
283     AS_HELP_STRING([--enable-charset], [Support for charset selection and conversion @<:@yes@:>@]))
284 have_charset=
285 charset_msg="no"
286 if test "x$enable_charset" != "xno"; then
287     AC_DEFINE(HAVE_CHARSET, 1, [Define to enable charset selection and conversion])
288     have_charset=yes
289     charset_msg="yes"
293 dnl ############################################################################
294 dnl OS specific flags
295 dnl ############################################################################
297 AC_ISC_POSIX
299 case $host_os in
300 aux*)
301     # A/UX
302     LIBS="$LIBS -lposix"
303     AC_DEFINE(_POSIX_SOURCE)
304     ;;
305 esac
307 dnl If running under AIX, AC_AIX does not tell us that
308 AC_MSG_CHECKING([for AIX defines])
309 AC_EGREP_CPP([yes],
310     [
311         #if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
312         yes
313         #endif
314     ],
315     [
316         AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
317         AC_MSG_RESULT(yes)
318     ],
319     [
320         AC_MSG_RESULT(no)
321     ])
323 dnl Check if the OS is supported by the console saver.
324 cons_saver=""
325 case $host_os in
326 linux*)
327     cons_saver=yes
328 esac
330 dnl Check for gpm mouse support (Linux only)
331 mouse_lib="xterm only"
332 AC_ARG_WITH([gpm-mouse],
333     AS_HELP_STRING([--with-gpm-mouse], [Compile with gpm mouse support (Linux only) @<:@yes if found@:>@]))
335 case $host_os in
336 linux*)
337     if test x$with_gpm_mouse != xno; then
338         AC_CHECK_LIB(gpm, Gpm_Repeat,
339             [AC_DEFINE(HAVE_LIBGPM, 1,
340                        [Define to enable gpm mouse support on Linux])
341             mouse_lib="gpm and xterm"
342             MCLIBS="$MCLIBS -lgpm"],
343             if test "x$with_gpm_mouse" = "xyes"; then
344                 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
345             else
346                 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
347             fi
348         )
349     fi
350     ;;
351 esac
354 dnl ############################################################################
355 dnl libmc
356 dnl ############################################################################
358 LIBMC_VERSION="0.0.1"
359 LIBMC_RELEASE="1"
360 AC_SUBST(LIBMC_VERSION)
361 AC_SUBST(LIBMC_RELEASE)
363 AC_ARG_ENABLE([mclib],
364         [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
365         [
366             if test "x$enableval" = "xno" ; then
367                 enable_mclib=no
368             else
369                 if test "x$enable_shared" = "xno" ; then
370                     AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
371                     enable_mclib=no
372                 else
373                     enable_mclib=yes
374                 fi
375             fi
376         ],
377         [enable_mclib=no])
379 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
382 dnl ############################################################################
383 dnl Where config files should be placed
384 dnl ############################################################################
386 AC_ARG_WITH([homedir],
387     AS_HELP_STRING([--with-homedir],
388                    [Choose any place of user settings relative to home dir, or XDG for respect XDG standards @<:@XDG@:>@]),
389     [
390         if test "x$withval" = "xXDG"; then
391             with_homedir=XDG
392         else
393             with_homedir=$withval
394         fi
395     ],
396     [with_homedir=XDG])
399 if test x$with_homedir = xXDG; then
400     AC_DEFINE(MC_HOMEDIR_XDG, 1,
401         [Define to enable XDG standard support])
402 else
403     AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
407 dnl ############################################################################
408 dnl MC options
409 dnl ############################################################################
411 MC_WITH_EDIT
413 dnl Diff viewer support.
414 AC_ARG_WITH([diff_viewer],
415     AS_HELP_STRING([--with-diff-viewer], [Compile with diff viewer @<:@yes@:>@]))
417 if test x$with_diff_viewer != xno; then
418         AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
419         use_diff=yes
420         diff_msg="yes"
421         AC_MSG_NOTICE([using diff viewer])
422 else
423         diff_msg="no"
426 MC_SUBSHELL
427 MC_BACKGROUND
428 AC_MC_VFS_CHECKS
430 dnl ############################################################################
431 dnl Directories
432 dnl ############################################################################
434 dnl ${prefix} and ${exec_prefix} are undefined here if --prefix is not used in command line
435 dnl Let define ${prefix} and ${exec_prefix}
436 test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"
437 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
439 if test x${libexecdir} = x'${exec_prefix}/libexec'; then
440     EXTHELPERSDIR=${prefix}/libexec/${PACKAGE}/ext.d
441 elif test x${libexecdir} = x'${exec_prefix}/lib'; then
442     EXTHELPERSDIR=${prefix}/lib/${PACKAGE}/ext.d
443 else
444     EXTHELPERSDIR=${libexecdir}/${PACKAGE}/ext.d
446 AC_SUBST(EXTHELPERSDIR)
449 dnl ############################################################################
450 dnl Documentation
451 dnl ############################################################################
453 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
454 AC_SUBST(MAN_DATE)
456 dnl Determine which help translations we want to install.
457 ALL_DOC_LINGUAS="es hu it pl ru sr"
459 DOC_LINGUAS=
460 if test "x$USE_NLS" = xyes; then
461     if test -z "$LINGUAS"; then
462         langs="`grep -v '^#' $srcdir/po/LINGUAS`"
463     else
464         langs="$LINGUAS"
465     fi
466 else
467     langs=
470 for h_lang in $ALL_DOC_LINGUAS; do
471     for lang in $langs; do
472         if test "$lang" = "$h_lang"; then
473             DOC_LINGUAS="$DOC_LINGUAS $lang"
474             break
475         fi
476     done
477 done
478 AC_SUBST(DOC_LINGUAS)
480 DX_HTML_FEATURE(ON)
481 DX_CHM_FEATURE(OFF)
482 DX_CHI_FEATURE(OFF)
483 DX_MAN_FEATURE(OFF)
484 DX_RTF_FEATURE(OFF)
485 DX_XML_FEATURE(OFF)
486 DX_PDF_FEATURE(OFF)
487 DX_PS_FEATURE(OFF)
488 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
491 dnl ############################################################################
492 dnl Configure results
493 dnl ############################################################################
495 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
497 AC_SUBST(MCLIBS)
498 AC_SUBST(CFLAGS)
499 AC_SUBST(CPPFLAGS)
500 AC_SUBST(LDFLAGS)
501 AC_SUBST(LIBS)
503 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
504 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
505 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
506 AM_CONDITIONAL(USE_EDIT, [test x"$use_edit" = xyes ])
507 AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
508 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
509 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
510 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
512 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS], ["$ac_configure_args"], [MC configure arguments])
514 AC_CONFIG_FILES(
516 src/man2hlp/man2hlp
519 chmod +x src/man2hlp/man2hlp
522 AC_CONFIG_FILES([
523 Makefile
525 contrib/Makefile
526 contrib/dist/Makefile
527 contrib/dist/gentoo/Makefile
528 contrib/dist/redhat/Makefile
529 contrib/dist/redhat/mc.spec
530 contrib/dist/pkginfo
531 contrib/dist/prototype
533 misc/Makefile
534 misc/skins/Makefile
535 misc/ext.d/Makefile
536 misc/ext.d/doc.sh
537 misc/ext.d/misc.sh
538 misc/ext.d/text.sh
539 misc/ext.d/web.sh
540 misc/macros.d/Makefile
541 misc/mc.ext
543 src/Makefile
544 src/consaver/Makefile
545 src/editor/Makefile
546 src/man2hlp/Makefile
547 src/viewer/Makefile
548 src/diffviewer/Makefile
549 src/filemanager/Makefile
551 src/vfs/Makefile
553 src/vfs/cpio/Makefile
555 src/vfs/extfs/Makefile
556 src/vfs/extfs/helpers/Makefile
557 src/vfs/extfs/helpers/a+
558 src/vfs/extfs/helpers/apt+
559 src/vfs/extfs/helpers/audio
560 src/vfs/extfs/helpers/deb
561 src/vfs/extfs/helpers/deba
562 src/vfs/extfs/helpers/debd
563 src/vfs/extfs/helpers/dpkg+
564 src/vfs/extfs/helpers/iso9660
565 src/vfs/extfs/helpers/hp48+
566 src/vfs/extfs/helpers/lslR
567 src/vfs/extfs/helpers/mailfs
568 src/vfs/extfs/helpers/patchfs
569 src/vfs/extfs/helpers/rpms+
570 src/vfs/extfs/helpers/s3+
571 src/vfs/extfs/helpers/uace
572 src/vfs/extfs/helpers/ualz
573 src/vfs/extfs/helpers/uar
574 src/vfs/extfs/helpers/uarc
575 src/vfs/extfs/helpers/uarj
576 src/vfs/extfs/helpers/uc1541
577 src/vfs/extfs/helpers/ucab
578 src/vfs/extfs/helpers/uha
579 src/vfs/extfs/helpers/ulha
580 src/vfs/extfs/helpers/ulib
581 src/vfs/extfs/helpers/urar
582 src/vfs/extfs/helpers/uzip
583 src/vfs/extfs/helpers/uzoo
585 src/vfs/fish/Makefile
586 src/vfs/fish/helpers/Makefile
588 src/vfs/ftpfs/Makefile
590 src/vfs/sftpfs/Makefile
592 src/vfs/local/Makefile
594 src/vfs/sfs/Makefile
596 src/vfs/smbfs/Makefile
598 src/vfs/tar/Makefile
600 src/vfs/undelfs/Makefile
602 lib/Makefile
603 lib/event/Makefile
604 lib/filehighlight/Makefile
605 lib/mcconfig/Makefile
606 lib/search/Makefile
607 lib/skin/Makefile
608 lib/strutil/Makefile
609 lib/tty/Makefile
611 lib/vfs/Makefile
613 lib/widget/Makefile
615 misc/syntax/Makefile
616 misc/syntax/Syntax
618 doc/Makefile
619 doc/hints/Makefile
620 doc/man/Makefile
621 doc/man/es/Makefile
622 doc/man/hu/Makefile
623 doc/man/it/Makefile
624 doc/man/pl/Makefile
625 doc/man/ru/Makefile
626 doc/man/sr/Makefile
628 doc/hlp/Makefile
629 doc/hlp/es/Makefile
630 doc/hlp/hu/Makefile
631 doc/hlp/it/Makefile
632 doc/hlp/pl/Makefile
633 doc/hlp/ru/Makefile
634 doc/hlp/sr/Makefile
636 intl/Makefile
637 po/Makefile.in
640 if test x$enable_tests != xno; then
641     AC_CONFIG_FILES([
642 tests/Makefile
643 tests/lib/Makefile
644 tests/lib/mcconfig/Makefile
645 tests/lib/search/Makefile
646 tests/lib/strutil/Makefile
647 tests/lib/vfs/Makefile
648 tests/lib/widget/Makefile
649 tests/src/Makefile
650 tests/src/filemanager/Makefile
654 AC_OUTPUT
656 AC_MSG_NOTICE([
658 Configuration:
660   Source code location:       ${srcdir}
661   Compiler:                   ${CC}
662   Compiler flags:             ${CFLAGS}
663   File system:                ${vfs_type}
664                               ${vfs_flags}
665   Screen library:             ${screen_msg}
666   Mouse support:              ${mouse_lib}
667   X11 events support:         ${textmode_x11_support}
668   With subshell support:      ${subshell}
669   With background operations: ${enable_background}
670   Internal editor:            ${edit_msg}
671   Diff viewer:                ${diff_msg}
672   Support for charset:        ${charset_msg}
673   Search type:                ${SEARCH_TYPE}