Ticket #2890: make a choice between archivers for arj.
[midnight-commander.git] / configure.ac
blobf7e16c6d93d165e238dfb559d7b93388e1bbac85
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])
60 dnl Check nroff and the options it supports
61 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
62 dnl Default values
63 MANDOC=-man
64 MAN_FLAGS=
65 if $HAVE_nroff; then
66     AC_MSG_CHECKING([for manual formatting macros])
67     AC_CACHE_VAL(mc_cv_mandoc, [
68     nroff -mandoc < /dev/null > /dev/null 2>&1
69     if test $? = 0; then
70         mc_cv_mandoc=-mandoc
71     else
72         mc_cv_mandoc=-man
73     fi
74     ])
75     MANDOC=$mc_cv_mandoc
76     AC_MSG_RESULT([$MANDOC])
78     AC_MSG_CHECKING([for option to disable ANSI color in manuals])
79     AC_CACHE_VAL(mc_cv_man_nocolor, [
80     nroff -c < /dev/null > /dev/null 2>&1
81     if test $? = 0; then
82         mc_cv_man_nocolor=-c
83     else
84         mc_cv_man_nocolor=
85     fi
86     ])
87     MAN_FLAGS=$mc_cv_man_nocolor
88     AC_MSG_RESULT([${MAN_NOCOLOR-none}])
90     AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
91     AC_CACHE_VAL(mc_cv_nroff_tascii, [
92     mc_cv_nroff_tascii=
93     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
94     if test $? = 0; then
95         mc_cv_nroff_tascii=-Tlatin1
96     else
97         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
98         if test $? = 0; then
99             mc_cv_nroff_tascii=-Tascii
100         fi
101     fi
102     ])
103     AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
104     MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
107 AC_SUBST(MANDOC)
108 AC_SUBST(MAN_FLAGS)
110 dnl Check for -L option to file
111 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
112 if $HAVE_FILECMD; then
113     AC_MSG_CHECKING([for -L option to file command])
114     AC_CACHE_VAL(mc_cv_filel, [
115     file -L . > /dev/null 2>&1
116     if test $? = 0; then
117         mc_cv_filel=yes
118     else
119         mc_cv_filel=no
120     fi
121     ])
122     if test x$mc_cv_filel = xyes; then
123         AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
124     fi
125     filel=$mc_cv_filel
126     AC_MSG_RESULT([$filel])
129 dnl Only list browsers here that can be run in background (i.e. with `&')
130 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
133 dnl ############################################################################
134 dnl Check for other tools
135 dnl ############################################################################
137 AC_CHECK_TOOL(AR, ar, ar)
138 MC_UNIT_TESTS
141 dnl ############################################################################
142 dnl Check for main libraies
143 dnl ############################################################################
145 AC_CHECK_GLIB
146 AC_G_MODULE_SUPPORTED
147 MC_WITH_SCREEN
148 MC_CHECK_SEARCH_TYPE
149 dnl X11 support. Used to read keyboard modifiers when running under X11.
150 MC_WITH_X
153 dnl ############################################################################
154 dnl Check for header files
155 dnl ############################################################################
157 AC_CHECK_HEADERS([unistd.h string.h memory.h limits.h malloc.h \
158         utime.h fcntl.h sys/statfs.h sys/vfs.h sys/time.h \
159         sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
160         sys/socket.h sys/sysmacros.h sys/types.h sys/mkdev.h])
161 AC_HEADER_MAJOR
162 AC_HEADER_TIME
163 AC_HEADER_DIRENT
164 AC_HEADER_ASSERT
167 dnl ############################################################################
168 dnl Check for types
169 dnl ############################################################################
171 AC_C_CONST
172 dnl Check largefile before type sizeof checks
173 AC_SYS_LARGEFILE
175 AC_CHECK_SIZEOF(long)
176 AC_TYPE_UINTMAX_T
177 AC_CHECK_SIZEOF(uintmax_t)
178 AC_TYPE_OFF_T
179 AC_CHECK_SIZEOF(off_t)
180 AC_TYPE_MODE_T
181 AC_TYPE_PID_T
182 AC_TYPE_UID_T
184 AC_STRUCT_ST_BLOCKS
185 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
188 dnl ############################################################################
189 dnl Check for functions
190 dnl ############################################################################
192 AC_CHECK_FUNCS([\
193         atoll \
194         isascii \
195         statfs sysconf \
196         tcgetattr tcsetattr \
197         ftruncate \
198         strverscmp \
199         strncasecmp \
200         realpath
202 AC_FUNC_STRCOLL
204 dnl getpt is a GNU Extension (glibc 2.1.x)
205 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
206 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
208 dnl replacing lstat with statlstat on sco makes it more portable between
209 dnl sco clones
210 AC_CHECK_FUNCS(statlstat)
212 dnl Ovverriding mmap support.  This has to be before AC_FUNC_MMAP is used.
213 dnl We use only part of the functionality of mmap, so on AIX,
214 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
215 AC_ARG_WITH([mmap],
216         AS_HELP_STRING([--with-mmap], [Use the mmap call @<:@yes if found@:>@]))
217 if test x$with_mmap != xno; then
218     if test x$with_mmap = x; then
219         AC_FUNC_MMAP
220     else
221         AC_DEFINE(HAVE_MMAP, 1)
222     fi
225 dnl Sequent wants getprocessstats
226 AC_CHECK_LIB(seq, get_process_stats, [
227         LIBS="$LIBS -lseq"
228         AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
229                   [Define if you have function `get_process_stats' and
230 have to use that instead of gettimeofday])])
232 mc_AC_GET_FS_INFO
235 dnl ############################################################################
236 dnl Internationalization
237 dnl ############################################################################
239 AM_GNU_GETTEXT(no-libtool, need-ngettext)
240 AM_GNU_GETTEXT_VERSION(0.14.3)
242 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
243     CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
246 dnl User visible support for charset conversion.
247 AC_ARG_ENABLE([charset],
248     AS_HELP_STRING([--enable-charset], [Support for charset selection and conversion @<:@yes@:>@]))
249 have_charset=
250 charset_msg="no"
251 if test "x$enable_charset" != "xno"; then
252     AC_DEFINE(HAVE_CHARSET, 1, [Define to enable charset selection and conversion])
253     have_charset=yes
254     charset_msg="yes"
258 dnl ############################################################################
259 dnl OS specific flags
260 dnl ############################################################################
262 AC_ISC_POSIX
264 case $host_os in
265 aux*)
266     # A/UX
267     LIBS="$LIBS -lposix"
268     AC_DEFINE(_POSIX_SOURCE)
269     ;;
270 esac
272 dnl If running under AIX, AC_AIX does not tell us that
273 AC_MSG_CHECKING([for AIX defines])
274 AC_EGREP_CPP([yes],
275     [
276         #if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
277         yes
278         #endif
279     ],
280     [
281         AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
282         AC_MSG_RESULT(yes)
283     ],
284     [
285         AC_MSG_RESULT(no)
286     ])
288 dnl Check if the OS is supported by the console saver.
289 cons_saver=""
290 case $host_os in
291 linux*)
292     cons_saver=yes
293 esac
295 dnl Check for gpm mouse support (Linux only)
296 mouse_lib="xterm only"
297 AC_ARG_WITH([gpm-mouse],
298     AS_HELP_STRING([--with-gpm-mouse], [Compile with gpm mouse support (Linux only) @<:@yes if found@:>@]))
300 case $host_os in
301 linux*)
302     if test x$with_gpm_mouse != xno; then
303         AC_CHECK_LIB(gpm, Gpm_Repeat,
304             [AC_DEFINE(HAVE_LIBGPM, 1,
305                        [Define to enable gpm mouse support on Linux])
306             mouse_lib="gpm and xterm"
307             MCLIBS="$MCLIBS -lgpm"],
308             if test "x$with_gpm_mouse" = "xyes"; then
309                 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
310             else
311                 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
312             fi
313         )
314     fi
315     ;;
316 esac
319 dnl ############################################################################
320 dnl libmc
321 dnl ############################################################################
323 LIBMC_VERSION="0.0.1"
324 LIBMC_RELEASE="1"
325 AC_SUBST(LIBMC_VERSION)
326 AC_SUBST(LIBMC_RELEASE)
328 AC_ARG_ENABLE([mclib],
329         [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
330         [
331             if test "x$enableval" = "xno" ; then
332                 enable_mclib=no
333             else
334                 if test "x$enable_shared" = "xno" ; then
335                     AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
336                     enable_mclib=no
337                 else
338                     enable_mclib=yes
339                 fi
340             fi
341         ],
342         [enable_mclib=no])
344 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
347 dnl ############################################################################
348 dnl Where config files should be placed
349 dnl ############################################################################
351 AC_ARG_WITH([homedir],
352     AS_HELP_STRING([--with-homedir],
353                    [Choose any place of user settings relative to home dir, or XDG for respect XDG standards @<:@XDG@:>@]),
354     [
355         if test "x$withval" = "xXDG"; then
356             with_homedir=XDG
357         else
358             with_homedir=$withval
359         fi
360     ],
361     [with_homedir=XDG])
364 if test x$with_homedir = xXDG; then
365     AC_DEFINE(MC_HOMEDIR_XDG, 1,
366         [Define to enable XDG standard support])
367 else
368     AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
372 dnl ############################################################################
373 dnl MC options
374 dnl ############################################################################
376 MC_WITH_EDIT
378 dnl Diff viewer support.
379 AC_ARG_WITH([diff_viewer],
380     AS_HELP_STRING([--with-diff-viewer], [Compile with diff viewer @<:@yes@:>@]))
382 if test x$with_diff_viewer != xno; then
383         AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
384         use_diff=yes
385         diff_msg="yes"
386         AC_MSG_NOTICE([using diff viewer])
387 else
388         diff_msg="no"
391 AC_MSG_CHECKING([for subshell support])
392 AC_ARG_WITH(subshell,
393         [  --with-subshell          Compile in concurrent subshell [[yes]]
394   --with-subshell=optional Don't run concurrent shell by default [[no]]],
395         [result=no
396         if test x$withval = xoptional
397         then
398                 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
399                           [Define to make subshell support optional])
400                 result="optional"
401         fi
402         if test x$withval = xyes
403         then
404                 result="yes"
405         fi],
406         [dnl Default: enable the subshell support
407         result="yes"
409 if test "x$result" != xno; then
410         AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
411                   [Define to enable subshell support])
413 AC_MSG_RESULT([$result])
414 subshell="$result"
416 MC_BACKGROUND
418 AC_MC_VFS_CHECKS
421 dnl ############################################################################
422 dnl Directories
423 dnl ############################################################################
425 dnl ${prefix} and ${exec_prefix} are undefined here if --prefix is not used in command line
426 dnl Let define ${prefix} and ${exec_prefix}
427 test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"
428 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
430 if test x${libexecdir} = x'${exec_prefix}/libexec'; then
431     EXTHELPERSDIR=${prefix}/libexec/${PACKAGE}/ext.d
432 elif test x${libexecdir} = x'${exec_prefix}/lib'; then
433     EXTHELPERSDIR=${prefix}/lib/${PACKAGE}/ext.d
434 else
435     EXTHELPERSDIR=${libexecdir}/${PACKAGE}/ext.d
437 AC_SUBST(EXTHELPERSDIR)
440 dnl ############################################################################
441 dnl Documentation
442 dnl ############################################################################
444 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
445 AC_SUBST(MAN_DATE)
447 dnl Determine which help translations we want to install.
448 ALL_DOC_LINGUAS="es hu it pl ru sr"
450 DOC_LINGUAS=
451 if test "x$USE_NLS" = xyes; then
452     if test -z "$LINGUAS"; then
453         langs="`grep -v '^#' $srcdir/po/LINGUAS`"
454     else
455         langs="$LINGUAS"
456     fi
457 else
458     langs=
461 for h_lang in $ALL_DOC_LINGUAS; do
462     for lang in $langs; do
463         if test "$lang" = "$h_lang"; then
464             DOC_LINGUAS="$DOC_LINGUAS $lang"
465             break
466         fi
467     done
468 done
469 AC_SUBST(DOC_LINGUAS)
471 DX_HTML_FEATURE(ON)
472 DX_CHM_FEATURE(OFF)
473 DX_CHI_FEATURE(OFF)
474 DX_MAN_FEATURE(OFF)
475 DX_RTF_FEATURE(OFF)
476 DX_XML_FEATURE(OFF)
477 DX_PDF_FEATURE(OFF)
478 DX_PS_FEATURE(OFF)
479 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
482 dnl ############################################################################
483 dnl Configure results
484 dnl ############################################################################
486 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
488 AC_SUBST(MCLIBS)
489 AC_SUBST(CFLAGS)
490 AC_SUBST(CPPFLAGS)
491 AC_SUBST(LDFLAGS)
492 AC_SUBST(LIBS)
494 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
495 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
496 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
497 AM_CONDITIONAL(USE_EDIT, [test x"$use_edit" = xyes ])
498 AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
499 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
500 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
501 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
503 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS], ["$ac_configure_args"], [MC configure arguments])
505 AC_CONFIG_FILES(
507 src/man2hlp/man2hlp
510 chmod +x src/man2hlp/man2hlp
513 AC_CONFIG_FILES([
514 Makefile
516 contrib/Makefile
517 contrib/dist/Makefile
518 contrib/dist/gentoo/Makefile
519 contrib/dist/redhat/Makefile
520 contrib/dist/redhat/mc.spec
521 contrib/dist/pkginfo
522 contrib/dist/prototype
524 misc/Makefile
525 misc/skins/Makefile
526 misc/ext.d/Makefile
527 misc/ext.d/doc.sh
528 misc/ext.d/misc.sh
529 misc/ext.d/text.sh
530 misc/ext.d/web.sh
531 misc/macros.d/Makefile
532 misc/mc.ext
534 src/Makefile
535 src/consaver/Makefile
536 src/editor/Makefile
537 src/man2hlp/Makefile
538 src/viewer/Makefile
539 src/diffviewer/Makefile
540 src/filemanager/Makefile
542 src/vfs/Makefile
544 src/vfs/cpio/Makefile
546 src/vfs/extfs/Makefile
547 src/vfs/extfs/helpers/Makefile
548 src/vfs/extfs/helpers/a+
549 src/vfs/extfs/helpers/apt+
550 src/vfs/extfs/helpers/audio
551 src/vfs/extfs/helpers/deb
552 src/vfs/extfs/helpers/deba
553 src/vfs/extfs/helpers/debd
554 src/vfs/extfs/helpers/dpkg+
555 src/vfs/extfs/helpers/iso9660
556 src/vfs/extfs/helpers/hp48+
557 src/vfs/extfs/helpers/lslR
558 src/vfs/extfs/helpers/mailfs
559 src/vfs/extfs/helpers/patchfs
560 src/vfs/extfs/helpers/rpms+
561 src/vfs/extfs/helpers/s3+
562 src/vfs/extfs/helpers/uace
563 src/vfs/extfs/helpers/ualz
564 src/vfs/extfs/helpers/uar
565 src/vfs/extfs/helpers/uarc
566 src/vfs/extfs/helpers/uarj
567 src/vfs/extfs/helpers/ucab
568 src/vfs/extfs/helpers/uha
569 src/vfs/extfs/helpers/ulha
570 src/vfs/extfs/helpers/ulib
571 src/vfs/extfs/helpers/urar
572 src/vfs/extfs/helpers/uzip
573 src/vfs/extfs/helpers/uzoo
575 src/vfs/fish/Makefile
576 src/vfs/fish/helpers/Makefile
578 src/vfs/ftpfs/Makefile
580 src/vfs/sftpfs/Makefile
582 src/vfs/local/Makefile
584 src/vfs/sfs/Makefile
586 src/vfs/smbfs/Makefile
588 src/vfs/tar/Makefile
590 src/vfs/undelfs/Makefile
592 lib/Makefile
593 lib/event/Makefile
594 lib/filehighlight/Makefile
595 lib/mcconfig/Makefile
596 lib/search/Makefile
597 lib/skin/Makefile
598 lib/strutil/Makefile
599 lib/tty/Makefile
601 lib/vfs/Makefile
603 lib/widget/Makefile
605 misc/syntax/Makefile
607 doc/Makefile
608 doc/hints/Makefile
609 doc/man/Makefile
610 doc/man/es/Makefile
611 doc/man/hu/Makefile
612 doc/man/it/Makefile
613 doc/man/pl/Makefile
614 doc/man/ru/Makefile
615 doc/man/sr/Makefile
617 doc/hlp/Makefile
618 doc/hlp/es/Makefile
619 doc/hlp/hu/Makefile
620 doc/hlp/it/Makefile
621 doc/hlp/pl/Makefile
622 doc/hlp/ru/Makefile
623 doc/hlp/sr/Makefile
625 intl/Makefile
626 po/Makefile.in
629 if test x$enable_tests != xno; then
630     AC_CONFIG_FILES([
631 tests/Makefile
632 tests/lib/Makefile
633 tests/lib/mcconfig/Makefile
634 tests/lib/search/Makefile
635 tests/lib/vfs/Makefile
636 tests/src/Makefile
637 tests/src/filemanager/Makefile
642 AC_OUTPUT
644 echo "
645 Configuration:
647   Source code location:       ${srcdir}
648   Compiler:                   ${CC}
649   Compiler flags:             ${CFLAGS}
650   File system:                ${vfs_type}
651                               ${vfs_flags}
652   Screen library:             ${screen_msg}
653   Mouse support:              ${mouse_lib}
654   X11 events support:         ${textmode_x11_support}
655   With subshell support:      ${subshell}
656   With background operations: ${enable_background}
657   Internal editor:            ${edit_msg}
658   Diff viewer:                ${diff_msg}
659   Support for charset:        ${charset_msg}
660   Search type:                ${SEARCH_TYPE}