Ticket #1689: mc.ext: use "include" for $EDITOR entries
[midnight-commander.git] / configure.ac
blobf009742a2b756ec622b1c59d8de4963237202fb4
1 dnl
2 dnl Configure.in file for the Midnight Commander
3 dnl
5 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
6 AC_PREREQ(2.60)
7 m4_pattern_forbid(MC_)
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_SRCDIR(src/main.c)
10 AC_CONFIG_AUX_DIR(config)
11 MC_VERSION
12 AM_INIT_AUTOMAKE(mc, ${VERSION} )
14 LIBMC_VERSION="0.0.1"
15 LIBMC_RELEASE="1"
16 AC_SUBST(LIBMC_VERSION)
17 AC_SUBST(LIBMC_RELEASE)
19 dnl Enable silent rules by default (if yes)
20 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
22 AM_CONFIG_HEADER(config.h)
23 AM_MAINTAINER_MODE
24 AC_CANONICAL_HOST
26 AC_USE_SYSTEM_EXTENSIONS
28 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS],["$ac_configure_args"],[MC configure arguments])
30 AC_PROG_LIBTOOL
31 PKG_PROG_PKG_CONFIG
32 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
34 AC_ISC_POSIX
36 AC_PROG_CC_STDC
37 AM_PROG_CC_C_O
39 dnl Doxygen
41 DX_HTML_FEATURE(ON)
42 DX_CHM_FEATURE(OFF)
43 DX_CHI_FEATURE(OFF)
44 DX_MAN_FEATURE(OFF)
45 DX_RTF_FEATURE(OFF)
46 DX_XML_FEATURE(OFF)
47 DX_PDF_FEATURE(OFF)
48 DX_PS_FEATURE(OFF)
49 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
51 dnl PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
53 AC_CHECK_GLIB
55 AC_ARG_ENABLE([mclib],
56         [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
57         [
58             if test "x$enableval" = "xno" ; then
59                 enable_mclib=no
60             else
61                 if test "x$enable_shared" = "xno" ; then
62                     AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
63                     enable_mclib=no
64                 else
65                     enable_mclib=yes
66                 fi
67             fi
68         ],
69         [enable_mclib=no])
71 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
73 AC_HEADER_MAJOR
74 AC_C_CONST
75 AC_SYS_LARGEFILE
77 AC_PROG_LN_S
78 AC_CHECK_TOOL(AR, ar, ar)
80 dnl Only list browsers here that can be run in background (i.e. with `&')
81 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
83 dnl
84 dnl Ovverriding mmap support.  This has to be before AC_FUNC_MMAP is used.
85 dnl We use only part of the functionality of mmap, so on AIX,
86 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
87 dnl
88 AC_ARG_WITH(mmap,
89         [  --with-mmap              Use the mmap call [[yes if found]]])
90 if test x$with_mmap != xno; then
91     if test x$with_mmap = x; then
92         AC_FUNC_MMAP
93     else
94         AC_DEFINE(HAVE_MMAP, 1)
95     fi
98 dnl
99 dnl Internationalization
101 AM_GNU_GETTEXT(no-libtool, need-ngettext)
102 AM_GNU_GETTEXT_VERSION(0.14.3)
104 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
105     CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
108 dnl Determine which help translations we want to install.
109 ALL_DOC_LINGUAS="es hu it pl ru sr"
111 DOC_LINGUAS=
112 if test "x$USE_NLS" = xyes; then
113     if test -z "$LINGUAS"; then
114         langs="`grep -v '^#' $srcdir/po/LINGUAS`"
115     else
116         langs="$LINGUAS"
117     fi
118 else
119     langs=
122 for h_lang in $ALL_DOC_LINGUAS; do
123     for lang in $langs; do
124         if test "$lang" = "$h_lang"; then
125             DOC_LINGUAS="$DOC_LINGUAS $lang"
126             break
127         fi
128     done
129 done
130 AC_SUBST(DOC_LINGUAS)
133 dnl OS specific flags.
135 case $host_os in
136 aux*)
137     # A/UX
138     LIBS="$LIBS -lposix"
139     AC_DEFINE(_POSIX_SOURCE)
140     ;;
141 esac
143 AC_PROG_INSTALL
144 AC_CHECK_HEADERS([unistd.h string.h memory.h limits.h malloc.h \
145         utime.h fcntl.h sys/statfs.h sys/vfs.h sys/time.h \
146         sys/timeb.h sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
147         security/pam_misc.h sys/socket.h sys/sysmacros.h sys/types.h \
148         sys/mkdev.h wchar.h wctype.h])
150 AC_HEADER_TIME
151 AC_HEADER_DIRENT
152 AC_HEADER_STDC
154 dnl Missing structure components
155 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
156 AC_STRUCT_ST_BLOCKS
159 dnl Check availability of some functions
162 AC_CHECK_FUNCS([\
163         atoll \
164         cfgetospeed \
165         initgroups isascii \
166         setreuid statfs sysconf \
167         tcgetattr tcsetattr truncate \
168         strverscmp \
169         strncasecmp \
170         realpath
174 dnl getpt is a GNU Extension (glibc 2.1.x)
176 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
177 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
179 dnl replacing lstat with statlstat on sco makes it more portable between
180 dnl sco clones
181 AC_CHECK_FUNCS(statlstat)
184 dnl If running under AIX, AC_AIX does not tell us that
186 AC_MSG_CHECKING([for AIX defines])
187 AC_EGREP_CPP(yes,
188 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
190 #endif
191 ], [
192 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
193 AC_MSG_RESULT(yes)
194 ], [AC_MSG_RESULT(no)])
197 dnl This is from GNU fileutils, check aclocal.m4 for more information
199 AC_GET_FS_INFO
202 dnl Missing typedefs and replacements
205 AC_CHECK_SIZEOF(long)
206 AC_CHECK_SIZEOF(long long)
207 AC_TYPE_MODE_T
208 AC_TYPE_OFF_T
209 AC_CHECK_SIZEOF(off_t)
210 AC_TYPE_PID_T
211 AC_TYPE_UID_T
213 AC_FUNC_ALLOCA
214 AC_FUNC_STRCOLL
217 dnl X11 support.
218 dnl Used to read keyboard modifiers when running under X11.
219 AC_PATH_XTRA
222 dnl Check if the gmodule functionality supported on this system.
223 AC_G_MODULE_SUPPORTED
226 dnl Sequent wants getprocessstats
228 AC_CHECK_LIB(seq, get_process_stats, [
229         LIBS="$LIBS -lseq"
230         AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
231                   [Define if you have function `get_process_stats' and
232 have to use that instead of gettimeofday])])
234 AC_MC_VFS_CHECKS
237 dnl Check for gpm mouse support (Linux only)
239 mouse_lib="xterm only"
240 AC_ARG_WITH(gpm-mouse,
241         [  --with-gpm-mouse         Compile with gpm mouse support (Linux only)
242                            [[yes if found]]])
244 case $host_os in
245 linux*)
246     if test x$with_gpm_mouse != xno; then
247         AC_CHECK_LIB(gpm, Gpm_Repeat,
248             [AC_DEFINE(HAVE_LIBGPM, 1,
249                        [Define to enable gpm mouse support on Linux])
250             mouse_lib="gpm and xterm"
251             MCLIBS="$MCLIBS -lgpm"],
252             if test "x$with_gpm_mouse" = "xyes"; then
253                 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
254             else
255                 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
256             fi
257         )
258     fi
259     ;;
260 esac
262 MC_CHECK_SEARCH_TYPE
265 dnl Check nroff and the options it supports
267 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
269 dnl Default values
270 MANDOC=-man
271 MAN_FLAGS=
273 if $HAVE_nroff; then
274     AC_MSG_CHECKING([for manual formatting macros])
275     AC_CACHE_VAL(mc_cv_mandoc, [
276     nroff -mandoc < /dev/null > /dev/null 2>&1
277     if test $? = 0; then
278         mc_cv_mandoc=-mandoc
279     else
280         mc_cv_mandoc=-man
281     fi
282     ])
283     MANDOC=$mc_cv_mandoc
284     AC_MSG_RESULT([$MANDOC])
286     AC_MSG_CHECKING([for option to disable ANSI color in manuals])
287     AC_CACHE_VAL(mc_cv_man_nocolor, [
288     nroff -c < /dev/null > /dev/null 2>&1
289     if test $? = 0; then
290         mc_cv_man_nocolor=-c
291     else
292         mc_cv_man_nocolor=
293     fi
294     ])
295     MAN_FLAGS=$mc_cv_man_nocolor
296     AC_MSG_RESULT([${MAN_NOCOLOR-none}])
298     AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
299     AC_CACHE_VAL(mc_cv_nroff_tascii, [
300     mc_cv_nroff_tascii=
301     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
302     if test $? = 0; then
303         mc_cv_nroff_tascii=-Tlatin1
304     else
305         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
306         if test $? = 0; then
307             mc_cv_nroff_tascii=-Tascii
308         fi
309     fi
310     ])
311     AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
312     MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
315 AC_SUBST(MANDOC)
316 AC_SUBST(MAN_FLAGS)
320 dnl Check for -L option to file
322 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
323 if $HAVE_FILECMD; then
324     AC_MSG_CHECKING([for -L option to file command])
325     AC_CACHE_VAL(mc_cv_filel, [
326     file -L . > /dev/null 2>&1
327     if test $? = 0; then
328         mc_cv_filel=yes
329     else
330         mc_cv_filel=no
331     fi
332     ])
333     if test x$mc_cv_filel = xyes; then
334         AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
335     fi
336     filel=$mc_cv_filel
337     AC_MSG_RESULT([$filel])
341 AC_MSG_CHECKING([for subshell support])
342 AC_ARG_WITH(subshell,
343         [  --with-subshell          Compile in concurrent subshell [[yes]]
344   --with-subshell=optional Don't run concurrent shell by default [[no]]],
345         [result=no
346         if test x$withval = xoptional
347         then
348                 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
349                           [Define to make subshell support optional])
350                 result="optional"
351         fi
352         if test x$withval = xyes
353         then
354                 result="yes"
355         fi],
356         [dnl Default: enable the subshell support
357         result="yes"
359 if test "x$result" != xno; then
360         AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
361                   [Define to enable subshell support])
363 AC_MSG_RESULT([$result])
364 subshell="$result"
367 MC_WITH_SCREEN
371 dnl Internal editor support.
373 AC_ARG_WITH(edit,
374         [  --with-edit              Enable internal editor [[yes]]])
376 if test x$with_edit != xno; then
377         AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
378         use_edit=yes
379         edit_msg="yes"
380         AC_MSG_NOTICE([using internal editor])
381 else
382         edit_msg="no"
386 dnl Diff viewer support.
388 AC_ARG_WITH(diff_viewer,
389         [  --with-diff-viewer       Compile with diff viewer [[yes]]])
391 if test x$with_diff_viewer != xno; then
392         AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
393         use_diff=yes
394         diff_msg="yes"
395         AC_MSG_NOTICE([using diff viewer])
396 else
397         diff_msg="no"
401 dnl Check if the OS is supported by the console saver.
402 cons_saver=""
403 case $host_os in
404 linux*)
405     cons_saver=yes
406 esac
409 dnl Support for background operations
410 AC_ARG_ENABLE([background],
411               [  --enable-background     Support for background file operations [[yes]]])
412 if test "x$enable_background" != xno; then
413     AC_DEFINE(WITH_BACKGROUND, 1, [Define to enable background file operations])
418 dnl User visible support for charset conversion.
420 AC_ARG_ENABLE([charset],
421               [  --enable-charset        Support for charset selection and conversion [[yes]]])
422 have_charset=
423 charset_msg="no"
424 if test "x$enable_charset" != "xno"; then
425     AC_DEFINE(HAVE_CHARSET, 1,
426               [Define to enable charset selection and conversion])
427     have_charset=yes
428     charset_msg="yes"
431 if test "$GLIBC21" != yes; then
432     AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
435 MC_CHECK_CFLAGS
437 CFLAGS_OPTS=""
439 if test "x$CFLAGS" = "x"; then
440     CFLAGS_OPTS=" -O2 "
443 if test x$USE_MAINTAINER_MODE = xyes; then
444     CFLAGS_OPTS="-g3 -O -ggdb"
445     AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
448 AC_ARG_ENABLE(
449     [werror],
450     AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors])
453 if test "x$enable_werror" = xyes; then
454     MC_CHECK_ONE_CFLAG([-Werror])
456 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
458 MC_UNIT_TESTS
460 AC_SUBST(CFLAGS)
461 AC_SUBST(CPPFLAGS)
462 AC_SUBST(LDFLAGS)
463 AC_SUBST(LIBS)
465 dnl Libraries used only when building the mc binary
466 AC_SUBST(MCLIBS)
468 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
469 AC_SUBST(MAN_DATE)
471 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
472 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
473 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
474 AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
475 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
476 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
477 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
479 AC_CONFIG_FILES(
481 src/man2hlp/man2hlp
484 chmod +x src/man2hlp/man2hlp
487 AC_CONFIG_FILES([
488 Makefile
490 contrib/Makefile
491 contrib/dist/Makefile
492 contrib/dist/debian/Makefile
493 contrib/dist/gentoo/Makefile
494 contrib/dist/redhat/Makefile
495 contrib/dist/redhat/mc.spec
496 contrib/dist/pkginfo
497 contrib/dist/prototype
499 misc/Makefile
500 misc/skins/Makefile
501 misc/macros.d/Makefile
502 misc/mc.ext
504 src/Makefile
505 src/consaver/Makefile
506 src/editor/Makefile
507 src/man2hlp/Makefile
508 src/viewer/Makefile
509 src/diffviewer/Makefile
510 src/filemanager/Makefile
512 src/vfs/Makefile
514 src/vfs/cpio/Makefile
516 src/vfs/extfs/Makefile
517 src/vfs/extfs/helpers/Makefile
518 src/vfs/extfs/helpers/a+
519 src/vfs/extfs/helpers/apt+
520 src/vfs/extfs/helpers/audio
521 src/vfs/extfs/helpers/deb
522 src/vfs/extfs/helpers/deba
523 src/vfs/extfs/helpers/debd
524 src/vfs/extfs/helpers/dpkg+
525 src/vfs/extfs/helpers/iso9660
526 src/vfs/extfs/helpers/hp48+
527 src/vfs/extfs/helpers/lslR
528 src/vfs/extfs/helpers/mailfs
529 src/vfs/extfs/helpers/patchfs
530 src/vfs/extfs/helpers/rpms+
531 src/vfs/extfs/helpers/s3+
532 src/vfs/extfs/helpers/uace
533 src/vfs/extfs/helpers/ualz
534 src/vfs/extfs/helpers/uar
535 src/vfs/extfs/helpers/uarc
536 src/vfs/extfs/helpers/uarj
537 src/vfs/extfs/helpers/uc1541
538 src/vfs/extfs/helpers/ucab
539 src/vfs/extfs/helpers/uha
540 src/vfs/extfs/helpers/ulha
541 src/vfs/extfs/helpers/urar
542 src/vfs/extfs/helpers/uzip
543 src/vfs/extfs/helpers/uzoo
545 src/vfs/fish/Makefile
546 src/vfs/fish/helpers/Makefile
548 src/vfs/ftpfs/Makefile
550 src/vfs/local/Makefile
552 src/vfs/sfs/Makefile
554 src/vfs/smbfs/Makefile
556 src/vfs/tar/Makefile
558 src/vfs/undelfs/Makefile
560 lib/Makefile
561 lib/event/Makefile
562 lib/filehighlight/Makefile
563 lib/mcconfig/Makefile
564 lib/search/Makefile
565 lib/skin/Makefile
566 lib/strutil/Makefile
567 lib/tty/Makefile
569 lib/vfs/Makefile
571 lib/widget/Makefile
573 misc/syntax/Makefile
575 doc/Makefile
576 doc/hints/Makefile
577 doc/man/mc.1 doc/man/mcedit.1 doc/man/mcview.1 doc/man/Makefile
578 doc/man/es/mc.1 doc/man/es/Makefile
579 doc/man/hu/mc.1 doc/man/hu/Makefile
580 doc/man/it/mc.1 doc/man/it/Makefile
581 doc/man/pl/mc.1 doc/man/pl/Makefile
582 doc/man/ru/mc.1 doc/man/ru/Makefile
583 doc/man/sr/mc.1 doc/man/sr/Makefile
585 doc/hlp/Makefile
586 doc/hlp/es/Makefile
587 doc/hlp/hu/Makefile
588 doc/hlp/it/Makefile
589 doc/hlp/pl/Makefile
590 doc/hlp/ru/Makefile
591 doc/hlp/sr/Makefile
593 intl/Makefile
594 po/Makefile.in
597 if test x$enable_tests != xno; then
598     AC_CONFIG_FILES([
599 tests/Makefile
600 tests/lib/Makefile
601 tests/lib/mcconfig/Makefile
602 tests/lib/search/Makefile
603 tests/lib/vfs/Makefile
609 AC_OUTPUT
611 echo "
612 Configuration:
614   Source code location:       ${srcdir}
615   Compiler:                   ${CC}
616   Compiler flags:             ${CFLAGS}
617   File system:                ${vfs_type}
618                               ${vfs_flags}
619   Screen library:             ${screen_msg}
620   Mouse support:              ${mouse_lib}
621   X11 events support:         ${textmode_x11_support}
622   With subshell support:      ${subshell}
623   Internal editor:            ${edit_msg}
624   Diff viewer:                ${diff_msg}
625   Support for charset:        ${charset_msg}
626   Search type:                ${SEARCH_TYPE}