2 dnl Configure.in file for the Midnight Commander
8 AM_INIT_AUTOMAKE(mc, 4.5.99a)
9 AM_CONFIG_HEADER(config.h)
29 AC_CHECK_TOOL(AR, ar, ar)
31 AC_CHECK_PROGS(X11_WWW,netscape arena Mosaic chimera)
32 if test x"$X11_WWW" = x; then
36 ALL_LINGUAS="az ca cs da de el es es_ES fi fr hu it ja ko lv nl no pl pt_BR ro ru sk sl sv uk ta tr wa zh_TW zh_CN.GB2312"
39 dnl Internationalization
44 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
45 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/intl"
46 LINTL='-L$(top_builddir)/intl -lintl'
47 INTLDEPS='$(top_builddir)/intl/libintl.a'
53 dnl Hack to make extraconf.h visible even if compiling outside srcdir.
55 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
58 dnl Enforce coding standards
60 if test "x$GCC" = xyes; then
61 CFLAGS="$CFLAGS -Wall"
67 AM_PATH_GLIB(1.2.0,,[AC_MSG_ERROR([Test for GLIB failed. MC requires GLIB.])])
68 LIBS="$LIBS $GLIB_LIBS"
71 dnl OS specific flags.
79 AC_DEFINE(_POSIX_SOURCE)
82 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
83 AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
88 AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
89 malloc.h stdlib.h termios.h utime.h fcntl.h sys/statfs.h \
90 sys/time.h sys/timeb.h stropts.h])
98 dnl Missing structure components
104 dnl Check availability of some functions
107 AC_CHECK_FUNCS([strerror statfs strcasecmp strncasecmp strcoll strftime \
108 strdup memmove pwdauth truncate initgroups putenv \
109 memset memcpy tcsetattr tcgetattr cfgetospeed \
110 sigaction sigemptyset sigprocmask sigaddset \
111 sysconf setuid setreuid \
115 dnl getpt is a GNU Extension (glibc 2.1.x)
117 AC_CHECK_FUNCS(getpt)
122 AC_CHECK_LIB(shadow,pw_encrypt,
124 AC_CHECK_HEADERS(shadow.h,,
125 [AC_CHECK_HEADERS(shadow/shadow.h,,
126 [shadow_header=no])])
127 if test $shadow_header = yes; then
128 AC_DEFINE(LINUX_SHADOW)
135 NEED_CRYPT_PROTOTYPE=yes
136 if test x$ac_cv_header_crypt_h = xyes; then
137 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");
140 NEED_CRYPT_PROTOTYPE=no])
142 if test x$ac_cv_header_unistd_h = xyes; then
143 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");
146 NEED_CRYPT_PROTOTYPE=no])
149 if test x$NEED_CRYPT_PROTOTYPE = xyes; then
150 AC_DEFINE(NEED_CRYPT_PROTOTYPE)
154 dnl AIX and Sequent need <sys/select.h> for fd_set
156 AC_CHECK_HEADERS(sys/select.h)
159 dnl On SCO and some SVR4, crypt is on libcrypt.a
160 dnl grantpt in libpt.a
163 AC_CHECK_FUNCS(crypt, , [
164 AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
165 AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
168 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
170 dnl replacing lstat with statlstat on sco makes it more portable between
172 AC_CHECK_FUNCS(statlstat)
175 dnl If running under AIX, AC_AIX does not tell us that
177 AC_MSG_CHECKING([for AIX defines])
179 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
183 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
185 ], [AC_MSG_RESULT(no)])
188 dnl This hack is here until autoconf adds it
189 dnl Needed for Unixware: getmntent is on libgen.a
191 AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
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)
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
229 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
230 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT)
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, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
264 AC_CHECK_FUNCS(socketpair)
267 dnl Sequent wants getprocessstats
269 AC_CHECK_LIB(seq, get_process_stats, [
271 AC_DEFINE(HAVE_GET_PROCESS_STATS)])
276 dnl Install mcserv only if explicitly enabled
278 AC_ARG_ENABLE([mcserv-install],
279 [--enable-mcserv-install Install mcserv - Midnight Commander file server])
282 if test $have_socket = yes; then
283 NETFILES="\$(NETFILES)"
290 if test $use_vfs = yes
294 MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
295 AC_MSG_RESULT([Using the VFS switch code])
296 vfs_type="Midnight Commander Virtual File System"
301 screen_manager=unknown
304 mouse_lib="xterm only"
308 AC_ARG_WITH(gpm-mouse,
309 [--with-gpm-mouse[=base-dir] Compile with gpm mouse support (Linux only)],
310 [if test x$withval != xno
312 if test x$withval != xyes
314 LIBS="$LIBS -L$withval/lib"
315 CPPFLAGS="$CPPFLAGS -I$withval/include"
317 AC_DEFINE(HAVE_LIBGPM)
318 mouse_lib="GPM and xterm"
321 [AC_CHECK_LIB(gpm, Gpm_Repeat,
322 [AC_DEFINE(HAVE_LIBGPM)
323 mouse_lib="GPM and xterm"
325 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
333 [--with-ncurses[=base-dir] Compile with ncurses/locate base dir],
334 [if test x$withval = xyes
338 LIBS="$LIBS -L$withval/lib -lncurses"
339 CPPFLAGS="$CPPFLAGS -I$withval/include"
341 screen_manager="ncurses"
342 AC_DEFINE(USE_NCURSES)
347 [--with-hsc Compile with support for the HSC firewall],
348 [if test x$withval = xyes; then
349 AC_DEFINE(HSC_PROXY, 1,
350 [Define if you want to use the HSC firewall])
355 dnl Check for the -mandoc package
357 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
359 AC_MSG_CHECKING([for manual formatting macros])
360 AC_CACHE_VAL(ac_cv_mandoc, [
361 nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
370 AC_MSG_RESULT($MANDOC)
377 dnl Check if nroff accepts -Tlatin1 or -Tascii
380 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
381 AC_CACHE_VAL(ac_cv_nroff_tascii, [
382 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
385 ac_cv_nroff_tascii=" -Tlatin1"
387 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
390 ac_cv_nroff_tascii=" -Tascii"
392 ac_cv_nroff_tascii=""
396 if test "x$ac_cv_nroff_tascii" = x; then
399 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
402 TROFFASCII="$ac_cv_nroff_tascii"
406 dnl Check for - option to file
408 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
409 if $HAVE_FILECMD; then
410 AC_MSG_CHECKING([for - option to file command])
411 AC_CACHE_VAL(ac_cv_filestdin, [[
412 cat > conftest.c <<\EOF
419 cat > conftest.sed <<\EOF
423 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
424 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
425 if test "x$filehyphen_1" = "x$filehyphen_2"; then
430 rm conftest.c conftest.sed
433 if test x$ac_cv_filestdin = xyes; then
434 AC_DEFINE(FILE_STDIN, 1,
435 [Define if the file command accepts - for stdin])
437 filestdin=$ac_cv_filestdin
438 AC_MSG_RESULT([$filestdin])
441 dnl Check for -L option to file
444 AC_MSG_CHECKING([for -L option to file command])
445 AC_CACHE_VAL(ac_cv_filel, [
446 file -L . > /dev/null 2>&1
454 if test x$ac_cv_filel = xyes; then
455 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
458 AC_MSG_RESULT([$filel])
462 dnl Check to see if grep program allowes dash to denote stdin
464 AC_MSG_CHECKING([for - option to grep command])
465 AC_CACHE_VAL(ac_cv_grep_stdin, [
466 echo "grep_test" | grep grep_test - >/dev/null 2>&1
473 if test x$ac_cv_grep_stdin = xyes; then
474 AC_DEFINE(GREP_STDIN, 1, [Define if the grep command accepts - for stdin])
476 AC_MSG_RESULT([$ac_cv_grep_stdin])
479 dnl The subshell support
482 AC_MSG_CHECKING([for subshell support])
483 AC_ARG_WITH(subshell,
484 [--with-subshell If you want to use a concurrent shell],
486 if test x$withval = xoptional
488 AC_DEFINE(SUBSHELL_OPTIONAL)
489 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
492 if test x$withval = xyes
494 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
497 [dnl Default: provide the subshell support on non-ultrix machines
503 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
508 AC_MSG_RESULT([$result])
512 dnl Memory Allocation Debugger
516 [--with-mad Developers only: activates MAD (memory debugger)],
517 [if test x$withval = xyes; then
518 mem_debug="Janne's MAD library"
520 AC_MSG_RESULT([compiling with memory leak detector])
524 dnl Electric Fence - another memory debugger
527 [--with-efence Developers only: activates Electric Fence],
528 [if test x$withval = xyes; then
529 LIBS="$LIBS -lefence"
530 AC_MSG_RESULT([compiling with Electric fence])
531 mem_debug="Electric Fence"
535 dnl To force mmap support
536 dnl We use only part of the functionality of mmap, so on AIX,
537 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
540 [--with-mmap To force using the mmap call (AIX)],
541 [if test x$withval = xyes; then
543 AC_MSG_RESULT([forcing MMAP support])
548 slang_use_system_installed_lib=false
549 AC_CHECK_LIB(slang,SLang_init_tty,
550 [AC_CHECK_HEADERS(slang.h)
551 if test x$ac_cv_header_slang_h = xyes
553 slang_use_system_installed_lib=true
554 slang_check_lib=false
556 AC_CHECK_HEADERS(slang/slang.h)
557 if test x$ac_cv_header_slang_slang_h = xyes
559 slang_use_system_installed_lib=true
560 slang_check_lib=false
565 AC_ARG_WITH(terminfo,
566 [--with-terminfo SLANG: Force usage of terminfo],[
567 if test x$withval = xyes; then
569 slang_check_lib=false
570 slang_use_system_installed_lib=false
575 [--with-termcap SLANG: Force usage of termcap],[
576 if test x$withval = xyes; then
578 slang_check_lib=false
579 slang_use_system_installed_lib=false
583 AC_ARG_WITH(included-slang,
584 [--with-included-slang SLANG: use the SLang library included here],[
585 if test x$withval = xyes; then
586 slang_use_system_installed_lib=false
594 [--with-slang Compile with the slang screen manager],[
595 if test x$withval = xyes; then
608 [--with-edit Define INTERNAL_EDIT],
609 [if test x$withval = xyes
615 [dnl Default: provide the internal editor
623 [--with-netrc Compile with ftp .netrc support],[
624 if test x$withval = xyes; then
625 AC_DEFINE(USE_NETRC, 1,
626 [Define to use .netrc for FTP connections])
627 AC_MSG_RESULT([ftpfs will have .netrc parsing code])
633 if test $use_vfs = yes; then
634 AC_ARG_WITH(ext2undel,
635 [--with-ext2undel Compile with ext2 undelete code],[
636 if test x$withval != xno;
638 if test x$withval != xyes
640 LIBS="$LIBS -L$withval/lib"
641 CPPFLAGS="$CPPFLAGS -I$withval/include"
646 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL],,-lcom_err)
654 AC_CHECKING([location of ncurses.h file])
656 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
657 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
658 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
659 AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
661 AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
663 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
669 # check for ncurses version, to properly ifdef mouse-fix
670 AC_MSG_CHECKING([for ncurses version])
671 ncurses_version=unknown
672 cat > conftest.$ac_ext <<EOF
673 [#]line __oline__ "configure"
674 #include "confdefs.h"
675 #ifdef RENAMED_NCURSES
681 VERSION:NCURSES_VERSION
683 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
684 egrep "VERSION:" >conftest.out 2>&1; then
685 ncurses_version=`cat conftest.out|sed -e 's/^[[^"]]*"//' -e 's/".*//'`
688 AC_MSG_RESULT([$ncurses_version])
689 case "$ncurses_version" in
691 AC_DEFINE(NCURSES_970530,2)
694 AC_DEFINE(NCURSES_970530,1)
697 AC_DEFINE(NCURSES_970530,0)
704 dnl If ncurses exports the ESCDELAY variable it should be set to 0
705 dnl or you'll have to press Esc three times to dismiss a dialog box.
707 if test -n "$ncurses_version"; then
708 AC_CACHE_CHECK([for ESCDELAY variable],
709 [mc_cv_ncurses_escdelay],
710 [AC_TRY_COMPILE([], [
717 [mc_cv_ncurses_escdelay=yes],
718 [mc_cv_ncurses_escdelay=no]
721 if test "$mc_cv_ncurses_escdelay" = yes; then
722 AC_DEFINE(HAVE_ESCDELAY, 1,
723 [Define if ncurses has ESCDELAY variable])
728 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
729 dnl check for resizeterm and keyok.
733 AC_CHECK_FUNCS(resizeterm keyok)
736 if test "x$screen_manager" = "xunknown"; then
741 dnl The variables used for expanding the auto saver.
748 cons_saver="cons.saver"
752 dnl On Linux, check for PAM authentication available
754 AC_CHECK_LIB(pam, pam_start, [
764 dnl User visible support for charset conversion.
766 AC_ARG_ENABLE([charset],
767 [--enable-charset Support for charset selection and conversion])
769 if test "x$enable_charset" = xyes; then
770 if test -z "$am_cv_func_iconv"; then
771 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
773 AC_DEFINE(HAVE_CHARSET, 1,
774 [Define to enable charset selection and conversion])
781 dnl This code should be moved to the ac_WITH_SLANG
783 dnl We check for the existance of setupterm on curses library
784 dnl this is required to load certain definitions on some termcaps
785 dnl editions (AIX and OSF/1 I seem to remember).
786 dnl Note that we avoid using setupterm
787 case $screen_manager in
793 AC_CHECK_LIB(curses,setupterm,
797 if (key_end == parm_insert_line)
801 [LIBS="$LIBS -lcurses"
802 AC_DEFINE(USE_SETUPTERM)])
808 LIBS="$LIBS $posix_libs"
819 if test "x$SAMBAFILES" != x; then
820 AC_CONFIG_SUBDIRS([vfs/samba])
823 AM_CONDITIONAL(USE_EDIT, [test -n "$LIBEDIT_A"])
824 AM_CONDITIONAL(USE_VFS, [test -n "$LIBVFS"])
825 AM_CONDITIONAL(USE_VFS_NET, [test -n "$NETFILES"])
826 AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$undelfs_o"])
827 AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$SAMBAFILES"])
828 AM_CONDITIONAL(MCSERV_INSTALL,
829 [test "x$enable_mcserv_install$mcserv" = xyesmcserv])
830 AM_CONDITIONAL(INCLUDED_SLANG, [test -n "$LIBSLANG"])
831 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
832 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
839 vfs/Makefile:vfs/Make-mc.in
864 doc/mc.1 doc/mcedit.1 doc/mcserv.8
866 intl/Makefile po/Makefile.in
867 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
869 if echo "$screen_manager" | grep -q "SLang" ; then
870 screen_manager="${screen_manager}${slang_term}"
876 Source code location: ${srcdir}
878 Compiler flags: ${CFLAGS}
879 File system: ${vfs_type}
881 Screen manager: ${screen_manager}
882 Install console saver: ${install_saver}
883 Mouse support: ${mouse_lib}
884 X11 events support: ${textmode_x11_support}
885 Debugger code: ${mem_debug}
886 With subshell support: ${subshell}
887 Internal editor: ${EDIT_msg}
888 Install path: ${prefix}/bin, ${prefix}/lib/mc