2 dnl Configure.in file for the Midnight Commander
8 AM_INIT_AUTOMAKE(mc, 4.5.54)
9 AM_CONFIG_HEADER(config.h)
21 dnl It's a hack to accomodate both Autoconf 2.13 and the 2.49x series,
22 dnl It's needed until Autoconf 2.50 is released.
23 ifdef([AC_PROG_CC_STDC], [AC_PROG_CC_STDC], [AM_PROG_CC_STDC])
26 AC_CHECK_TOOL(AR, ar, ar)
28 AC_CHECK_PROGS(X11_WWW,netscape arena Mosaic chimera)
29 if test x"$X11_WWW" = x; then
33 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.Big5 zh_CN.GB2312"
38 dnl Enforce coding standards
40 if test "x$GCC" = xyes; then
41 CFLAGS="$CFLAGS -Wall"
47 AM_PATH_GLIB(1.2.0,,[AC_MSG_ERROR([Test for GLIB failed. MC requires GLIB.])])
48 LIBS="$LIBS $GLIB_LIBS"
51 dnl OS specific flags.
59 AC_DEFINE(_POSIX_SOURCE)
62 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
63 AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
68 AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
69 malloc.h stdlib.h termios.h utime.h fcntl.h sys/statfs.h \
70 sys/time.h sys/timeb.h])
78 dnl Missing structure components
84 dnl Check availability of some functions
87 AC_CHECK_FUNCS(strerror statfs getwd strcasecmp strncasecmp strcoll strftime)
88 AC_CHECK_FUNCS(strdup memmove pwdauth truncate initgroups putenv)
89 AC_CHECK_FUNCS(memset memcpy tcsetattr tcgetattr cfgetospeed)
90 AC_CHECK_FUNCS(sigaction sigemptyset sigprocmask sigaddset)
91 AC_CHECK_FUNCS(sysconf setuid setreuid)
94 dnl getpt is a GNU Extension (glibc 2.1.x)
101 AC_CHECK_LIB(shadow,pw_encrypt,
103 AC_CHECK_HEADERS(shadow.h,,
104 [AC_CHECK_HEADERS(shadow/shadow.h,,
105 [shadow_header=no])])
106 if test $shadow_header = yes; then
107 AC_DEFINE(LINUX_SHADOW)
114 NEED_CRYPT_PROTOTYPE=yes
115 if test x$ac_cv_header_crypt_h = xyes; then
116 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");],[
117 NEED_CRYPT_PROTOTYPE=no])
119 if test x$ac_cv_header_unistd_h = xyes; then
120 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");],[
121 NEED_CRYPT_PROTOTYPE=no])
124 if test x$NEED_CRYPT_PROTOTYPE=xyes; then
125 AC_DEFINE(NEED_CRYPT_PROTOTYPE)
129 dnl AIX and Sequent need <sys/select.h> for fd_set
131 AC_CHECK_HEADERS(sys/select.h)
134 dnl On SCO and some SVR4, crypt is on libcrypt.a
135 dnl grantpt in libpt.a
138 AC_CHECK_FUNCS(crypt, , [
139 AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
140 AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
143 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
146 dnl libintl.a required on SCO to provide proper NLS support
147 dnl (using native cc links it by default)
149 if test x$GCC = xyes; then
150 AC_CHECK_LIB(intl, tolower)
153 dnl replacing lstat with statlstat on sco makes it more portable between
155 AC_CHECK_FUNCS(statlstat)
158 dnl If running under AIX, AC_AIX does not tell us that
160 AC_MSG_CHECKING([for AIX defines])
162 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
166 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
168 ], [AC_MSG_RESULT(no)])
171 dnl This hack is here until autoconf adds it
172 dnl Needed for Unixware: getmntent is on libgen.a
174 AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
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)
198 dnl X11 support in the textmode edition.
201 dnl These variables are only used when building the text edition MC binary
207 textmode_x11_support="no"
208 AC_ARG_WITH(tm-x-support,
209 [--with-tm-x-support Add X Window System support to the text edition],
210 [if test x$withval = xyes; then
212 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
213 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT)
214 textmode_x11_support="yes"
219 dnl Network related functions
222 AC_CHECK_LIB(nsl, t_accept)
223 AC_CHECK_LIB(socket, socket)
226 AC_CHECK_FUNCS(socket, have_socket=yes)
227 if test $have_socket = no; then
228 # socket is not in the default libraries. See if it's in some other.
229 for lib in bsd socket inet; do
230 AC_CHECK_LIB($lib, socket, [
233 AC_DEFINE(HAVE_SOCKET)
238 have_gethostbyname=no
239 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
240 if test $have_gethostbyname = no; then
241 # gethostbyname is not in the default libraries. See if it's in some other.
242 for lib in bsd socket inet; do
243 AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
247 AC_CHECK_FUNCS(socketpair)
250 dnl Sequent wants getprocessstats
252 AC_CHECK_LIB(seq, get_process_stats, [
254 AC_DEFINE(HAVE_GET_PROCESS_STATS)])
259 dnl Install mcserv only if explicitly enabled
261 AC_ARG_ENABLE([mcserv-install],
262 [--enable-mcserv-install Install mcserv - Midnight Commander file server])
264 AM_CONDITIONAL(MCSERV_INSTALL,
265 [test "x$enable_mcserv_install$mcserv" = xyesmcserv])
268 if test $have_socket = yes; then
269 NETFILES="\$(NETFILES)"
276 if test $use_vfs = yes
280 MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
281 AC_MSG_RESULT([Using the VFS switch code])
282 vfs_type="Midnight Commander Virtual File System"
287 screen_manager=unknown
293 dnl AC_ARG_WITH(bsd-curses,
294 dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
295 dnl [search_ncurses=false
296 dnl screen_manager="Ultrix/cursesX"
299 dnl THIS_CURSES=cursesX
302 dnl THIS_CURSES=curses
306 dnl LIBS="$LIBS -l$THIS_CURSES -ltermcap"
307 dnl AC_DEFINE(USE_BSD_CURSES)
308 dnl XCURSES="xcurses.o"
309 dnl AC_MSG_RESULT([Please note that some screen refreshs may fail])
310 dnl AC_MSG_WARN([Use of the bsdcurses extension has some])
311 dnl AC_MSG_WARN([display/input problems.])
312 dnl AC_MSG_WARN([Reconsider using xcurses])
315 AC_ARG_WITH(sunos-curses,
316 [--with-sunos-curses Used to force SunOS 4.x curses],[
317 if test x$withval = xyes; then
322 AC_ARG_WITH(osf1-curses,
323 [--with-osf1-curses Used to force OSF/1 curses],[
324 if test x$withval = xyes; then
330 [--with-vcurses[=incdir] Used to force SysV curses],
331 [if test x$withval = xyes; then :
333 CPPFLAGS="$CPPFLAGS -I$withval"
338 mouse_lib="xterm only"
342 AC_ARG_WITH(gpm-mouse,
343 [--with-gpm-mouse[=base-dir] Compile with gpm mouse support (Linux only)],
344 [if test x$withval != xno
346 if test x$withval != xyes
348 LIBS="$LIBS -L$withval/lib"
349 CPPFLAGS="$CPPFLAGS -I$withval/include"
351 AC_DEFINE(HAVE_LIBGPM)
352 mouse_lib="GPM and xterm"
355 [AC_CHECK_LIB(gpm, Gpm_Repeat,
356 [AC_DEFINE(HAVE_LIBGPM)
357 mouse_lib="GPM and xterm"
359 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
367 [--with-ncurses[=base-dir] Compile with ncurses/locate base dir],
368 [if test x$withval = xyes
372 LIBS="$LIBS -L$withval/lib -lncurses"
373 CPPFLAGS="$CPPFLAGS -I$withval/include"
375 screen_manager="ncurses"
376 AC_DEFINE(USE_NCURSES)
381 [--with-hsc Compile with support for the HSC firewall],
382 [if test x$withval = xyes; then
383 AC_DEFINE(HSC_PROXY, 1,
384 [Define if you want to use the HSC firewall])
397 libgtkedit="libgtkedit.a"
398 if test x"$xvers" = xnone; then
403 gnomeicondir=`gnome-config --datadir`/pixmaps
405 dnl Check for new enough gnome-libs
408 CFLAGS=`gnome-config --cflags gnomeui`
409 LIBS=`gnome-config --libs gnomeui`
411 AC_CHECK_LIB(gnomeui, gnome_window_icon_set_default_from_file,
412 [AC_DEFINE(HAVE_GNOME_WINDOW_ICON)])
417 AC_SUBST(gnomeicondir)
420 AC_SUBST(GNOMEGNORBA_LIBS)
421 AM_CONDITIONAL(GNOME, [test x"$mx" = xmx])
424 dnl Check for the -mandoc package
426 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
428 AC_MSG_CHECKING([for manual formatting macros])
429 AC_CACHE_VAL(ac_cv_mandoc, [
430 nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
439 AC_MSG_RESULT($MANDOC)
446 dnl Check if nroff accepts -Tlatin1 or -Tascii
449 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
450 AC_CACHE_VAL(ac_cv_nroff_tascii, [
451 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
454 ac_cv_nroff_tascii=" -Tlatin1"
456 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
459 ac_cv_nroff_tascii=" -Tascii"
461 ac_cv_nroff_tascii=""
465 if test "x$ac_cv_nroff_tascii" = x; then
468 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
471 TROFFASCII="$ac_cv_nroff_tascii"
475 dnl Check for - option to file
477 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
478 if $HAVE_FILECMD; then
479 AC_MSG_CHECKING([for - option to file command])
480 AC_CACHE_VAL(ac_cv_filestdin, [[
481 cat > conftest.c <<\EOF
488 cat > conftest.sed <<\EOF
492 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
493 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
494 if test "x$filehyphen_1" = "x$filehyphen_2"; then
499 rm conftest.c conftest.sed
502 if test x$ac_cv_filestdin = xyes; then
503 AC_DEFINE(FILE_STDIN, 1,
504 [Define if the file command accepts - for stdin])
506 filestdin=$ac_cv_filestdin
507 AC_MSG_RESULT([$filestdin])
510 dnl Check for -L option to file
513 AC_MSG_CHECKING([for -L option to file command])
514 AC_CACHE_VAL(ac_cv_filel, [
515 file -L . > /dev/null 2>&1
523 if test x$ac_cv_filel = xyes; then
524 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
527 AC_MSG_RESULT([$filel])
531 dnl Check to see if grep program allowes dash to denote stdin
533 AC_MSG_CHECKING([for - option to grep command])
534 AC_CACHE_VAL(ac_cv_grep_stdin, [
535 echo "grep_test" | grep grep_test - >/dev/null 2>&1
542 if test x$ac_cv_grep_stdin = xyes; then
543 AC_DEFINE(GREP_STDIN, 1, [Define if the grep command accepts - for stdin])
545 AC_MSG_RESULT([$ac_cv_grep_stdin])
548 dnl The subshell support
551 AC_MSG_CHECKING([for subshell support])
552 AC_ARG_WITH(subshell,
553 [--with-subshell If you want to use a concurrent shell],
555 if test x$withval = xoptional
557 AC_DEFINE(SUBSHELL_OPTIONAL)
558 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
561 if test x$withval = xyes
563 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
566 [dnl Default: provide the subshell support on non-ultrix machines
572 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
577 AC_MSG_RESULT([$result])
581 dnl Memory Allocation Debugger
585 [--with-mad Developers only: activates MAD (memory debugger)],
586 [if test x$withval = xyes; then
587 mem_debug="Janne's MAD library"
589 AC_MSG_RESULT([compiling with memory leak detector])
593 dnl Electric Fence - another memory debugger
596 [--with-efence Developers only: activates Electric Fence],
597 [if test x$withval = xyes; then
598 LIBS="$LIBS -lefence"
599 AC_MSG_RESULT([compiling with Electric fence])
600 mem_debug="Electric Fence"
605 if test x$USE_NLS = xyes; then
606 if test x$USE_INCLUDED_LIBINTL = xyes; then
607 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl"
608 LINTL="-L\$(top_builddir)/intl -lintl"
616 dnl To force mmap support
617 dnl We use only part of the functionality of mmap, so on AIX,
618 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
621 [--with-mmap To force using the mmap call (AIX)],
622 [if test x$withval = xyes; then
624 AC_MSG_RESULT([forcing MMAP support])
629 slang_use_system_installed_lib=false
630 AC_CHECK_LIB(slang,SLang_init_tty,
631 [AC_CHECK_HEADERS(slang.h)
632 if test x$ac_cv_header_slang_h = xyes
634 slang_use_system_installed_lib=true
635 slang_check_lib=false
637 AC_CHECK_HEADERS(slang/slang.h)
638 if test x$ac_cv_header_slang_slang_h = xyes
640 slang_use_system_installed_lib=true
641 slang_check_lib=false
646 AC_ARG_WITH(terminfo,
647 [--with-terminfo SLANG: Force usage of terminfo],[
648 if test x$withval = xyes; then
650 slang_check_lib=false
651 slang_use_system_installed_lib=false
656 [--with-termcap SLANG: Force usage of termcap],[
657 if test x$withval = xyes; then
659 slang_check_lib=false
660 slang_use_system_installed_lib=false
664 AC_ARG_WITH(included-slang,
665 [--with-included-slang SLANG: use the SLang library included here],[
666 if test x$withval = xyes; then
667 slang_use_system_installed_lib=false
675 [--with-slang Compile with the slang screen manager],[
676 if test x$withval = xyes; then
689 [--with-edit Define INTERNAL_EDIT],
690 [if test x$withval = xyes
696 [dnl Default: provide the internal editor
704 [--with-netrc Compile with ftp .netrc support],[
705 if test x$withval = xyes; then
706 AC_DEFINE(USE_NETRC, 1,
707 [Define to use .netrc for FTP connections])
708 AC_MSG_RESULT([ftpfs will have .netrc parsing code])
714 if test $use_vfs = yes; then
715 AC_ARG_WITH(ext2undel,
716 [--with-ext2undel Compile with ext2 undelete code],[
717 if test x$withval != xno;
719 if test x$withval != xyes
721 LIBS="$LIBS -L$withval/lib"
722 CPPFLAGS="$CPPFLAGS -I$withval/include"
727 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL],,-lcom_err)
735 AC_CHECKING([location of ncurses.h file])
737 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
738 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
739 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
740 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")
742 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")
744 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
747 dnl We couldn't find ncurses, try SysV curses
751 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
753 AC_EGREP_CPP(USE_NCURSES,[
760 CPPFLAGS="$CPPFLAGS -DRENAMED_NCURSES"
761 AC_DEFINE(USE_NCURSES)
763 screen_manager="ncurses installed as curses"
768 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
769 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
770 dnl should be replaced by a more fine grained selection routine
774 if test -f /usr/5include/curses.h
779 # check for ncurses version, to properly ifdef mouse-fix
780 AC_MSG_CHECKING([for ncurses version])
781 ncurses_version=unknown
782 cat > conftest.$ac_ext <<EOF
783 [#]line __oline__ "configure"
784 #include "confdefs.h"
785 #ifdef RENAMED_NCURSES
791 VERSION:NCURSES_VERSION
793 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
794 egrep "VERSION:" >conftest.out 2>&1; then
795 ncurses_version=`cat conftest.out|sed -e 's/^[[^"]]*"//' -e 's/".*//'`
798 AC_MSG_RESULT([$ncurses_version])
799 case "$ncurses_version" in
801 AC_DEFINE(NCURSES_970530,2)
804 AC_DEFINE(NCURSES_970530,1)
807 AC_DEFINE(NCURSES_970530,0)
814 dnl If ncurses exports the ESCDELAY variable it should be set to 0
815 dnl or you'll have to press Esc three times to dismiss a dialog box.
817 if test -n "$ncurses_version"; then
818 AC_CACHE_CHECK([for ESCDELAY variable],
819 [mc_cv_ncurses_escdelay],
820 [AC_TRY_COMPILE([], [
827 [mc_cv_ncurses_escdelay=yes],
828 [mc_cv_ncurses_escdelay=no]
831 if test "$mc_cv_ncurses_escdelay" = yes; then
832 AC_DEFINE(HAVE_ESCDELAY, 1,
833 [Define if ncurses has ESCDELAY variable])
838 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
839 dnl check for resizeterm and keyok.
843 AC_CHECK_FUNCS(resizeterm keyok)
846 if test "x$screen_manager" = "xunknown"; then
851 dnl The variables used for expanding the auto saver.
858 cons_saver="cons.saver"
862 dnl On Linux, check for PAM authentication available
864 AC_CHECK_LIB(pam, pam_start, [
874 dnl We need sed in order to fix the library files
876 SEDCMD="sed 's/-man/$MANDOC/'"
877 SEDCMD2="sed 's%@prefix@%\$(prefix)%'"
883 dnl Basic support for charset conversion.
884 dnl May be useful e.g. for converting help and hints.
887 AC_CHECK_FUNCS(iconv, [have_iconv=yes])
890 dnl User visible support for charset conversion.
892 AC_ARG_ENABLE([charset],
893 [--enable-charset Support for charset selection and conversion])
895 if test "x$enable_charset" = xyes; then
896 if test -z "$have_iconv"; then
897 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
899 AC_DEFINE(HAVE_CHARSET, 1,
900 [Define to enable charset selection and conversion])
905 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
909 dnl This code should be moved to the ac_WITH_SLANG
911 dnl We check for the existance of setupterm on curses library
912 dnl this is required to load certain definitions on some termcaps
913 dnl editions (AIX and OSF/1 I seem to remember).
914 dnl Note that we avoid using setupterm
915 case $screen_manager in
921 AC_CHECK_LIB(curses,setupterm,
925 if (key_end == parm_insert_line)
929 [LIBS="$LIBS -lcurses"
930 AC_DEFINE(USE_SETUPTERM)])
936 LIBS="$LIBS $posix_libs"
948 dnl Output configuration files
950 dnl It's a hack to accomodate both Autoconf 2.13 and the 2.49x series,
951 dnl It's needed until Autoconf 2.50 is released.
952 ifelse(AC_ACVERSION, [2.13],
954 if test "x$SAMBAFILES" != x; then
956 AC_CONFIG_SUBDIRS([$mc_subdirs])
958 [if test "x$SAMBAFILES" != x; then
959 AC_CONFIG_SUBDIRS([vfs/samba])
962 AM_CONDITIONAL(USE_SAMBA_FS, [test "x$SAMBAFILES" != x])
971 doc-gnome/C/figs/Makefile
972 vfs/Makefile:vfs/Make-mc.in
1002 doc/mc.1 doc/mcedit.1 doc/mcserv.8
1004 intl/Makefile po/Makefile.in
1005 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
1007 if echo "$screen_manager" | grep -q "SLang" ; then
1008 screen_manager="${screen_manager}${slang_term}"
1014 Source code location: ${srcdir}
1016 Compiler flags: ${CFLAGS}
1017 File system: ${vfs_type}
1019 Text mode screen manager: ${screen_manager}
1020 Install console saver: ${install_saver}
1021 Text mode mouse library: ${mouse_lib}
1022 Text mode X11 support: ${textmode_x11_support}
1023 Debugger code: ${mem_debug}
1024 With subshell support: ${subshell}
1025 X11 versions: ${xvers}
1026 Internal editor: ${EDIT_msg}
1027 Install path: ${prefix}/bin, ${prefix}/lib/mc