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 strdup memmove pwdauth truncate initgroups putenv \
89 memset memcpy tcsetattr tcgetattr cfgetospeed \
90 sigaction sigemptyset sigprocmask sigaddset \
91 sysconf setuid setreuid \
95 dnl getpt is a GNU Extension (glibc 2.1.x)
102 AC_CHECK_LIB(shadow,pw_encrypt,
104 AC_CHECK_HEADERS(shadow.h,,
105 [AC_CHECK_HEADERS(shadow/shadow.h,,
106 [shadow_header=no])])
107 if test $shadow_header = yes; then
108 AC_DEFINE(LINUX_SHADOW)
115 NEED_CRYPT_PROTOTYPE=yes
116 if test x$ac_cv_header_crypt_h = xyes; then
117 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");
120 NEED_CRYPT_PROTOTYPE=no])
122 if test x$ac_cv_header_unistd_h = xyes; then
123 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");
126 NEED_CRYPT_PROTOTYPE=no])
129 if test x$NEED_CRYPT_PROTOTYPE = xyes; then
130 AC_DEFINE(NEED_CRYPT_PROTOTYPE)
134 dnl AIX and Sequent need <sys/select.h> for fd_set
136 AC_CHECK_HEADERS(sys/select.h)
139 dnl On SCO and some SVR4, crypt is on libcrypt.a
140 dnl grantpt in libpt.a
143 AC_CHECK_FUNCS(crypt, , [
144 AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
145 AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
148 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
151 dnl libintl.a required on SCO to provide proper NLS support
152 dnl (using native cc links it by default)
154 if test x$GCC = xyes; then
155 AC_CHECK_LIB(intl, tolower)
158 dnl replacing lstat with statlstat on sco makes it more portable between
160 AC_CHECK_FUNCS(statlstat)
163 dnl If running under AIX, AC_AIX does not tell us that
165 AC_MSG_CHECKING([for AIX defines])
167 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
171 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
173 ], [AC_MSG_RESULT(no)])
176 dnl This hack is here until autoconf adds it
177 dnl Needed for Unixware: getmntent is on libgen.a
179 AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
182 dnl This is from GNU fileutils, check aclocal.m4 for more information
187 dnl Missing typedefs and replacements
191 AC_CHECK_TYPE(umode_t, int)
192 AC_CHECK_TYPE(off_t, long)
195 AC_CHECK_TYPE(nlink_t, unsigned int)
203 dnl X11 support in the textmode edition.
206 dnl These variables are only used when building the text edition MC binary
212 textmode_x11_support="no"
213 AC_ARG_WITH(tm-x-support,
214 [--with-tm-x-support Add X Window System support to the text edition],
215 [if test x$withval = xyes; then
217 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
218 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT)
219 textmode_x11_support="yes"
224 dnl Network related functions
227 AC_CHECK_LIB(nsl, t_accept)
228 AC_CHECK_LIB(socket, socket)
231 AC_CHECK_FUNCS(socket, have_socket=yes)
232 if test $have_socket = no; then
233 # socket is not in the default libraries. See if it's in some other.
234 for lib in bsd socket inet; do
235 AC_CHECK_LIB($lib, socket, [
238 AC_DEFINE(HAVE_SOCKET)
243 have_gethostbyname=no
244 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
245 if test $have_gethostbyname = no; then
246 # gethostbyname is not in the default libraries. See if it's in some other.
247 for lib in bsd socket inet; do
248 AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
252 AC_CHECK_FUNCS(socketpair)
255 dnl Sequent wants getprocessstats
257 AC_CHECK_LIB(seq, get_process_stats, [
259 AC_DEFINE(HAVE_GET_PROCESS_STATS)])
264 dnl Install mcserv only if explicitly enabled
266 AC_ARG_ENABLE([mcserv-install],
267 [--enable-mcserv-install Install mcserv - Midnight Commander file server])
269 AM_CONDITIONAL(MCSERV_INSTALL,
270 [test "x$enable_mcserv_install$mcserv" = xyesmcserv])
273 if test $have_socket = yes; then
274 NETFILES="\$(NETFILES)"
281 if test $use_vfs = yes
285 MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
286 AC_MSG_RESULT([Using the VFS switch code])
287 vfs_type="Midnight Commander Virtual File System"
292 screen_manager=unknown
298 dnl AC_ARG_WITH(bsd-curses,
299 dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
300 dnl [search_ncurses=false
301 dnl screen_manager="Ultrix/cursesX"
304 dnl THIS_CURSES=cursesX
307 dnl THIS_CURSES=curses
311 dnl LIBS="$LIBS -l$THIS_CURSES -ltermcap"
312 dnl AC_DEFINE(USE_BSD_CURSES)
313 dnl XCURSES="xcurses.o"
314 dnl AC_MSG_RESULT([Please note that some screen refreshs may fail])
315 dnl AC_MSG_WARN([Use of the bsdcurses extension has some])
316 dnl AC_MSG_WARN([display/input problems.])
317 dnl AC_MSG_WARN([Reconsider using xcurses])
320 AC_ARG_WITH(sunos-curses,
321 [--with-sunos-curses Used to force SunOS 4.x curses],[
322 if test x$withval = xyes; then
327 AC_ARG_WITH(osf1-curses,
328 [--with-osf1-curses Used to force OSF/1 curses],[
329 if test x$withval = xyes; then
335 [--with-vcurses[=incdir] Used to force SysV curses],
336 [if test x$withval = xyes; then :
338 CPPFLAGS="$CPPFLAGS -I$withval"
343 mouse_lib="xterm only"
347 AC_ARG_WITH(gpm-mouse,
348 [--with-gpm-mouse[=base-dir] Compile with gpm mouse support (Linux only)],
349 [if test x$withval != xno
351 if test x$withval != xyes
353 LIBS="$LIBS -L$withval/lib"
354 CPPFLAGS="$CPPFLAGS -I$withval/include"
356 AC_DEFINE(HAVE_LIBGPM)
357 mouse_lib="GPM and xterm"
360 [AC_CHECK_LIB(gpm, Gpm_Repeat,
361 [AC_DEFINE(HAVE_LIBGPM)
362 mouse_lib="GPM and xterm"
364 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
372 [--with-ncurses[=base-dir] Compile with ncurses/locate base dir],
373 [if test x$withval = xyes
377 LIBS="$LIBS -L$withval/lib -lncurses"
378 CPPFLAGS="$CPPFLAGS -I$withval/include"
380 screen_manager="ncurses"
381 AC_DEFINE(USE_NCURSES)
386 [--with-hsc Compile with support for the HSC firewall],
387 [if test x$withval = xyes; then
388 AC_DEFINE(HSC_PROXY, 1,
389 [Define if you want to use the HSC firewall])
402 libgtkedit="libgtkedit.a"
403 if test x"$xvers" = xnone; then
408 gnomeicondir=`gnome-config --datadir`/pixmaps
410 dnl Check for new enough gnome-libs
413 CFLAGS=`gnome-config --cflags gnomeui`
414 LIBS=`gnome-config --libs gnomeui`
416 AC_CHECK_LIB(gnomeui, gnome_window_icon_set_default_from_file,
417 [AC_DEFINE(HAVE_GNOME_WINDOW_ICON)])
422 AC_SUBST(gnomeicondir)
425 AC_SUBST(GNOMEGNORBA_LIBS)
426 AM_CONDITIONAL(GNOME, [test x"$mx" = xmx])
429 dnl Check for the -mandoc package
431 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
433 AC_MSG_CHECKING([for manual formatting macros])
434 AC_CACHE_VAL(ac_cv_mandoc, [
435 nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
444 AC_MSG_RESULT($MANDOC)
451 dnl Check if nroff accepts -Tlatin1 or -Tascii
454 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
455 AC_CACHE_VAL(ac_cv_nroff_tascii, [
456 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
459 ac_cv_nroff_tascii=" -Tlatin1"
461 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
464 ac_cv_nroff_tascii=" -Tascii"
466 ac_cv_nroff_tascii=""
470 if test "x$ac_cv_nroff_tascii" = x; then
473 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
476 TROFFASCII="$ac_cv_nroff_tascii"
480 dnl Check for - option to file
482 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
483 if $HAVE_FILECMD; then
484 AC_MSG_CHECKING([for - option to file command])
485 AC_CACHE_VAL(ac_cv_filestdin, [[
486 cat > conftest.c <<\EOF
493 cat > conftest.sed <<\EOF
497 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
498 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
499 if test "x$filehyphen_1" = "x$filehyphen_2"; then
504 rm conftest.c conftest.sed
507 if test x$ac_cv_filestdin = xyes; then
508 AC_DEFINE(FILE_STDIN, 1,
509 [Define if the file command accepts - for stdin])
511 filestdin=$ac_cv_filestdin
512 AC_MSG_RESULT([$filestdin])
515 dnl Check for -L option to file
518 AC_MSG_CHECKING([for -L option to file command])
519 AC_CACHE_VAL(ac_cv_filel, [
520 file -L . > /dev/null 2>&1
528 if test x$ac_cv_filel = xyes; then
529 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
532 AC_MSG_RESULT([$filel])
536 dnl Check to see if grep program allowes dash to denote stdin
538 AC_MSG_CHECKING([for - option to grep command])
539 AC_CACHE_VAL(ac_cv_grep_stdin, [
540 echo "grep_test" | grep grep_test - >/dev/null 2>&1
547 if test x$ac_cv_grep_stdin = xyes; then
548 AC_DEFINE(GREP_STDIN, 1, [Define if the grep command accepts - for stdin])
550 AC_MSG_RESULT([$ac_cv_grep_stdin])
553 dnl The subshell support
556 AC_MSG_CHECKING([for subshell support])
557 AC_ARG_WITH(subshell,
558 [--with-subshell If you want to use a concurrent shell],
560 if test x$withval = xoptional
562 AC_DEFINE(SUBSHELL_OPTIONAL)
563 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
566 if test x$withval = xyes
568 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
571 [dnl Default: provide the subshell support on non-ultrix machines
577 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
582 AC_MSG_RESULT([$result])
586 dnl Memory Allocation Debugger
590 [--with-mad Developers only: activates MAD (memory debugger)],
591 [if test x$withval = xyes; then
592 mem_debug="Janne's MAD library"
594 AC_MSG_RESULT([compiling with memory leak detector])
598 dnl Electric Fence - another memory debugger
601 [--with-efence Developers only: activates Electric Fence],
602 [if test x$withval = xyes; then
603 LIBS="$LIBS -lefence"
604 AC_MSG_RESULT([compiling with Electric fence])
605 mem_debug="Electric Fence"
610 if test x$USE_NLS = xyes; then
611 if test x$USE_INCLUDED_LIBINTL = xyes; then
612 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl"
613 LINTL="-L\$(top_builddir)/intl -lintl"
621 dnl To force mmap support
622 dnl We use only part of the functionality of mmap, so on AIX,
623 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
626 [--with-mmap To force using the mmap call (AIX)],
627 [if test x$withval = xyes; then
629 AC_MSG_RESULT([forcing MMAP support])
634 slang_use_system_installed_lib=false
635 AC_CHECK_LIB(slang,SLang_init_tty,
636 [AC_CHECK_HEADERS(slang.h)
637 if test x$ac_cv_header_slang_h = xyes
639 slang_use_system_installed_lib=true
640 slang_check_lib=false
642 AC_CHECK_HEADERS(slang/slang.h)
643 if test x$ac_cv_header_slang_slang_h = xyes
645 slang_use_system_installed_lib=true
646 slang_check_lib=false
651 AC_ARG_WITH(terminfo,
652 [--with-terminfo SLANG: Force usage of terminfo],[
653 if test x$withval = xyes; then
655 slang_check_lib=false
656 slang_use_system_installed_lib=false
661 [--with-termcap SLANG: Force usage of termcap],[
662 if test x$withval = xyes; then
664 slang_check_lib=false
665 slang_use_system_installed_lib=false
669 AC_ARG_WITH(included-slang,
670 [--with-included-slang SLANG: use the SLang library included here],[
671 if test x$withval = xyes; then
672 slang_use_system_installed_lib=false
680 [--with-slang Compile with the slang screen manager],[
681 if test x$withval = xyes; then
694 [--with-edit Define INTERNAL_EDIT],
695 [if test x$withval = xyes
701 [dnl Default: provide the internal editor
709 [--with-netrc Compile with ftp .netrc support],[
710 if test x$withval = xyes; then
711 AC_DEFINE(USE_NETRC, 1,
712 [Define to use .netrc for FTP connections])
713 AC_MSG_RESULT([ftpfs will have .netrc parsing code])
719 if test $use_vfs = yes; then
720 AC_ARG_WITH(ext2undel,
721 [--with-ext2undel Compile with ext2 undelete code],[
722 if test x$withval != xno;
724 if test x$withval != xyes
726 LIBS="$LIBS -L$withval/lib"
727 CPPFLAGS="$CPPFLAGS -I$withval/include"
732 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL],,-lcom_err)
740 AC_CHECKING([location of ncurses.h file])
742 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
743 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
744 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
745 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")
747 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")
749 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
752 dnl We couldn't find ncurses, try SysV curses
756 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
758 AC_EGREP_CPP(USE_NCURSES,[
765 CPPFLAGS="$CPPFLAGS -DRENAMED_NCURSES"
766 AC_DEFINE(USE_NCURSES)
768 screen_manager="ncurses installed as curses"
773 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
774 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
775 dnl should be replaced by a more fine grained selection routine
779 if test -f /usr/5include/curses.h
784 # check for ncurses version, to properly ifdef mouse-fix
785 AC_MSG_CHECKING([for ncurses version])
786 ncurses_version=unknown
787 cat > conftest.$ac_ext <<EOF
788 [#]line __oline__ "configure"
789 #include "confdefs.h"
790 #ifdef RENAMED_NCURSES
796 VERSION:NCURSES_VERSION
798 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
799 egrep "VERSION:" >conftest.out 2>&1; then
800 ncurses_version=`cat conftest.out|sed -e 's/^[[^"]]*"//' -e 's/".*//'`
803 AC_MSG_RESULT([$ncurses_version])
804 case "$ncurses_version" in
806 AC_DEFINE(NCURSES_970530,2)
809 AC_DEFINE(NCURSES_970530,1)
812 AC_DEFINE(NCURSES_970530,0)
819 dnl If ncurses exports the ESCDELAY variable it should be set to 0
820 dnl or you'll have to press Esc three times to dismiss a dialog box.
822 if test -n "$ncurses_version"; then
823 AC_CACHE_CHECK([for ESCDELAY variable],
824 [mc_cv_ncurses_escdelay],
825 [AC_TRY_COMPILE([], [
832 [mc_cv_ncurses_escdelay=yes],
833 [mc_cv_ncurses_escdelay=no]
836 if test "$mc_cv_ncurses_escdelay" = yes; then
837 AC_DEFINE(HAVE_ESCDELAY, 1,
838 [Define if ncurses has ESCDELAY variable])
843 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
844 dnl check for resizeterm and keyok.
848 AC_CHECK_FUNCS(resizeterm keyok)
851 if test "x$screen_manager" = "xunknown"; then
856 dnl The variables used for expanding the auto saver.
863 cons_saver="cons.saver"
867 dnl On Linux, check for PAM authentication available
869 AC_CHECK_LIB(pam, pam_start, [
879 dnl We need sed in order to fix the library files
881 SEDCMD="sed 's/-man/$MANDOC/'"
882 SEDCMD2="sed 's%@prefix@%\$(prefix)%'"
888 dnl Basic support for charset conversion.
889 dnl May be useful e.g. for converting help and hints.
892 AC_CHECK_FUNCS(iconv, [have_iconv=yes])
895 dnl User visible support for charset conversion.
897 AC_ARG_ENABLE([charset],
898 [--enable-charset Support for charset selection and conversion])
900 if test "x$enable_charset" = xyes; then
901 if test -z "$have_iconv"; then
902 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
904 AC_DEFINE(HAVE_CHARSET, 1,
905 [Define to enable charset selection and conversion])
910 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
914 dnl This code should be moved to the ac_WITH_SLANG
916 dnl We check for the existance of setupterm on curses library
917 dnl this is required to load certain definitions on some termcaps
918 dnl editions (AIX and OSF/1 I seem to remember).
919 dnl Note that we avoid using setupterm
920 case $screen_manager in
926 AC_CHECK_LIB(curses,setupterm,
930 if (key_end == parm_insert_line)
934 [LIBS="$LIBS -lcurses"
935 AC_DEFINE(USE_SETUPTERM)])
941 LIBS="$LIBS $posix_libs"
953 dnl Output configuration files
955 dnl It's a hack to accomodate both Autoconf 2.13 and the 2.49x series,
956 dnl It's needed until Autoconf 2.50 is released.
957 ifelse(AC_ACVERSION, [2.13],
959 if test "x$SAMBAFILES" != x; then
961 AC_CONFIG_SUBDIRS([$mc_subdirs])
963 [if test "x$SAMBAFILES" != x; then
964 AC_CONFIG_SUBDIRS([vfs/samba])
967 AM_CONDITIONAL(USE_SAMBA_FS, [test "x$SAMBAFILES" != x])
976 doc-gnome/C/figs/Makefile
977 vfs/Makefile:vfs/Make-mc.in
1007 doc/mc.1 doc/mcedit.1 doc/mcserv.8
1009 intl/Makefile po/Makefile.in
1010 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
1012 if echo "$screen_manager" | grep -q "SLang" ; then
1013 screen_manager="${screen_manager}${slang_term}"
1019 Source code location: ${srcdir}
1021 Compiler flags: ${CFLAGS}
1022 File system: ${vfs_type}
1024 Text mode screen manager: ${screen_manager}
1025 Install console saver: ${install_saver}
1026 Text mode mouse library: ${mouse_lib}
1027 Text mode X11 support: ${textmode_x11_support}
1028 Debugger code: ${mem_debug}
1029 With subshell support: ${subshell}
1030 X11 versions: ${xvers}
1031 Internal editor: ${EDIT_msg}
1032 Install path: ${prefix}/bin, ${prefix}/lib/mc