2 dnl Configure.in file for the Midnight Commander
5 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
7 AC_CONFIG_SRCDIR(src/main.c)
8 AC_CONFIG_AUX_DIR(config)
9 AM_INIT_AUTOMAKE(mc, 4.6.0-pre1a)
11 AM_CONFIG_HEADER(config.h)
23 dnl Check if the user requested to compile with glib 2.x. If not, use
24 dnl glib 1.2.x. This check should be kept close to the beginning, as it
25 dnl fails for the users without any glib.
27 AC_ARG_WITH(glib2, [ --with-glib2 Use glib 2.x [[no]]])
29 if test "x$with_glib2" = "xyes" ; then
30 PKG_CHECK_MODULES(GLIB, "glib-2.0")
32 dnl This temporary variable is a workaround for a bug in Autoconf-2.53
33 glib_path=$PATH:/usr/local/bin
35 dnl Klugde for FreeBSD, where glib-config is renamed to glib12-config.
36 AC_PATH_PROGS([GLIB_CONFIG], [glib-config glib12-config],,[$glib_path])
38 AC_ARG_VAR([GLIB_CONFIG], [Path to glib-config (version 1.2.x only)])
39 AM_PATH_GLIB(1.2.6,,[AC_MSG_ERROR([Test for glib failed.
40 GNU Midnight Commander requires glib 1.2.6 or above.])])
49 AC_CHECK_TOOL(AR, ar, ar)
51 dnl Only list browsers here that can be run in background (i.e. with `&')
52 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
55 dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
56 dnl We use only part of the functionality of mmap, so on AIX,
57 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
60 [ --with-mmap Force using the mmap call (only useful on AIX)],
63 ac_cv_func_mmap_fixed_mapped=yes
64 AC_MSG_NOTICE([forcing MMAP support])
67 ac_cv_func_mmap_fixed_mapped=no
68 AC_MSG_NOTICE([disabling MMAP support])
73 ALL_LINGUAS="az be bg ca cs da de el es es_ES eu fi fr hu it ja ko lv \
74 nl no pl pt pt_BR ro ru sk sl sv uk ta tr wa zh_CN zh_TW"
77 dnl Internationalization
80 AM_GNU_GETTEXT_VERSION(0.11.5)
82 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
83 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
87 dnl Hack to make extraconf.h visible even if compiling outside srcdir.
89 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
92 dnl Enforce coding standards
94 if test "x$GCC" = xyes; then
95 CFLAGS="$CFLAGS -Wall"
99 dnl OS specific flags.
107 AC_DEFINE(_POSIX_SOURCE)
110 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
111 AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
116 AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
117 malloc.h stdlib.h termios.h utime.h fcntl.h pwd.h sys/statfs.h \
118 sys/time.h sys/timeb.h sys/select.h sys/ioctl.h stropts.h \
126 dnl Missing structure components
132 dnl Check availability of some functions
135 AC_CHECK_FUNCS([strerror statfs strftime \
136 memmove pwdauth truncate initgroups putenv \
137 memset memcpy tcsetattr tcgetattr cfgetospeed \
138 sigaction sigemptyset sigprocmask sigaddset \
139 sysconf setuid setreuid telldir seekdir])
142 dnl getpt is a GNU Extension (glibc 2.1.x)
144 AC_CHECK_FUNCS(getpt)
148 dnl On SCO and some SVR4, crypt is on libcrypt.a
149 dnl grantpt in libpt.a
152 AC_CHECK_FUNCS(crypt, , [
153 AC_CHECK_LIB(crypt, crypt, [LCRYPT="-lcrypt"], [
154 AC_CHECK_LIB(crypt_i, crypt, [LCRYPT="-lcrypt_i"])])])
157 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
159 dnl replacing lstat with statlstat on sco makes it more portable between
161 AC_CHECK_FUNCS(statlstat)
164 dnl If running under AIX, AC_AIX does not tell us that
166 AC_MSG_CHECKING([for AIX defines])
168 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
172 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
174 ], [AC_MSG_RESULT(no)])
177 dnl This is from GNU fileutils, check aclocal.m4 for more information
182 dnl Missing typedefs and replacements
186 AC_CHECK_TYPE(umode_t, int)
187 AC_CHECK_TYPE(off_t, long)
190 AC_CHECK_TYPE(nlink_t, unsigned int)
199 textmode_x11_support="no"
200 AC_ARG_WITH(tm-x-support,
201 [ --with-tm-x-support Get keyboard events from X Window System [[no]]],
202 [if test x$withval = xyes; then
204 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
205 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
206 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
207 [Define to enable getting events from X Window System])
208 textmode_x11_support="yes"
213 dnl Network related functions
216 AC_CHECK_LIB(nsl, t_accept)
217 AC_CHECK_LIB(socket, socket)
220 AC_CHECK_FUNCS(socket, have_socket=yes)
221 if test $have_socket = no; then
222 # socket is not in the default libraries. See if it's in some other.
223 for lib in bsd socket inet; do
224 AC_CHECK_LIB($lib, socket, [
227 AC_DEFINE(HAVE_SOCKET)
232 have_gethostbyname=no
233 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
234 if test $have_gethostbyname = no; then
235 # gethostbyname is not in the default libraries. See if it's in some other.
236 for lib in bsd socket inet; do
237 AC_CHECK_LIB([$lib], [gethostbyname],
238 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
242 AC_CHECK_FUNCS(socketpair)
245 dnl Sequent wants getprocessstats
247 AC_CHECK_LIB(seq, get_process_stats, [
249 AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
250 [Define if you have function `get_process_stats' and
251 have to use that instead of gettimeofday])])
256 if test x$use_vfs = xyes; then
257 AC_MSG_NOTICE([enabling VFS code])
258 vfs_type="Midnight Commander Virtual File System"
261 dnl This should be unadorned "slang" or "ncurses"
264 dnl Screen manager name (for the output only)
265 screen_manager=unknown
267 mouse_lib="xterm only"
270 AC_ARG_WITH(gpm-mouse,
271 [ --with-gpm-mouse[[=base-dir]] Compile with gpm mouse support (Linux only)
273 [if test x$withval != xno
275 if test x$withval != xyes
277 LDFLAGS="$LDFLAGS -L$withval/lib"
278 CPPFLAGS="$CPPFLAGS -I$withval/include"
280 AC_DEFINE(HAVE_LIBGPM, 1,
281 [Define to enable gpm mouse support on Linux])
282 mouse_lib="GPM and xterm"
283 MCLIBS="-lgpm $MCLIBS"
285 [AC_CHECK_LIB(gpm, Gpm_Repeat,
286 [AC_DEFINE(HAVE_LIBGPM)
287 mouse_lib="GPM and xterm"
288 MCLIBS="-lgpm $MCLIBS"],
289 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
296 [ --with-ncurses[[=base-dir]] Compile with ncurses [[no]]],
297 [if test x$withval != xno; then
298 if test x$withval != xyes; then
299 LDFLAGS="$LDFLAGS -L$withval/lib"
300 CPPFLAGS="$CPPFLAGS -I$withval/include"
303 AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h],
304 [ncurses_h_found=yes; break])
305 if test -z "$ncurses_h_found"; then
306 AC_MSG_ERROR([Could not find ncurses header])
309 dnl curses_version is specific to ncurses, it's not in old curses
310 AC_CHECK_LIB(ncurses, has_colors, [MCLIBS="$MCLIBS -lncurses"],
311 [AC_MSG_ERROR([Could not find ncurses library])])
313 screen_type="ncurses"
314 screen_manager="ncurses"
315 AC_DEFINE(USE_NCURSES, 1,
316 [Define to use ncurses for screen management])
321 [ --with-hsc Compile with support for HSC firewall instead
322 of FTP proxy [[no]]],
323 [if test x$withval = xyes; then
324 AC_DEFINE(HSC_PROXY, 1,
325 [Define if you want to use the HSC firewall])
330 dnl Check for the -mandoc package
332 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
334 AC_MSG_CHECKING([for manual formatting macros])
335 AC_CACHE_VAL(ac_cv_mandoc, [
336 nroff -mandoc < /dev/null > /dev/null 2>&1
345 AC_MSG_RESULT([$MANDOC])
352 dnl Check if nroff accepts -Tlatin1 or -Tascii
355 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
356 AC_CACHE_VAL(ac_cv_nroff_tascii, [
357 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
360 ac_cv_nroff_tascii=" -Tlatin1"
362 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
365 ac_cv_nroff_tascii=" -Tascii"
367 ac_cv_nroff_tascii=""
371 if test "x$ac_cv_nroff_tascii" = x; then
374 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
377 TROFFASCII="$ac_cv_nroff_tascii"
381 dnl Check for - option to file
383 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
384 if $HAVE_FILECMD; then
385 AC_MSG_CHECKING([for - option to file command])
386 AC_CACHE_VAL(ac_cv_filestdin, [[
387 cat > conftest.c <<\EOF
394 cat > conftest.sed <<\EOF
398 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
399 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
400 if test "x$filehyphen_1" = "x$filehyphen_2"; then
405 rm conftest.c conftest.sed
408 if test x$ac_cv_filestdin = xyes; then
409 AC_DEFINE(FILE_STDIN, 1,
410 [Define if the file command accepts - for stdin])
412 filestdin=$ac_cv_filestdin
413 AC_MSG_RESULT([$filestdin])
416 dnl Check for -L option to file
419 AC_MSG_CHECKING([for -L option to file command])
420 AC_CACHE_VAL(ac_cv_filel, [
421 file -L . > /dev/null 2>&1
429 if test x$ac_cv_filel = xyes; then
430 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
433 AC_MSG_RESULT([$filel])
437 AC_MSG_CHECKING([for subshell support])
438 AC_ARG_WITH(subshell,
439 [ --with-subshell Compile in concurrent subshell [[yes]]
440 --with-subshell=optional Don't run concurrent shell by default [[no]]],
442 if test x$withval = xoptional
444 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
445 [Define to make subshell support optional])
448 if test x$withval = xyes
452 [dnl Default: enable the subshell support
455 if test "x$result" != xno; then
456 AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
457 [Define to enable subshell support])
459 AC_MSG_RESULT([$result])
462 if test "x$screen_type" != xncurses; then
465 slang_use_system_installed_lib=false
466 AC_CHECK_LIB(slang,SLang_init_tty,
467 [AC_CHECK_HEADERS([slang.h slang/slang.h],
468 [slang_h_found=yes; break])
469 if test "x$slang_h_found" = xyes; then
470 slang_use_system_installed_lib=true
471 slang_check_lib=false
477 [ --with-slang Compile with S-Lang screen manager [[yes]]],
478 [if test x$withval = xyes; then
483 AC_ARG_WITH(included-slang,
484 [ --with-included-slang Use S-Lang library included with mc sources
485 [[use installed library if found]]],
486 [if test x$withval = xyes; then
487 slang_use_system_installed_lib=false
493 [ --with-termcap Same as above, and try using termcap database [[no]]],
494 [if test x$withval = xyes; then
496 slang_check_lib=false
497 slang_use_system_installed_lib=false
503 dnl Internal editor support.
506 [ --with-edit Enable internal editor [[yes]]])
508 if test x$with_edit != xno; then
509 AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
512 AC_MSG_NOTICE([using internal editor])
518 if test $use_vfs = yes; then
519 AC_ARG_WITH(ext2undel,
520 [ --with-ext2undel Compile with ext2 undelete code [[yes if found]]],
521 [if test x$withval != xno; then
522 if test x$withval != xyes; then
523 LDFLAGS="$LDFLAGS -L$withval/lib"
524 CPPFLAGS="$CPPFLAGS -I$withval/include"
529 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL], , [-lcom_err])
534 dnl Ncurses specific checks
536 dnl If ncurses exports the ESCDELAY variable it should be set to 0
537 dnl or you'll have to press Esc three times to dismiss a dialog box.
539 if test "x$screen_type" = xncurses; then
542 AC_CACHE_CHECK([for ESCDELAY variable],
543 [mc_cv_ncurses_escdelay],
544 [AC_TRY_COMPILE([], [
551 [mc_cv_ncurses_escdelay=yes],
552 [mc_cv_ncurses_escdelay=no]
555 if test "$mc_cv_ncurses_escdelay" = yes; then
556 AC_DEFINE(HAVE_ESCDELAY, 1,
557 [Define if ncurses has ESCDELAY variable])
560 AC_CHECK_FUNCS(resizeterm)
564 if test "x$screen_type" = "x"; then
569 dnl The variables used for expanding the auto saver.
576 cons_saver="cons.saver"
580 dnl On Linux, check for PAM authentication available
582 AC_CHECK_LIB(pam, pam_start, [
583 AC_DEFINE(HAVE_PAM, 1,
584 [Define if PAM (Pluggable Authentication Modules) is available])
593 dnl User visible support for charset conversion.
595 AC_ARG_ENABLE([charset],
596 [ --enable-charset Support for charset selection and conversion [[no]]])
598 if test "x$enable_charset" = xyes; then
599 if test "x$am_cv_func_iconv" != xyes; then
600 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
602 AC_DEFINE(HAVE_CHARSET, 1,
603 [Define to enable charset selection and conversion])
608 if test "$GLIBC21" != yes; then
609 AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
613 dnl This code should be moved to the ac_WITH_SLANG
615 dnl We check for the existance of setupterm on curses library
616 dnl this is required to load certain definitions on some termcaps
617 dnl editions (AIX and OSF/1 I seem to remember).
618 dnl Note that we avoid using setupterm
619 if test "x$screen_type" = xslang; then
624 AC_CHECK_LIB(curses,setupterm,
628 if (key_end == parm_insert_line)
632 [MCLIBS="$MCLIBS -lcurses"
633 AC_DEFINE(USE_SETUPTERM, 1,
634 [Define to use function `setupterm'
635 from `curses' library in S-Lang])])
640 LIBS="$LIBS $posix_libs"
647 dnl Libraries used only when building the mc binary
650 dnl Version for the RedHat package, without dashes
651 RH_VERSION=`echo $VERSION | sed 's/-//'`
654 if test -n "$use_smbfs"; then
655 AC_CONFIG_SUBDIRS([vfs/samba])
658 AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
659 AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes])
660 AM_CONDITIONAL(USE_VFS_NET, [test x"$use_net_code" = xtrue])
661 AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$use_undelfs"])
662 AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$use_smbfs"])
663 AM_CONDITIONAL(USE_MCFS, [test -n "$use_mcfs"])
664 AM_CONDITIONAL(INCLUDED_SLANG,
665 [test "x$slang_use_system_installed_lib" = xfalse])
666 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
667 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
669 AH_BOTTOM([#include <extraconf.h>])
699 doc/mc.1 doc/mcedit.1 doc/mcserv.8
700 doc/es/mc.1 doc/es/Makefile
702 doc/it/mc.1 doc/it/Makefile
703 doc/pl/mc.1 doc/pl/Makefile
704 doc/ru/mc.1 doc/ru/Makefile
712 if test "x$screen_type" = xslang; then
713 screen_manager="${screen_manager}${slang_term}"
719 Source code location: ${srcdir}
721 Compiler flags: ${CFLAGS}
722 File system: ${vfs_type}
724 Screen manager: ${screen_manager}
725 Install console saver: ${install_saver}
726 Mouse support: ${mouse_lib}
727 X11 events support: ${textmode_x11_support}
728 With subshell support: ${subshell}
729 Internal editor: ${EDIT_msg}
730 Install path: ${prefix}/bin, ${prefix}/lib/mc