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 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])
110 dnl Missing structure components
116 dnl Check availability of some functions
119 AC_CHECK_FUNCS([strerror statfs strcasecmp strncasecmp strftime \
120 strdup memmove pwdauth truncate initgroups putenv \
121 memset memcpy tcsetattr tcgetattr cfgetospeed \
122 sigaction sigemptyset sigprocmask sigaddset \
123 sysconf setuid setreuid telldir seekdir])
126 dnl getpt is a GNU Extension (glibc 2.1.x)
128 AC_CHECK_FUNCS(getpt)
133 AC_CHECK_LIB(shadow,pw_encrypt,
135 AC_CHECK_HEADERS(shadow.h,,
136 [AC_CHECK_HEADERS(shadow/shadow.h,,
137 [shadow_header=no])])
138 if test $shadow_header = yes; then
139 AC_DEFINE(LINUX_SHADOW, 1,
140 [Define to use shadow passwords on Linux])
147 NEED_CRYPT_PROTOTYPE=yes
148 if test x$ac_cv_header_crypt_h = xyes; then
149 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");
152 NEED_CRYPT_PROTOTYPE=no])
154 if test x$ac_cv_header_unistd_h = xyes; then
155 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");
158 NEED_CRYPT_PROTOTYPE=no])
161 if test x$NEED_CRYPT_PROTOTYPE = xyes; then
162 AC_DEFINE(NEED_CRYPT_PROTOTYPE, 1,
163 [Define if function `crypt' needs a prototype])
167 dnl On SCO and some SVR4, crypt is on libcrypt.a
168 dnl grantpt in libpt.a
171 AC_CHECK_FUNCS(crypt, , [
172 AC_CHECK_LIB(crypt, crypt, [LCRYPT="-lcrypt"], [
173 AC_CHECK_LIB(crypt_i, crypt, [LCRYPT="-lcrypt_i"])])])
176 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
178 dnl replacing lstat with statlstat on sco makes it more portable between
180 AC_CHECK_FUNCS(statlstat)
183 dnl If running under AIX, AC_AIX does not tell us that
185 AC_MSG_CHECKING([for AIX defines])
187 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
191 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
193 ], [AC_MSG_RESULT(no)])
196 dnl This is from GNU fileutils, check aclocal.m4 for more information
201 dnl Missing typedefs and replacements
205 AC_CHECK_TYPE(umode_t, int)
206 AC_CHECK_TYPE(off_t, long)
209 AC_CHECK_TYPE(nlink_t, unsigned int)
218 dnl These variables are only used when building the MC binary
224 textmode_x11_support="no"
225 AC_ARG_WITH(tm-x-support,
226 [--with-tm-x-support Try getting events from X Window System],
227 [if test x$withval = xyes; then
230 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
231 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
232 [Define to enable getting events from X Window System])
233 textmode_x11_support="yes"
238 dnl Network related functions
241 AC_CHECK_LIB(nsl, t_accept)
242 AC_CHECK_LIB(socket, socket)
245 AC_CHECK_FUNCS(socket, have_socket=yes)
246 if test $have_socket = no; then
247 # socket is not in the default libraries. See if it's in some other.
248 for lib in bsd socket inet; do
249 AC_CHECK_LIB($lib, socket, [
252 AC_DEFINE(HAVE_SOCKET)
257 have_gethostbyname=no
258 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
259 if test $have_gethostbyname = no; then
260 # gethostbyname is not in the default libraries. See if it's in some other.
261 for lib in bsd socket inet; do
262 AC_CHECK_LIB([$lib], [gethostbyname],
263 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
267 AC_CHECK_FUNCS(socketpair)
270 dnl Sequent wants getprocessstats
272 AC_CHECK_LIB(seq, get_process_stats, [
274 AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
275 [Define if you have function `get_process_stats' and
276 have to use that instead of gettimeofday])])
281 dnl Install mcserv only if explicitly enabled
283 AC_ARG_ENABLE([mcserv-install],
284 [--enable-mcserv-install Install mcserv - Midnight Commander file server])
287 if test $have_socket = yes; then
288 NETFILES="\$(NETFILES)"
293 if test $use_vfs = yes
295 AC_MSG_NOTICE([enabling VFS code])
296 vfs_type="Midnight Commander Virtual File System"
299 dnl This should be unadorned "slang" or "ncurses"
302 dnl Screen manager name (for the output only)
303 screen_manager=unknown
307 mouse_lib="xterm only"
310 AC_ARG_WITH(gpm-mouse,
311 [--with-gpm-mouse[=base-dir] Compile with gpm mouse support (Linux only)],
312 [if test x$withval != xno
314 if test x$withval != xyes
316 LIBS="$LIBS -L$withval/lib"
317 CPPFLAGS="$CPPFLAGS -I$withval/include"
319 AC_DEFINE(HAVE_LIBGPM, 1,
320 [Define to enable gpm mouse support on Linux])
321 mouse_lib="GPM and xterm"
322 MCLIBS="-lgpm $MCLIBS"
324 [AC_CHECK_LIB(gpm, Gpm_Repeat,
325 [AC_DEFINE(HAVE_LIBGPM)
326 mouse_lib="GPM and xterm"
327 MCLIBS="-lgpm $MCLIBS"],
328 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
335 [--with-ncurses[=base-dir] Compile with ncurses/locate base dir],
337 if test x$withval = xyes
341 MCLIBS="$MCLIBS -L$withval/lib -lncurses"
342 CPPFLAGS="$CPPFLAGS -I$withval/include"
344 screen_type="ncurses"
345 screen_manager="ncurses"
346 AC_DEFINE(USE_NCURSES)
351 [--with-hsc Compile with support for the HSC firewall],
352 [if test x$withval = xyes; then
353 AC_DEFINE(HSC_PROXY, 1,
354 [Define if you want to use the HSC firewall])
359 dnl Check for the -mandoc package
361 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
363 AC_MSG_CHECKING([for manual formatting macros])
364 AC_CACHE_VAL(ac_cv_mandoc, [
365 nroff -mandoc < /dev/null > /dev/null 2>&1
374 AC_MSG_RESULT([$MANDOC])
381 dnl Check if nroff accepts -Tlatin1 or -Tascii
384 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
385 AC_CACHE_VAL(ac_cv_nroff_tascii, [
386 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
389 ac_cv_nroff_tascii=" -Tlatin1"
391 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
394 ac_cv_nroff_tascii=" -Tascii"
396 ac_cv_nroff_tascii=""
400 if test "x$ac_cv_nroff_tascii" = x; then
403 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
406 TROFFASCII="$ac_cv_nroff_tascii"
410 dnl Check for - option to file
412 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
413 if $HAVE_FILECMD; then
414 AC_MSG_CHECKING([for - option to file command])
415 AC_CACHE_VAL(ac_cv_filestdin, [[
416 cat > conftest.c <<\EOF
423 cat > conftest.sed <<\EOF
427 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
428 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
429 if test "x$filehyphen_1" = "x$filehyphen_2"; then
434 rm conftest.c conftest.sed
437 if test x$ac_cv_filestdin = xyes; then
438 AC_DEFINE(FILE_STDIN, 1,
439 [Define if the file command accepts - for stdin])
441 filestdin=$ac_cv_filestdin
442 AC_MSG_RESULT([$filestdin])
445 dnl Check for -L option to file
448 AC_MSG_CHECKING([for -L option to file command])
449 AC_CACHE_VAL(ac_cv_filel, [
450 file -L . > /dev/null 2>&1
458 if test x$ac_cv_filel = xyes; then
459 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
462 AC_MSG_RESULT([$filel])
465 AC_MSG_CHECKING([for subshell support])
466 AC_ARG_WITH(subshell,
467 [--with-subshell=optional To disable concurrent shell by default
468 --without-subshell To disable concurrent shell completely],
470 if test x$withval = xoptional
472 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
473 [Define to make subshell support optional])
474 AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
475 [Define to enable subshell support])
478 if test x$withval = xyes
480 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
483 [dnl Default: provide the subshell support on non-ultrix machines
489 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
494 AC_MSG_RESULT([$result])
498 dnl Memory Allocation Debugger
502 [--with-mad Developers only: activates MAD (memory debugger)],
503 [if test x$withval = xyes; then
504 mem_debug="Janne's MAD library"
505 AC_DEFINE(HAVE_MAD, 1,
506 [Define to use Memory Allocation Debugger (MAD)])
507 AC_MSG_NOTICE([compiling with memory leak detector])
511 dnl Electric Fence - another memory debugger
514 [--with-efence Developers only: activates Electric Fence],
515 [if test x$withval = xyes; then
516 LIBS="$LIBS -lefence"
517 AC_MSG_NOTICE([compiling with Electric fence])
518 mem_debug="Electric Fence"
521 if test -z "$force_ncurses"; then
524 slang_use_system_installed_lib=false
525 AC_CHECK_LIB(slang,SLang_init_tty,
526 [AC_CHECK_HEADERS(slang.h)
527 if test x$ac_cv_header_slang_h = xyes
529 slang_use_system_installed_lib=true
530 slang_check_lib=false
532 AC_CHECK_HEADERS(slang/slang.h)
533 if test x$ac_cv_header_slang_slang_h = xyes
535 slang_use_system_installed_lib=true
536 slang_check_lib=false
542 AC_ARG_WITH(terminfo,
543 [--with-terminfo SLANG: Force usage of terminfo],[
544 if test x$withval = xyes; then
546 slang_check_lib=false
547 slang_use_system_installed_lib=false
552 [--with-termcap SLANG: Force usage of termcap],[
553 if test x$withval = xyes; then
555 slang_check_lib=false
556 slang_use_system_installed_lib=false
560 AC_ARG_WITH(included-slang,
561 [--with-included-slang SLANG: use the SLang library included here],[
562 if test x$withval = xyes; then
563 slang_use_system_installed_lib=false
569 [--with-slang Compile with the slang screen manager],[
570 if test x$withval = xyes; then
580 [--with-edit Enable internal editor],
581 [if test x$withval = xyes
587 [dnl Default: provide the internal editor
595 [--with-netrc Compile with ftp .netrc support],[
596 if test x$withval = xyes; then
597 AC_DEFINE(USE_NETRC, 1,
598 [Define to use .netrc for FTP connections])
599 AC_MSG_NOTICE([ftpfs will use .netrc])
605 if test $use_vfs = yes; then
606 AC_ARG_WITH(ext2undel,
607 [--with-ext2undel Compile with ext2 undelete code],[
608 if test x$withval != xno;
610 if test x$withval != xyes
612 LIBS="$LIBS -L$withval/lib"
613 CPPFLAGS="$CPPFLAGS -I$withval/include"
618 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL], , [-lcom_err])
626 AC_MSG_NOTICE([checking location of ncurses.h file])
628 AC_NCURSES(/usr/include, ncurses.h, -lncurses,,
629 [ncurses in /usr/include])
630 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses,
631 [ncurses in /usr/include/ncurses])
632 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include,
633 [ncurses in /usr/local])
634 AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses,
635 [ncurses in /usr/local/include/ncurses])
636 AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES,
637 [renamed ncurses in /usr/local/include/ncurses])
638 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES,
639 [renamed ncurses in /usr/include/ncurses])
642 if test "x$screen_type" != xncurses && test -n "$force_ncurses"; then
643 AC_MSG_ERROR([Could not find ncurses])
647 dnl Ncurses specific checks
649 dnl If ncurses exports the ESCDELAY variable it should be set to 0
650 dnl or you'll have to press Esc three times to dismiss a dialog box.
652 if test "x$screen_type" = xncurses; then
655 AC_CACHE_CHECK([for ESCDELAY variable],
656 [mc_cv_ncurses_escdelay],
657 [AC_TRY_COMPILE([], [
664 [mc_cv_ncurses_escdelay=yes],
665 [mc_cv_ncurses_escdelay=no]
668 if test "$mc_cv_ncurses_escdelay" = yes; then
669 AC_DEFINE(HAVE_ESCDELAY, 1,
670 [Define if ncurses has ESCDELAY variable])
673 AC_CHECK_FUNCS(resizeterm)
677 if test "x$screen_type" = "x"; then
682 dnl The variables used for expanding the auto saver.
689 cons_saver="cons.saver"
693 dnl On Linux, check for PAM authentication available
695 AC_CHECK_LIB(pam, pam_start, [
696 AC_DEFINE(HAVE_PAM, 1,
697 [Define if PAM (Pluggable Authentication Modules) is available])
706 dnl User visible support for charset conversion.
708 AC_ARG_ENABLE([charset],
709 [--enable-charset Support for charset selection and conversion])
711 if test "x$enable_charset" = xyes; then
712 if test -z "$am_cv_func_iconv"; then
713 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
715 AC_DEFINE(HAVE_CHARSET, 1,
716 [Define to enable charset selection and conversion])
723 dnl This code should be moved to the ac_WITH_SLANG
725 dnl We check for the existance of setupterm on curses library
726 dnl this is required to load certain definitions on some termcaps
727 dnl editions (AIX and OSF/1 I seem to remember).
728 dnl Note that we avoid using setupterm
729 if test "x$screen_type" = xslang; then
734 AC_CHECK_LIB(curses,setupterm,
738 if (key_end == parm_insert_line)
742 [MCLIBS="$MCLIBS -lcurses"
743 AC_DEFINE(USE_SETUPTERM, 1,
744 [Define to use function `setupterm'
745 from `curses' library in S-Lang])])
750 LIBS="$LIBS $posix_libs"
757 if test "x$SAMBAFILES" != x; then
758 AC_CONFIG_SUBDIRS([vfs/samba])
761 AM_CONDITIONAL(USE_EDIT, [test -n "$LIBEDIT_A"])
762 AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes])
763 AM_CONDITIONAL(USE_VFS_NET, [test -n "$NETFILES"])
764 AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$undelfs_o"])
765 AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$SAMBAFILES"])
766 AM_CONDITIONAL(MCSERV_INSTALL,
767 [test "x$enable_mcserv_install$mcserv" = xyesmcserv])
768 AM_CONDITIONAL(INCLUDED_SLANG,
769 [test "x$slang_use_system_installed_lib" = xfalse])
770 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
771 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
773 AH_BOTTOM([#include <extraconf.h>])
804 doc/mc.1 doc/mcedit.1 doc/mcserv.8 doc/ru/mc.1 doc/ru/Makefile
807 intl/Makefile po/Makefile.in
810 AC_CONFIG_COMMANDS(potfiles,
811 [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
815 if test "x$screen_type" = xslang; then
816 screen_manager="${screen_manager}${slang_term}"
822 Source code location: ${srcdir}
824 Compiler flags: ${CFLAGS}
825 File system: ${vfs_type}
827 Screen manager: ${screen_manager}
828 Install console saver: ${install_saver}
829 Mouse support: ${mouse_lib}
830 X11 events support: ${textmode_x11_support}
831 Debugger code: ${mem_debug}
832 With subshell support: ${subshell}
833 Internal editor: ${EDIT_msg}
834 Install path: ${prefix}/bin, ${prefix}/lib/mc