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");
119 NEED_CRYPT_PROTOTYPE=no])
121 if test x$ac_cv_header_unistd_h = xyes; then
122 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");
125 NEED_CRYPT_PROTOTYPE=no])
128 if test x$NEED_CRYPT_PROTOTYPE = xyes; then
129 AC_DEFINE(NEED_CRYPT_PROTOTYPE)
133 dnl AIX and Sequent need <sys/select.h> for fd_set
135 AC_CHECK_HEADERS(sys/select.h)
138 dnl On SCO and some SVR4, crypt is on libcrypt.a
139 dnl grantpt in libpt.a
142 AC_CHECK_FUNCS(crypt, , [
143 AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
144 AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
147 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
150 dnl libintl.a required on SCO to provide proper NLS support
151 dnl (using native cc links it by default)
153 if test x$GCC = xyes; then
154 AC_CHECK_LIB(intl, tolower)
157 dnl replacing lstat with statlstat on sco makes it more portable between
159 AC_CHECK_FUNCS(statlstat)
162 dnl If running under AIX, AC_AIX does not tell us that
164 AC_MSG_CHECKING([for AIX defines])
166 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
170 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
172 ], [AC_MSG_RESULT(no)])
175 dnl This hack is here until autoconf adds it
176 dnl Needed for Unixware: getmntent is on libgen.a
178 AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
181 dnl This is from GNU fileutils, check aclocal.m4 for more information
186 dnl Missing typedefs and replacements
190 AC_CHECK_TYPE(umode_t, int)
191 AC_CHECK_TYPE(off_t, long)
194 AC_CHECK_TYPE(nlink_t, unsigned int)
202 dnl X11 support in the textmode edition.
205 dnl These variables are only used when building the text edition MC binary
211 textmode_x11_support="no"
212 AC_ARG_WITH(tm-x-support,
213 [--with-tm-x-support Add X Window System support to the text edition],
214 [if test x$withval = xyes; then
216 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
217 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT)
218 textmode_x11_support="yes"
223 dnl Network related functions
226 AC_CHECK_LIB(nsl, t_accept)
227 AC_CHECK_LIB(socket, socket)
230 AC_CHECK_FUNCS(socket, have_socket=yes)
231 if test $have_socket = no; then
232 # socket is not in the default libraries. See if it's in some other.
233 for lib in bsd socket inet; do
234 AC_CHECK_LIB($lib, socket, [
237 AC_DEFINE(HAVE_SOCKET)
242 have_gethostbyname=no
243 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
244 if test $have_gethostbyname = no; then
245 # gethostbyname 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, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
251 AC_CHECK_FUNCS(socketpair)
254 dnl Sequent wants getprocessstats
256 AC_CHECK_LIB(seq, get_process_stats, [
258 AC_DEFINE(HAVE_GET_PROCESS_STATS)])
263 dnl Install mcserv only if explicitly enabled
265 AC_ARG_ENABLE([mcserv-install],
266 [--enable-mcserv-install Install mcserv - Midnight Commander file server])
268 AM_CONDITIONAL(MCSERV_INSTALL,
269 [test "x$enable_mcserv_install$mcserv" = xyesmcserv])
272 if test $have_socket = yes; then
273 NETFILES="\$(NETFILES)"
280 if test $use_vfs = yes
284 MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
285 AC_MSG_RESULT([Using the VFS switch code])
286 vfs_type="Midnight Commander Virtual File System"
291 screen_manager=unknown
297 dnl AC_ARG_WITH(bsd-curses,
298 dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
299 dnl [search_ncurses=false
300 dnl screen_manager="Ultrix/cursesX"
303 dnl THIS_CURSES=cursesX
306 dnl THIS_CURSES=curses
310 dnl LIBS="$LIBS -l$THIS_CURSES -ltermcap"
311 dnl AC_DEFINE(USE_BSD_CURSES)
312 dnl XCURSES="xcurses.o"
313 dnl AC_MSG_RESULT([Please note that some screen refreshs may fail])
314 dnl AC_MSG_WARN([Use of the bsdcurses extension has some])
315 dnl AC_MSG_WARN([display/input problems.])
316 dnl AC_MSG_WARN([Reconsider using xcurses])
319 AC_ARG_WITH(sunos-curses,
320 [--with-sunos-curses Used to force SunOS 4.x curses],[
321 if test x$withval = xyes; then
326 AC_ARG_WITH(osf1-curses,
327 [--with-osf1-curses Used to force OSF/1 curses],[
328 if test x$withval = xyes; then
334 [--with-vcurses[=incdir] Used to force SysV curses],
335 [if test x$withval = xyes; then :
337 CPPFLAGS="$CPPFLAGS -I$withval"
342 mouse_lib="xterm only"
346 AC_ARG_WITH(gpm-mouse,
347 [--with-gpm-mouse[=base-dir] Compile with gpm mouse support (Linux only)],
348 [if test x$withval != xno
350 if test x$withval != xyes
352 LIBS="$LIBS -L$withval/lib"
353 CPPFLAGS="$CPPFLAGS -I$withval/include"
355 AC_DEFINE(HAVE_LIBGPM)
356 mouse_lib="GPM and xterm"
359 [AC_CHECK_LIB(gpm, Gpm_Repeat,
360 [AC_DEFINE(HAVE_LIBGPM)
361 mouse_lib="GPM and xterm"
363 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
371 [--with-ncurses[=base-dir] Compile with ncurses/locate base dir],
372 [if test x$withval = xyes
376 LIBS="$LIBS -L$withval/lib -lncurses"
377 CPPFLAGS="$CPPFLAGS -I$withval/include"
379 screen_manager="ncurses"
380 AC_DEFINE(USE_NCURSES)
385 [--with-hsc Compile with support for the HSC firewall],
386 [if test x$withval = xyes; then
387 AC_DEFINE(HSC_PROXY, 1,
388 [Define if you want to use the HSC firewall])
401 libgtkedit="libgtkedit.a"
402 if test x"$xvers" = xnone; then
407 gnomeicondir=`gnome-config --datadir`/pixmaps
409 dnl Check for new enough gnome-libs
412 CFLAGS=`gnome-config --cflags gnomeui`
413 LIBS=`gnome-config --libs gnomeui`
415 AC_CHECK_LIB(gnomeui, gnome_window_icon_set_default_from_file,
416 [AC_DEFINE(HAVE_GNOME_WINDOW_ICON)])
421 AC_SUBST(gnomeicondir)
424 AC_SUBST(GNOMEGNORBA_LIBS)
425 AM_CONDITIONAL(GNOME, [test x"$mx" = xmx])
428 dnl Check for the -mandoc package
430 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
432 AC_MSG_CHECKING([for manual formatting macros])
433 AC_CACHE_VAL(ac_cv_mandoc, [
434 nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
443 AC_MSG_RESULT($MANDOC)
450 dnl Check if nroff accepts -Tlatin1 or -Tascii
453 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
454 AC_CACHE_VAL(ac_cv_nroff_tascii, [
455 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
458 ac_cv_nroff_tascii=" -Tlatin1"
460 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
463 ac_cv_nroff_tascii=" -Tascii"
465 ac_cv_nroff_tascii=""
469 if test "x$ac_cv_nroff_tascii" = x; then
472 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
475 TROFFASCII="$ac_cv_nroff_tascii"
479 dnl Check for - option to file
481 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
482 if $HAVE_FILECMD; then
483 AC_MSG_CHECKING([for - option to file command])
484 AC_CACHE_VAL(ac_cv_filestdin, [[
485 cat > conftest.c <<\EOF
492 cat > conftest.sed <<\EOF
496 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
497 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
498 if test "x$filehyphen_1" = "x$filehyphen_2"; then
503 rm conftest.c conftest.sed
506 if test x$ac_cv_filestdin = xyes; then
507 AC_DEFINE(FILE_STDIN, 1,
508 [Define if the file command accepts - for stdin])
510 filestdin=$ac_cv_filestdin
511 AC_MSG_RESULT([$filestdin])
514 dnl Check for -L option to file
517 AC_MSG_CHECKING([for -L option to file command])
518 AC_CACHE_VAL(ac_cv_filel, [
519 file -L . > /dev/null 2>&1
527 if test x$ac_cv_filel = xyes; then
528 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
531 AC_MSG_RESULT([$filel])
535 dnl Check to see if grep program allowes dash to denote stdin
537 AC_MSG_CHECKING([for - option to grep command])
538 AC_CACHE_VAL(ac_cv_grep_stdin, [
539 echo "grep_test" | grep grep_test - >/dev/null 2>&1
546 if test x$ac_cv_grep_stdin = xyes; then
547 AC_DEFINE(GREP_STDIN, 1, [Define if the grep command accepts - for stdin])
549 AC_MSG_RESULT([$ac_cv_grep_stdin])
552 dnl The subshell support
555 AC_MSG_CHECKING([for subshell support])
556 AC_ARG_WITH(subshell,
557 [--with-subshell If you want to use a concurrent shell],
559 if test x$withval = xoptional
561 AC_DEFINE(SUBSHELL_OPTIONAL)
562 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
565 if test x$withval = xyes
567 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
570 [dnl Default: provide the subshell support on non-ultrix machines
576 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
581 AC_MSG_RESULT([$result])
585 dnl Memory Allocation Debugger
589 [--with-mad Developers only: activates MAD (memory debugger)],
590 [if test x$withval = xyes; then
591 mem_debug="Janne's MAD library"
593 AC_MSG_RESULT([compiling with memory leak detector])
597 dnl Electric Fence - another memory debugger
600 [--with-efence Developers only: activates Electric Fence],
601 [if test x$withval = xyes; then
602 LIBS="$LIBS -lefence"
603 AC_MSG_RESULT([compiling with Electric fence])
604 mem_debug="Electric Fence"
609 if test x$USE_NLS = xyes; then
610 if test x$USE_INCLUDED_LIBINTL = xyes; then
611 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl"
612 LINTL="-L\$(top_builddir)/intl -lintl"
620 dnl To force mmap support
621 dnl We use only part of the functionality of mmap, so on AIX,
622 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
625 [--with-mmap To force using the mmap call (AIX)],
626 [if test x$withval = xyes; then
628 AC_MSG_RESULT([forcing MMAP support])
633 slang_use_system_installed_lib=false
634 AC_CHECK_LIB(slang,SLang_init_tty,
635 [AC_CHECK_HEADERS(slang.h)
636 if test x$ac_cv_header_slang_h = xyes
638 slang_use_system_installed_lib=true
639 slang_check_lib=false
641 AC_CHECK_HEADERS(slang/slang.h)
642 if test x$ac_cv_header_slang_slang_h = xyes
644 slang_use_system_installed_lib=true
645 slang_check_lib=false
650 AC_ARG_WITH(terminfo,
651 [--with-terminfo SLANG: Force usage of terminfo],[
652 if test x$withval = xyes; then
654 slang_check_lib=false
655 slang_use_system_installed_lib=false
660 [--with-termcap SLANG: Force usage of termcap],[
661 if test x$withval = xyes; then
663 slang_check_lib=false
664 slang_use_system_installed_lib=false
668 AC_ARG_WITH(included-slang,
669 [--with-included-slang SLANG: use the SLang library included here],[
670 if test x$withval = xyes; then
671 slang_use_system_installed_lib=false
679 [--with-slang Compile with the slang screen manager],[
680 if test x$withval = xyes; then
693 [--with-edit Define INTERNAL_EDIT],
694 [if test x$withval = xyes
700 [dnl Default: provide the internal editor
708 [--with-netrc Compile with ftp .netrc support],[
709 if test x$withval = xyes; then
710 AC_DEFINE(USE_NETRC, 1,
711 [Define to use .netrc for FTP connections])
712 AC_MSG_RESULT([ftpfs will have .netrc parsing code])
718 if test $use_vfs = yes; then
719 AC_ARG_WITH(ext2undel,
720 [--with-ext2undel Compile with ext2 undelete code],[
721 if test x$withval != xno;
723 if test x$withval != xyes
725 LIBS="$LIBS -L$withval/lib"
726 CPPFLAGS="$CPPFLAGS -I$withval/include"
731 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL],,-lcom_err)
739 AC_CHECKING([location of ncurses.h file])
741 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
742 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
743 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
744 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")
746 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")
748 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
751 dnl We couldn't find ncurses, try SysV curses
755 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
757 AC_EGREP_CPP(USE_NCURSES,[
764 CPPFLAGS="$CPPFLAGS -DRENAMED_NCURSES"
765 AC_DEFINE(USE_NCURSES)
767 screen_manager="ncurses installed as curses"
772 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
773 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
774 dnl should be replaced by a more fine grained selection routine
778 if test -f /usr/5include/curses.h
783 # check for ncurses version, to properly ifdef mouse-fix
784 AC_MSG_CHECKING([for ncurses version])
785 ncurses_version=unknown
786 cat > conftest.$ac_ext <<EOF
787 [#]line __oline__ "configure"
788 #include "confdefs.h"
789 #ifdef RENAMED_NCURSES
795 VERSION:NCURSES_VERSION
797 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
798 egrep "VERSION:" >conftest.out 2>&1; then
799 ncurses_version=`cat conftest.out|sed -e 's/^[[^"]]*"//' -e 's/".*//'`
802 AC_MSG_RESULT([$ncurses_version])
803 case "$ncurses_version" in
805 AC_DEFINE(NCURSES_970530,2)
808 AC_DEFINE(NCURSES_970530,1)
811 AC_DEFINE(NCURSES_970530,0)
818 dnl If ncurses exports the ESCDELAY variable it should be set to 0
819 dnl or you'll have to press Esc three times to dismiss a dialog box.
821 if test -n "$ncurses_version"; then
822 AC_CACHE_CHECK([for ESCDELAY variable],
823 [mc_cv_ncurses_escdelay],
824 [AC_TRY_COMPILE([], [
831 [mc_cv_ncurses_escdelay=yes],
832 [mc_cv_ncurses_escdelay=no]
835 if test "$mc_cv_ncurses_escdelay" = yes; then
836 AC_DEFINE(HAVE_ESCDELAY, 1,
837 [Define if ncurses has ESCDELAY variable])
842 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
843 dnl check for resizeterm and keyok.
847 AC_CHECK_FUNCS(resizeterm keyok)
850 if test "x$screen_manager" = "xunknown"; then
855 dnl The variables used for expanding the auto saver.
862 cons_saver="cons.saver"
866 dnl On Linux, check for PAM authentication available
868 AC_CHECK_LIB(pam, pam_start, [
878 dnl We need sed in order to fix the library files
880 SEDCMD="sed 's/-man/$MANDOC/'"
881 SEDCMD2="sed 's%@prefix@%\$(prefix)%'"
887 dnl Basic support for charset conversion.
888 dnl May be useful e.g. for converting help and hints.
891 AC_CHECK_FUNCS(iconv, [have_iconv=yes])
894 dnl User visible support for charset conversion.
896 AC_ARG_ENABLE([charset],
897 [--enable-charset Support for charset selection and conversion])
899 if test "x$enable_charset" = xyes; then
900 if test -z "$have_iconv"; then
901 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
903 AC_DEFINE(HAVE_CHARSET, 1,
904 [Define to enable charset selection and conversion])
909 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
913 dnl This code should be moved to the ac_WITH_SLANG
915 dnl We check for the existance of setupterm on curses library
916 dnl this is required to load certain definitions on some termcaps
917 dnl editions (AIX and OSF/1 I seem to remember).
918 dnl Note that we avoid using setupterm
919 case $screen_manager in
925 AC_CHECK_LIB(curses,setupterm,
929 if (key_end == parm_insert_line)
933 [LIBS="$LIBS -lcurses"
934 AC_DEFINE(USE_SETUPTERM)])
940 LIBS="$LIBS $posix_libs"
952 dnl Output configuration files
954 dnl It's a hack to accomodate both Autoconf 2.13 and the 2.49x series,
955 dnl It's needed until Autoconf 2.50 is released.
956 ifelse(AC_ACVERSION, [2.13],
958 if test "x$SAMBAFILES" != x; then
960 AC_CONFIG_SUBDIRS([$mc_subdirs])
962 [if test "x$SAMBAFILES" != x; then
963 AC_CONFIG_SUBDIRS([vfs/samba])
966 AM_CONDITIONAL(USE_SAMBA_FS, [test "x$SAMBAFILES" != x])
975 doc-gnome/C/figs/Makefile
976 vfs/Makefile:vfs/Make-mc.in
1006 doc/mc.1 doc/mcedit.1 doc/mcserv.8
1008 intl/Makefile po/Makefile.in
1009 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
1011 if echo "$screen_manager" | grep -q "SLang" ; then
1012 screen_manager="${screen_manager}${slang_term}"
1018 Source code location: ${srcdir}
1020 Compiler flags: ${CFLAGS}
1021 File system: ${vfs_type}
1023 Text mode screen manager: ${screen_manager}
1024 Install console saver: ${install_saver}
1025 Text mode mouse library: ${mouse_lib}
1026 Text mode X11 support: ${textmode_x11_support}
1027 Debugger code: ${mem_debug}
1028 With subshell support: ${subshell}
1029 X11 versions: ${xvers}
1030 Internal editor: ${EDIT_msg}
1031 Install path: ${prefix}/bin, ${prefix}/lib/mc