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
42 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
43 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
47 dnl Hack to make extraconf.h visible even if compiling outside srcdir.
49 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
52 dnl Enforce coding standards
54 if test "x$GCC" = xyes; then
55 CFLAGS="$CFLAGS -Wall"
61 AM_PATH_GLIB(1.2.0,,[AC_MSG_ERROR([Test for GLIB failed. MC requires GLIB.])])
62 LIBS="$LIBS $GLIB_LIBS"
65 dnl OS specific flags.
73 AC_DEFINE(_POSIX_SOURCE)
76 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
77 AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
82 AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
83 malloc.h stdlib.h termios.h utime.h fcntl.h pwd.h sys/statfs.h \
84 sys/time.h sys/timeb.h stropts.h])
92 dnl Missing structure components
98 dnl Check availability of some functions
101 AC_CHECK_FUNCS([strerror statfs strcasecmp strncasecmp strcoll strftime \
102 strdup memmove pwdauth truncate initgroups putenv \
103 memset memcpy tcsetattr tcgetattr cfgetospeed \
104 sigaction sigemptyset sigprocmask sigaddset \
105 sysconf setuid setreuid \
109 dnl getpt is a GNU Extension (glibc 2.1.x)
111 AC_CHECK_FUNCS(getpt)
116 AC_CHECK_LIB(shadow,pw_encrypt,
118 AC_CHECK_HEADERS(shadow.h,,
119 [AC_CHECK_HEADERS(shadow/shadow.h,,
120 [shadow_header=no])])
121 if test $shadow_header = yes; then
122 AC_DEFINE(LINUX_SHADOW, 1,
123 [Define to use shadow passwords on Linux])
130 NEED_CRYPT_PROTOTYPE=yes
131 if test x$ac_cv_header_crypt_h = xyes; then
132 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");
135 NEED_CRYPT_PROTOTYPE=no])
137 if test x$ac_cv_header_unistd_h = xyes; then
138 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");
141 NEED_CRYPT_PROTOTYPE=no])
144 if test x$NEED_CRYPT_PROTOTYPE = xyes; then
145 AC_DEFINE(NEED_CRYPT_PROTOTYPE, 1,
146 [Define if function `crypt' needs a prototype])
150 dnl AIX and Sequent need <sys/select.h> for fd_set
152 AC_CHECK_HEADERS(sys/select.h)
155 dnl On SCO and some SVR4, crypt is on libcrypt.a
156 dnl grantpt in libpt.a
159 AC_CHECK_FUNCS(crypt, , [
160 AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
161 AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
164 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
166 dnl replacing lstat with statlstat on sco makes it more portable between
168 AC_CHECK_FUNCS(statlstat)
171 dnl If running under AIX, AC_AIX does not tell us that
173 AC_MSG_CHECKING([for AIX defines])
175 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
179 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
181 ], [AC_MSG_RESULT(no)])
184 dnl This is from GNU fileutils, check aclocal.m4 for more information
189 dnl Missing typedefs and replacements
193 AC_CHECK_TYPE(umode_t, int)
194 AC_CHECK_TYPE(off_t, long)
197 AC_CHECK_TYPE(nlink_t, unsigned int)
208 dnl These variables are only used when building the MC binary
214 textmode_x11_support="no"
215 AC_ARG_WITH(tm-x-support,
216 [--with-tm-x-support Try getting events from X Window System],
217 [if test x$withval = xyes; then
219 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
220 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
221 [Define to enable getting events from X Window System])
222 textmode_x11_support="yes"
227 dnl Network related functions
230 AC_CHECK_LIB(nsl, t_accept)
231 AC_CHECK_LIB(socket, socket)
234 AC_CHECK_FUNCS(socket, have_socket=yes)
235 if test $have_socket = no; then
236 # socket is not in the default libraries. See if it's in some other.
237 for lib in bsd socket inet; do
238 AC_CHECK_LIB($lib, socket, [
241 AC_DEFINE(HAVE_SOCKET)
246 have_gethostbyname=no
247 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
248 if test $have_gethostbyname = no; then
249 # gethostbyname is not in the default libraries. See if it's in some other.
250 for lib in bsd socket inet; do
251 AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
255 AC_CHECK_FUNCS(socketpair)
258 dnl Sequent wants getprocessstats
260 AC_CHECK_LIB(seq, get_process_stats, [
262 AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
263 [Define if you have function `get_process_stats' and
264 have to use that instead of gettimeofday])])
269 dnl Install mcserv only if explicitly enabled
271 AC_ARG_ENABLE([mcserv-install],
272 [--enable-mcserv-install Install mcserv - Midnight Commander file server])
275 if test $have_socket = yes; then
276 NETFILES="\$(NETFILES)"
281 if test $use_vfs = yes
283 AC_MSG_RESULT([Using the VFS switch code])
284 vfs_type="Midnight Commander Virtual File System"
287 screen_manager=unknown
290 mouse_lib="xterm only"
293 AC_ARG_WITH(gpm-mouse,
294 [--with-gpm-mouse[=base-dir] Compile with gpm mouse support (Linux only)],
295 [if test x$withval != xno
297 if test x$withval != xyes
299 LIBS="$LIBS -L$withval/lib"
300 CPPFLAGS="$CPPFLAGS -I$withval/include"
302 AC_DEFINE(HAVE_LIBGPM, 1,
303 [Define to enable gpm mouse support on Linux])
304 mouse_lib="GPM and xterm"
305 MCLIBS="-lgpm $MCLIBS"
307 [AC_CHECK_LIB(gpm, Gpm_Repeat,
308 [AC_DEFINE(HAVE_LIBGPM)
309 mouse_lib="GPM and xterm"
310 MCLIBS="-lgpm $MCLIBS"],
311 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
318 [--with-ncurses[=base-dir] Compile with ncurses/locate base dir],
319 [if test x$withval = xyes
323 MCLIBS="$MCLIBS -L$withval/lib -lncurses"
324 CPPFLAGS="$CPPFLAGS -I$withval/include"
326 screen_manager="ncurses"
327 AC_DEFINE(USE_NCURSES)
332 [--with-hsc Compile with support for the HSC firewall],
333 [if test x$withval = xyes; then
334 AC_DEFINE(HSC_PROXY, 1,
335 [Define if you want to use the HSC firewall])
340 dnl Check for the -mandoc package
342 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
344 AC_MSG_CHECKING([for manual formatting macros])
345 AC_CACHE_VAL(ac_cv_mandoc, [
346 nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
355 AC_MSG_RESULT($MANDOC)
362 dnl Check if nroff accepts -Tlatin1 or -Tascii
365 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
366 AC_CACHE_VAL(ac_cv_nroff_tascii, [
367 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
370 ac_cv_nroff_tascii=" -Tlatin1"
372 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
375 ac_cv_nroff_tascii=" -Tascii"
377 ac_cv_nroff_tascii=""
381 if test "x$ac_cv_nroff_tascii" = x; then
384 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
387 TROFFASCII="$ac_cv_nroff_tascii"
391 dnl Check for - option to file
393 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
394 if $HAVE_FILECMD; then
395 AC_MSG_CHECKING([for - option to file command])
396 AC_CACHE_VAL(ac_cv_filestdin, [[
397 cat > conftest.c <<\EOF
404 cat > conftest.sed <<\EOF
408 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
409 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
410 if test "x$filehyphen_1" = "x$filehyphen_2"; then
415 rm conftest.c conftest.sed
418 if test x$ac_cv_filestdin = xyes; then
419 AC_DEFINE(FILE_STDIN, 1,
420 [Define if the file command accepts - for stdin])
422 filestdin=$ac_cv_filestdin
423 AC_MSG_RESULT([$filestdin])
426 dnl Check for -L option to file
429 AC_MSG_CHECKING([for -L option to file command])
430 AC_CACHE_VAL(ac_cv_filel, [
431 file -L . > /dev/null 2>&1
439 if test x$ac_cv_filel = xyes; then
440 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
443 AC_MSG_RESULT([$filel])
447 dnl Check to see if grep program allowes dash to denote stdin
449 AC_MSG_CHECKING([for - option to grep command])
450 AC_CACHE_VAL(ac_cv_grep_stdin, [
451 echo "grep_test" | grep grep_test - >/dev/null 2>&1
458 if test x$ac_cv_grep_stdin = xyes; then
459 AC_DEFINE(GREP_STDIN, 1, [Define if the grep command accepts - for stdin])
461 AC_MSG_RESULT([$ac_cv_grep_stdin])
464 dnl The subshell support
467 AC_MSG_CHECKING([for subshell support])
468 AC_ARG_WITH(subshell,
469 [--with-subshell If you want to use a concurrent shell],
471 if test x$withval = xoptional
473 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
474 [Define to make subshell support optional])
475 AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
476 [Define to enable subshell support])
479 if test x$withval = xyes
481 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
484 [dnl Default: provide the subshell support on non-ultrix machines
490 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
495 AC_MSG_RESULT([$result])
499 dnl Memory Allocation Debugger
503 [--with-mad Developers only: activates MAD (memory debugger)],
504 [if test x$withval = xyes; then
505 mem_debug="Janne's MAD library"
506 AC_DEFINE(HAVE_MAD, 1,
507 [Define to use Memory Allocation Debugger (MAD)])
508 AC_MSG_RESULT([compiling with memory leak detector])
512 dnl Electric Fence - another memory debugger
515 [--with-efence Developers only: activates Electric Fence],
516 [if test x$withval = xyes; then
517 LIBS="$LIBS -lefence"
518 AC_MSG_RESULT([compiling with Electric fence])
519 mem_debug="Electric Fence"
523 dnl To force mmap support
524 dnl We use only part of the functionality of mmap, so on AIX,
525 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
528 [--with-mmap To force using the mmap call (AIX)],
529 [if test x$withval = xyes; then
531 AC_MSG_RESULT([forcing MMAP support])
536 slang_use_system_installed_lib=false
537 AC_CHECK_LIB(slang,SLang_init_tty,
538 [AC_CHECK_HEADERS(slang.h)
539 if test x$ac_cv_header_slang_h = xyes
541 slang_use_system_installed_lib=true
542 slang_check_lib=false
544 AC_CHECK_HEADERS(slang/slang.h)
545 if test x$ac_cv_header_slang_slang_h = xyes
547 slang_use_system_installed_lib=true
548 slang_check_lib=false
553 AC_ARG_WITH(terminfo,
554 [--with-terminfo SLANG: Force usage of terminfo],[
555 if test x$withval = xyes; then
557 slang_check_lib=false
558 slang_use_system_installed_lib=false
563 [--with-termcap SLANG: Force usage of termcap],[
564 if test x$withval = xyes; then
566 slang_check_lib=false
567 slang_use_system_installed_lib=false
571 AC_ARG_WITH(included-slang,
572 [--with-included-slang SLANG: use the SLang library included here],[
573 if test x$withval = xyes; then
574 slang_use_system_installed_lib=false
580 [--with-slang Compile with the slang screen manager],[
581 if test x$withval = xyes; then
591 [--with-edit Define INTERNAL_EDIT],
592 [if test x$withval = xyes
598 [dnl Default: provide the internal editor
606 [--with-netrc Compile with ftp .netrc support],[
607 if test x$withval = xyes; then
608 AC_DEFINE(USE_NETRC, 1,
609 [Define to use .netrc for FTP connections])
610 AC_MSG_RESULT([ftpfs will have .netrc parsing code])
616 if test $use_vfs = yes; then
617 AC_ARG_WITH(ext2undel,
618 [--with-ext2undel Compile with ext2 undelete code],[
619 if test x$withval != xno;
621 if test x$withval != xyes
623 LIBS="$LIBS -L$withval/lib"
624 CPPFLAGS="$CPPFLAGS -I$withval/include"
629 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL],,-lcom_err)
637 AC_CHECKING([location of ncurses.h file])
639 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
640 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
641 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
642 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")
644 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")
646 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
652 # check for ncurses version, to properly ifdef mouse-fix
653 AC_MSG_CHECKING([for ncurses version])
654 ncurses_version=unknown
655 cat > conftest.$ac_ext <<EOF
656 [#]line __oline__ "configure"
657 #include "confdefs.h"
658 #ifdef RENAMED_NCURSES
664 VERSION:NCURSES_VERSION
666 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
667 egrep "VERSION:" >conftest.out 2>&1; then
668 ncurses_version=`cat conftest.out|sed -e 's/^[[^"]]*"//' -e 's/".*//'`
671 AC_MSG_RESULT([$ncurses_version])
672 case "$ncurses_version" in
674 AC_DEFINE(NCURSES_970530,2,
675 [Define according to ncurses version,
676 see configure.in for details])
679 AC_DEFINE(NCURSES_970530,1)
682 AC_DEFINE(NCURSES_970530,0)
689 dnl Ncurses specific checks
691 dnl If ncurses exports the ESCDELAY variable it should be set to 0
692 dnl or you'll have to press Esc three times to dismiss a dialog box.
694 if test -n "$ncurses_version"; then
697 AC_CACHE_CHECK([for ESCDELAY variable],
698 [mc_cv_ncurses_escdelay],
699 [AC_TRY_COMPILE([], [
706 [mc_cv_ncurses_escdelay=yes],
707 [mc_cv_ncurses_escdelay=no]
710 if test "$mc_cv_ncurses_escdelay" = yes; then
711 AC_DEFINE(HAVE_ESCDELAY, 1,
712 [Define if ncurses has ESCDELAY variable])
715 AC_CHECK_FUNCS(resizeterm keyok)
719 if test "x$screen_manager" = "xunknown"; then
724 dnl The variables used for expanding the auto saver.
731 cons_saver="cons.saver"
735 dnl On Linux, check for PAM authentication available
737 AC_CHECK_LIB(pam, pam_start, [
738 AC_DEFINE(HAVE_PAM, 1,
739 [Define if PAM (Pluggable Authentication Modules) is available])
748 dnl User visible support for charset conversion.
750 AC_ARG_ENABLE([charset],
751 [--enable-charset Support for charset selection and conversion])
753 if test "x$enable_charset" = xyes; then
754 if test -z "$am_cv_func_iconv"; then
755 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
757 AC_DEFINE(HAVE_CHARSET, 1,
758 [Define to enable charset selection and conversion])
765 dnl This code should be moved to the ac_WITH_SLANG
767 dnl We check for the existance of setupterm on curses library
768 dnl this is required to load certain definitions on some termcaps
769 dnl editions (AIX and OSF/1 I seem to remember).
770 dnl Note that we avoid using setupterm
771 case $screen_manager in
777 AC_CHECK_LIB(curses,setupterm,
781 if (key_end == parm_insert_line)
785 [LIBS="$LIBS -lcurses"
786 AC_DEFINE(USE_SETUPTERM, 1,
787 [Define to use function `setupterm'
788 from `curses' library in S-Lang])])
794 LIBS="$LIBS $posix_libs"
801 if test "x$SAMBAFILES" != x; then
802 AC_CONFIG_SUBDIRS([vfs/samba])
805 AM_CONDITIONAL(USE_EDIT, [test -n "$LIBEDIT_A"])
806 AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes])
807 AM_CONDITIONAL(USE_VFS_NET, [test -n "$NETFILES"])
808 AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$undelfs_o"])
809 AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$SAMBAFILES"])
810 AM_CONDITIONAL(MCSERV_INSTALL,
811 [test "x$enable_mcserv_install$mcserv" = xyesmcserv])
812 AM_CONDITIONAL(INCLUDED_SLANG,
813 [test "x$slang_use_system_installed_lib" = xfalse])
814 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
815 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
817 AH_BOTTOM([#include <extraconf.h>])
823 vfs/Makefile:vfs/Make-mc.in
848 doc/mc.1 doc/mcedit.1 doc/mcserv.8
850 intl/Makefile po/Makefile.in
851 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
853 if echo "$screen_manager" | grep -q "SLang" ; then
854 screen_manager="${screen_manager}${slang_term}"
860 Source code location: ${srcdir}
862 Compiler flags: ${CFLAGS}
863 File system: ${vfs_type}
865 Screen manager: ${screen_manager}
866 Install console saver: ${install_saver}
867 Mouse support: ${mouse_lib}
868 X11 events support: ${textmode_x11_support}
869 Debugger code: ${mem_debug}
870 With subshell support: ${subshell}
871 Internal editor: ${EDIT_msg}
872 Install path: ${prefix}/bin, ${prefix}/lib/mc