2 dnl Configure.in file for the Midnight Commander
5 AC_INIT(GNU Midnight Commander, 4.5.99a, mc-devel@gnome.org)
7 AC_CONFIG_SRCDIR(src/main.c)
8 AC_CONFIG_AUX_DIR(config)
9 AM_INIT_AUTOMAKE(mc, 4.5.99a)
11 AM_CONFIG_HEADER(config.h)
28 AC_CHECK_TOOL(AR, ar, ar)
30 dnl Only list browsers here that can be run in background (i.e. with `&')
31 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
34 dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
35 dnl We use only part of the functionality of mmap, so on AIX,
36 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
39 [--with-mmap To force using the mmap call (AIX)],
42 ac_cv_func_mmap_fixed_mapped=yes
43 AC_MSG_NOTICE([forcing MMAP support])
46 ac_cv_func_mmap_fixed_mapped=no
47 AC_MSG_NOTICE([disabling MMAP support])
52 if test "x$ALL_LINGUAS" = x; then
53 ALL_LINGUAS="az be bg ca cs da de el es es_ES eu fi fr hu it ja ko lv nl no pl pt pt_BR ro ru sk sl sv uk ta tr wa zh_CN zh_TW"
57 dnl Internationalization
60 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
61 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
65 dnl Hack to make extraconf.h visible even if compiling outside srcdir.
67 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
70 dnl Enforce coding standards
72 if test "x$GCC" = xyes; then
73 CFLAGS="$CFLAGS -Wall"
79 AM_PATH_GLIB(1.2.0,,[AC_MSG_ERROR([Test for GLIB failed. MC requires GLIB.])])
80 LIBS="$LIBS $GLIB_LIBS"
83 dnl OS specific flags.
91 AC_DEFINE(_POSIX_SOURCE)
94 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
95 AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
100 AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
101 malloc.h stdlib.h termios.h utime.h fcntl.h pwd.h sys/statfs.h \
102 sys/time.h sys/timeb.h sys/select.h sys/ioctl.h stropts.h])
109 dnl Missing structure components
115 dnl Check availability of some functions
118 AC_CHECK_FUNCS([strerror statfs strftime \
119 memmove pwdauth truncate initgroups putenv \
120 memset memcpy tcsetattr tcgetattr cfgetospeed \
121 sigaction sigemptyset sigprocmask sigaddset \
122 sysconf setuid setreuid telldir seekdir])
125 dnl getpt is a GNU Extension (glibc 2.1.x)
127 AC_CHECK_FUNCS(getpt)
132 AC_CHECK_LIB(shadow,pw_encrypt,
134 AC_CHECK_HEADERS([shadow.h shadow/shadow.h],
135 [shadow_header=yes; break])
136 if test -n "$shadow_header"; then
137 AC_DEFINE(LINUX_SHADOW, 1,
138 [Define to use shadow passwords on Linux])
145 NEED_CRYPT_PROTOTYPE=yes
146 if test x$ac_cv_header_crypt_h = xyes; then
147 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");
150 NEED_CRYPT_PROTOTYPE=no])
152 if test x$ac_cv_header_unistd_h = xyes; then
153 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");
156 NEED_CRYPT_PROTOTYPE=no])
159 if test x$NEED_CRYPT_PROTOTYPE = xyes; then
160 AC_DEFINE(NEED_CRYPT_PROTOTYPE, 1,
161 [Define if function `crypt' needs a prototype])
165 dnl On SCO and some SVR4, crypt is on libcrypt.a
166 dnl grantpt in libpt.a
169 AC_CHECK_FUNCS(crypt, , [
170 AC_CHECK_LIB(crypt, crypt, [LCRYPT="-lcrypt"], [
171 AC_CHECK_LIB(crypt_i, crypt, [LCRYPT="-lcrypt_i"])])])
174 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
176 dnl replacing lstat with statlstat on sco makes it more portable between
178 AC_CHECK_FUNCS(statlstat)
181 dnl If running under AIX, AC_AIX does not tell us that
183 AC_MSG_CHECKING([for AIX defines])
185 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
189 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
191 ], [AC_MSG_RESULT(no)])
194 dnl This is from GNU fileutils, check aclocal.m4 for more information
199 dnl Missing typedefs and replacements
203 AC_CHECK_TYPE(umode_t, int)
204 AC_CHECK_TYPE(off_t, long)
207 AC_CHECK_TYPE(nlink_t, unsigned int)
216 dnl These variables are only used when building the MC binary
222 textmode_x11_support="no"
223 AC_ARG_WITH(tm-x-support,
224 [--with-tm-x-support Try getting events from X Window System],
225 [if test x$withval = xyes; then
228 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
229 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
230 [Define to enable getting events from X Window System])
231 textmode_x11_support="yes"
236 dnl Network related functions
239 AC_CHECK_LIB(nsl, t_accept)
240 AC_CHECK_LIB(socket, socket)
243 AC_CHECK_FUNCS(socket, have_socket=yes)
244 if test $have_socket = no; then
245 # socket is not in the default libraries. See if it's in some other.
246 for lib in bsd socket inet; do
247 AC_CHECK_LIB($lib, socket, [
250 AC_DEFINE(HAVE_SOCKET)
255 have_gethostbyname=no
256 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
257 if test $have_gethostbyname = no; then
258 # gethostbyname is not in the default libraries. See if it's in some other.
259 for lib in bsd socket inet; do
260 AC_CHECK_LIB([$lib], [gethostbyname],
261 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
265 AC_CHECK_FUNCS(socketpair)
268 dnl Sequent wants getprocessstats
270 AC_CHECK_LIB(seq, get_process_stats, [
272 AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
273 [Define if you have function `get_process_stats' and
274 have to use that instead of gettimeofday])])
279 dnl Install mcserv only if explicitly enabled
281 AC_ARG_ENABLE([mcserv-install],
282 [--enable-mcserv-install Install mcserv - Midnight Commander file server])
285 if test $have_socket = yes; then
286 NETFILES="\$(NETFILES)"
291 if test $use_vfs = yes
293 AC_MSG_NOTICE([enabling VFS code])
294 vfs_type="Midnight Commander Virtual File System"
297 dnl This should be unadorned "slang" or "ncurses"
300 dnl Screen manager name (for the output only)
301 screen_manager=unknown
303 mouse_lib="xterm only"
306 AC_ARG_WITH(gpm-mouse,
307 [--with-gpm-mouse[=base-dir] Compile with gpm mouse support (Linux only)],
308 [if test x$withval != xno
310 if test x$withval != xyes
312 LIBS="$LIBS -L$withval/lib"
313 CPPFLAGS="$CPPFLAGS -I$withval/include"
315 AC_DEFINE(HAVE_LIBGPM, 1,
316 [Define to enable gpm mouse support on Linux])
317 mouse_lib="GPM and xterm"
318 MCLIBS="-lgpm $MCLIBS"
320 [AC_CHECK_LIB(gpm, Gpm_Repeat,
321 [AC_DEFINE(HAVE_LIBGPM)
322 mouse_lib="GPM and xterm"
323 MCLIBS="-lgpm $MCLIBS"],
324 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
331 [--with-ncurses[=base-dir] Compile with ncurses/locate base dir],
332 [if test x$withval != xyes; then
333 MCLIBS="$MCLIBS -L$withval/lib"
334 CPPFLAGS="$CPPFLAGS -I$withval/include"
337 AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h],
338 [ncurses_h_found=yes; break])
339 if test -z "$ncurses_h_found"; then
340 AC_MSG_ERROR([Could not find ncurses header])
343 dnl curses_version is specific to ncurses, it's not in old curses
344 AC_CHECK_LIB(ncurses, has_colors, [MCLIBS="$MCLIBS -lncurses"],
345 [AC_MSG_ERROR([Could not find ncurses library])])
347 screen_type="ncurses"
348 screen_manager="ncurses"
349 AC_DEFINE(USE_NCURSES, 1,
350 [Define to use ncurses for screen management])
354 [--with-hsc Compile with support for the HSC firewall],
355 [if test x$withval = xyes; then
356 AC_DEFINE(HSC_PROXY, 1,
357 [Define if you want to use the HSC firewall])
362 dnl Check for the -mandoc package
364 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
366 AC_MSG_CHECKING([for manual formatting macros])
367 AC_CACHE_VAL(ac_cv_mandoc, [
368 nroff -mandoc < /dev/null > /dev/null 2>&1
377 AC_MSG_RESULT([$MANDOC])
384 dnl Check if nroff accepts -Tlatin1 or -Tascii
387 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
388 AC_CACHE_VAL(ac_cv_nroff_tascii, [
389 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
392 ac_cv_nroff_tascii=" -Tlatin1"
394 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
397 ac_cv_nroff_tascii=" -Tascii"
399 ac_cv_nroff_tascii=""
403 if test "x$ac_cv_nroff_tascii" = x; then
406 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
409 TROFFASCII="$ac_cv_nroff_tascii"
413 dnl Check for - option to file
415 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
416 if $HAVE_FILECMD; then
417 AC_MSG_CHECKING([for - option to file command])
418 AC_CACHE_VAL(ac_cv_filestdin, [[
419 cat > conftest.c <<\EOF
426 cat > conftest.sed <<\EOF
430 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
431 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
432 if test "x$filehyphen_1" = "x$filehyphen_2"; then
437 rm conftest.c conftest.sed
440 if test x$ac_cv_filestdin = xyes; then
441 AC_DEFINE(FILE_STDIN, 1,
442 [Define if the file command accepts - for stdin])
444 filestdin=$ac_cv_filestdin
445 AC_MSG_RESULT([$filestdin])
448 dnl Check for -L option to file
451 AC_MSG_CHECKING([for -L option to file command])
452 AC_CACHE_VAL(ac_cv_filel, [
453 file -L . > /dev/null 2>&1
461 if test x$ac_cv_filel = xyes; then
462 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
465 AC_MSG_RESULT([$filel])
469 AC_MSG_CHECKING([for subshell support])
470 AC_ARG_WITH(subshell,
471 [--with-subshell=optional To disable concurrent shell by default
472 --without-subshell To disable concurrent shell completely],
474 if test x$withval = xoptional
476 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
477 [Define to make subshell support optional])
480 if test x$withval = xyes
484 [dnl Default: enable the subshell support
487 if test "x$result" != xno; then
488 AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
489 [Define to enable subshell support])
491 AC_MSG_RESULT([$result])
494 if test "x$screen_type" != xncurses; then
497 slang_use_system_installed_lib=false
498 AC_CHECK_LIB(slang,SLang_init_tty,
499 [AC_CHECK_HEADERS([slang.h slang/slang.h],
500 [slang_h_found=yes; break])
501 if test "x$slang_h_found" = xyes; then
502 slang_use_system_installed_lib=true
503 slang_check_lib=false
508 AC_ARG_WITH(terminfo,
509 [--with-terminfo SLANG: Force usage of terminfo],[
510 if test x$withval = xyes; then
512 slang_check_lib=false
513 slang_use_system_installed_lib=false
518 [--with-termcap SLANG: Force usage of termcap],[
519 if test x$withval = xyes; then
521 slang_check_lib=false
522 slang_use_system_installed_lib=false
526 AC_ARG_WITH(included-slang,
527 [--with-included-slang SLANG: use the SLang library included here],[
528 if test x$withval = xyes; then
529 slang_use_system_installed_lib=false
535 [--with-slang Compile with the slang screen manager],[
536 if test x$withval = xyes; then
546 [--with-edit Enable internal editor],
547 [if test x$withval = xyes
553 [dnl Default: provide the internal editor
562 if test $use_vfs = yes; then
563 AC_ARG_WITH(ext2undel,
564 [--with-ext2undel Compile with ext2 undelete code],[
565 if test x$withval != xno;
567 if test x$withval != xyes
569 LIBS="$LIBS -L$withval/lib"
570 CPPFLAGS="$CPPFLAGS -I$withval/include"
575 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL], , [-lcom_err])
582 dnl Ncurses specific checks
584 dnl If ncurses exports the ESCDELAY variable it should be set to 0
585 dnl or you'll have to press Esc three times to dismiss a dialog box.
587 if test "x$screen_type" = xncurses; then
590 AC_CACHE_CHECK([for ESCDELAY variable],
591 [mc_cv_ncurses_escdelay],
592 [AC_TRY_COMPILE([], [
599 [mc_cv_ncurses_escdelay=yes],
600 [mc_cv_ncurses_escdelay=no]
603 if test "$mc_cv_ncurses_escdelay" = yes; then
604 AC_DEFINE(HAVE_ESCDELAY, 1,
605 [Define if ncurses has ESCDELAY variable])
608 AC_CHECK_FUNCS(resizeterm)
612 if test "x$screen_type" = "x"; then
617 dnl The variables used for expanding the auto saver.
624 cons_saver="cons.saver"
628 dnl On Linux, check for PAM authentication available
630 AC_CHECK_LIB(pam, pam_start, [
631 AC_DEFINE(HAVE_PAM, 1,
632 [Define if PAM (Pluggable Authentication Modules) is available])
641 dnl User visible support for charset conversion.
643 AC_ARG_ENABLE([charset],
644 [--enable-charset Support for charset selection and conversion])
646 if test "x$enable_charset" = xyes; then
647 if test -z "$am_cv_func_iconv"; then
648 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
650 AC_DEFINE(HAVE_CHARSET, 1,
651 [Define to enable charset selection and conversion])
656 if test "$GLIBC21" != yes; then
657 AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
661 dnl This code should be moved to the ac_WITH_SLANG
663 dnl We check for the existance of setupterm on curses library
664 dnl this is required to load certain definitions on some termcaps
665 dnl editions (AIX and OSF/1 I seem to remember).
666 dnl Note that we avoid using setupterm
667 if test "x$screen_type" = xslang; then
672 AC_CHECK_LIB(curses,setupterm,
676 if (key_end == parm_insert_line)
680 [MCLIBS="$MCLIBS -lcurses"
681 AC_DEFINE(USE_SETUPTERM, 1,
682 [Define to use function `setupterm'
683 from `curses' library in S-Lang])])
688 LIBS="$LIBS $posix_libs"
695 if test "x$SAMBAFILES" != x; then
696 AC_CONFIG_SUBDIRS([vfs/samba])
699 AM_CONDITIONAL(USE_EDIT, [test -n "$LIBEDIT_A"])
700 AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes])
701 AM_CONDITIONAL(USE_VFS_NET, [test -n "$NETFILES"])
702 AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$undelfs_o"])
703 AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$SAMBAFILES"])
704 AM_CONDITIONAL(MCSERV_INSTALL,
705 [test "x$enable_mcserv_install$mcserv" = xyesmcserv])
706 AM_CONDITIONAL(INCLUDED_SLANG,
707 [test "x$slang_use_system_installed_lib" = xfalse])
708 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
709 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
711 AH_BOTTOM([#include <extraconf.h>])
742 doc/mc.1 doc/mcedit.1 doc/mcserv.8
743 doc/es/mc.1 doc/es/Makefile
745 doc/ru/mc.1 doc/ru/Makefile
747 intl/Makefile po/Makefile.in
750 AC_CONFIG_COMMANDS(potfiles,
751 [grep ^top_builddir po/Makefile.in >/dev/null && sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
755 if test "x$screen_type" = xslang; then
756 screen_manager="${screen_manager}${slang_term}"
762 Source code location: ${srcdir}
764 Compiler flags: ${CFLAGS}
765 File system: ${vfs_type}
767 Screen manager: ${screen_manager}
768 Install console saver: ${install_saver}
769 Mouse support: ${mouse_lib}
770 X11 events support: ${textmode_x11_support}
771 Debugger code: ${mem_debug}
772 With subshell support: ${subshell}
773 Internal editor: ${EDIT_msg}
774 Install path: ${prefix}/bin, ${prefix}/lib/mc