2 dnl Configure.in file for the Midnight Commander
8 AM_INIT_AUTOMAKE(mc, 4.5.55)
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])
27 dnl AC_SYS_LARGEFILE is missing in Autoconf-2.13
28 ifelse(AC_ACVERSION, [2.13], [],
29 [dnl Only enable large file support if --enable-largefile was given
30 if test "x$enable_largefile" = xyes; then
35 AC_CHECK_TOOL(AR, ar, ar)
37 AC_CHECK_PROGS(X11_WWW,netscape arena Mosaic chimera)
38 if test x"$X11_WWW" = x; then
42 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"
45 dnl Internationalization
50 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
51 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/intl"
52 LINTL='-L$(top_builddir)/intl -lintl'
53 INTLDEPS='$(top_builddir)/intl/libintl.a'
59 dnl Hack to make extraconf.h visible even if compiling outside srcdir.
61 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
64 dnl Enforce coding standards
66 if test "x$GCC" = xyes; then
67 CFLAGS="$CFLAGS -Wall"
73 AM_PATH_GLIB(1.2.0,,[AC_MSG_ERROR([Test for GLIB failed. MC requires GLIB.])])
74 LIBS="$LIBS $GLIB_LIBS"
77 dnl OS specific flags.
85 AC_DEFINE(_POSIX_SOURCE)
88 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
89 AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
94 AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
95 malloc.h stdlib.h termios.h utime.h fcntl.h sys/statfs.h \
96 sys/time.h sys/timeb.h stropts.h])
104 dnl Missing structure components
110 dnl Check availability of some functions
113 AC_CHECK_FUNCS([strerror statfs strcasecmp strncasecmp strcoll strftime \
114 strdup memmove pwdauth truncate initgroups putenv \
115 memset memcpy tcsetattr tcgetattr cfgetospeed \
116 sigaction sigemptyset sigprocmask sigaddset \
117 sysconf setuid setreuid \
121 dnl getpt is a GNU Extension (glibc 2.1.x)
123 AC_CHECK_FUNCS(getpt)
128 AC_CHECK_LIB(shadow,pw_encrypt,
130 AC_CHECK_HEADERS(shadow.h,,
131 [AC_CHECK_HEADERS(shadow/shadow.h,,
132 [shadow_header=no])])
133 if test $shadow_header = yes; then
134 AC_DEFINE(LINUX_SHADOW)
141 NEED_CRYPT_PROTOTYPE=yes
142 if test x$ac_cv_header_crypt_h = xyes; then
143 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");
146 NEED_CRYPT_PROTOTYPE=no])
148 if test x$ac_cv_header_unistd_h = xyes; then
149 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");
152 NEED_CRYPT_PROTOTYPE=no])
155 if test x$NEED_CRYPT_PROTOTYPE = xyes; then
156 AC_DEFINE(NEED_CRYPT_PROTOTYPE)
160 dnl AIX and Sequent need <sys/select.h> for fd_set
162 AC_CHECK_HEADERS(sys/select.h)
165 dnl On SCO and some SVR4, crypt is on libcrypt.a
166 dnl grantpt in libpt.a
169 AC_CHECK_FUNCS(crypt, , [
170 AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
171 AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
174 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
176 dnl replacing lstat with statlstat on sco makes it more portable between
178 AC_CHECK_FUNCS(statlstat)
181 dnl If running under AIX, AC_AIX does not tell us that
183 AC_MSG_CHECKING([for AIX defines])
185 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
189 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
191 ], [AC_MSG_RESULT(no)])
194 dnl This hack is here until autoconf adds it
195 dnl Needed for Unixware: getmntent is on libgen.a
197 AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
200 dnl This is from GNU fileutils, check aclocal.m4 for more information
205 dnl Missing typedefs and replacements
209 AC_CHECK_TYPE(umode_t, int)
210 AC_CHECK_TYPE(off_t, long)
213 AC_CHECK_TYPE(nlink_t, unsigned int)
221 dnl X11 support in the textmode edition.
224 dnl These variables are only used when building the text edition MC binary
230 textmode_x11_support="no"
231 AC_ARG_WITH(tm-x-support,
232 [--with-tm-x-support Add X Window System support to the text edition],
233 [if test x$withval = xyes; then
235 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
236 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT)
237 textmode_x11_support="yes"
242 dnl Network related functions
245 AC_CHECK_LIB(nsl, t_accept)
246 AC_CHECK_LIB(socket, socket)
249 AC_CHECK_FUNCS(socket, have_socket=yes)
250 if test $have_socket = no; then
251 # socket is not in the default libraries. See if it's in some other.
252 for lib in bsd socket inet; do
253 AC_CHECK_LIB($lib, socket, [
256 AC_DEFINE(HAVE_SOCKET)
261 have_gethostbyname=no
262 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
263 if test $have_gethostbyname = no; then
264 # gethostbyname is not in the default libraries. See if it's in some other.
265 for lib in bsd socket inet; do
266 AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
270 AC_CHECK_FUNCS(socketpair)
273 dnl Sequent wants getprocessstats
275 AC_CHECK_LIB(seq, get_process_stats, [
277 AC_DEFINE(HAVE_GET_PROCESS_STATS)])
282 dnl Install mcserv only if explicitly enabled
284 AC_ARG_ENABLE([mcserv-install],
285 [--enable-mcserv-install Install mcserv - Midnight Commander file server])
287 AM_CONDITIONAL(MCSERV_INSTALL,
288 [test "x$enable_mcserv_install$mcserv" = xyesmcserv])
291 if test $have_socket = yes; then
292 NETFILES="\$(NETFILES)"
299 if test $use_vfs = yes
303 MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
304 AC_MSG_RESULT([Using the VFS switch code])
305 vfs_type="Midnight Commander Virtual File System"
310 screen_manager=unknown
316 dnl AC_ARG_WITH(bsd-curses,
317 dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
318 dnl [search_ncurses=false
319 dnl screen_manager="Ultrix/cursesX"
322 dnl THIS_CURSES=cursesX
325 dnl THIS_CURSES=curses
329 dnl LIBS="$LIBS -l$THIS_CURSES -ltermcap"
330 dnl AC_DEFINE(USE_BSD_CURSES)
331 dnl XCURSES="xcurses.o"
332 dnl AC_MSG_RESULT([Please note that some screen refreshs may fail])
333 dnl AC_MSG_WARN([Use of the bsdcurses extension has some])
334 dnl AC_MSG_WARN([display/input problems.])
335 dnl AC_MSG_WARN([Reconsider using xcurses])
338 AC_ARG_WITH(sunos-curses,
339 [--with-sunos-curses Used to force SunOS 4.x curses],[
340 if test x$withval = xyes; then
345 AC_ARG_WITH(osf1-curses,
346 [--with-osf1-curses Used to force OSF/1 curses],[
347 if test x$withval = xyes; then
353 [--with-vcurses[=incdir] Used to force SysV curses],
354 [if test x$withval = xyes; then :
356 CPPFLAGS="$CPPFLAGS -I$withval"
361 mouse_lib="xterm only"
365 AC_ARG_WITH(gpm-mouse,
366 [--with-gpm-mouse[=base-dir] Compile with gpm mouse support (Linux only)],
367 [if test x$withval != xno
369 if test x$withval != xyes
371 LIBS="$LIBS -L$withval/lib"
372 CPPFLAGS="$CPPFLAGS -I$withval/include"
374 AC_DEFINE(HAVE_LIBGPM)
375 mouse_lib="GPM and xterm"
378 [AC_CHECK_LIB(gpm, Gpm_Repeat,
379 [AC_DEFINE(HAVE_LIBGPM)
380 mouse_lib="GPM and xterm"
382 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
390 [--with-ncurses[=base-dir] Compile with ncurses/locate base dir],
391 [if test x$withval = xyes
395 LIBS="$LIBS -L$withval/lib -lncurses"
396 CPPFLAGS="$CPPFLAGS -I$withval/include"
398 screen_manager="ncurses"
399 AC_DEFINE(USE_NCURSES)
404 [--with-hsc Compile with support for the HSC firewall],
405 [if test x$withval = xyes; then
406 AC_DEFINE(HSC_PROXY, 1,
407 [Define if you want to use the HSC firewall])
420 libgtkedit="libgtkedit.a"
421 if test x"$xvers" = xnone; then
426 gnomeicondir=`gnome-config --datadir`/pixmaps
428 dnl Check for new enough gnome-libs
431 CFLAGS=`gnome-config --cflags gnomeui`
432 LIBS=`gnome-config --libs gnomeui`
434 AC_CHECK_LIB(gnomeui, gnome_window_icon_set_default_from_file,
435 [AC_DEFINE(HAVE_GNOME_WINDOW_ICON)])
440 AC_SUBST(gnomeicondir)
443 AC_SUBST(GNOMEGNORBA_LIBS)
444 AM_CONDITIONAL(GNOME, [test x"$mx" = xmx])
447 dnl Check for the -mandoc package
449 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
451 AC_MSG_CHECKING([for manual formatting macros])
452 AC_CACHE_VAL(ac_cv_mandoc, [
453 nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
462 AC_MSG_RESULT($MANDOC)
469 dnl Check if nroff accepts -Tlatin1 or -Tascii
472 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
473 AC_CACHE_VAL(ac_cv_nroff_tascii, [
474 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
477 ac_cv_nroff_tascii=" -Tlatin1"
479 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
482 ac_cv_nroff_tascii=" -Tascii"
484 ac_cv_nroff_tascii=""
488 if test "x$ac_cv_nroff_tascii" = x; then
491 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
494 TROFFASCII="$ac_cv_nroff_tascii"
498 dnl Check for - option to file
500 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
501 if $HAVE_FILECMD; then
502 AC_MSG_CHECKING([for - option to file command])
503 AC_CACHE_VAL(ac_cv_filestdin, [[
504 cat > conftest.c <<\EOF
511 cat > conftest.sed <<\EOF
515 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
516 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
517 if test "x$filehyphen_1" = "x$filehyphen_2"; then
522 rm conftest.c conftest.sed
525 if test x$ac_cv_filestdin = xyes; then
526 AC_DEFINE(FILE_STDIN, 1,
527 [Define if the file command accepts - for stdin])
529 filestdin=$ac_cv_filestdin
530 AC_MSG_RESULT([$filestdin])
533 dnl Check for -L option to file
536 AC_MSG_CHECKING([for -L option to file command])
537 AC_CACHE_VAL(ac_cv_filel, [
538 file -L . > /dev/null 2>&1
546 if test x$ac_cv_filel = xyes; then
547 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
550 AC_MSG_RESULT([$filel])
554 dnl Check to see if grep program allowes dash to denote stdin
556 AC_MSG_CHECKING([for - option to grep command])
557 AC_CACHE_VAL(ac_cv_grep_stdin, [
558 echo "grep_test" | grep grep_test - >/dev/null 2>&1
565 if test x$ac_cv_grep_stdin = xyes; then
566 AC_DEFINE(GREP_STDIN, 1, [Define if the grep command accepts - for stdin])
568 AC_MSG_RESULT([$ac_cv_grep_stdin])
571 dnl The subshell support
574 AC_MSG_CHECKING([for subshell support])
575 AC_ARG_WITH(subshell,
576 [--with-subshell If you want to use a concurrent shell],
578 if test x$withval = xoptional
580 AC_DEFINE(SUBSHELL_OPTIONAL)
581 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
584 if test x$withval = xyes
586 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
589 [dnl Default: provide the subshell support on non-ultrix machines
595 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
600 AC_MSG_RESULT([$result])
604 dnl Memory Allocation Debugger
608 [--with-mad Developers only: activates MAD (memory debugger)],
609 [if test x$withval = xyes; then
610 mem_debug="Janne's MAD library"
612 AC_MSG_RESULT([compiling with memory leak detector])
616 dnl Electric Fence - another memory debugger
619 [--with-efence Developers only: activates Electric Fence],
620 [if test x$withval = xyes; then
621 LIBS="$LIBS -lefence"
622 AC_MSG_RESULT([compiling with Electric fence])
623 mem_debug="Electric Fence"
627 dnl To force mmap support
628 dnl We use only part of the functionality of mmap, so on AIX,
629 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
632 [--with-mmap To force using the mmap call (AIX)],
633 [if test x$withval = xyes; then
635 AC_MSG_RESULT([forcing MMAP support])
640 slang_use_system_installed_lib=false
641 AC_CHECK_LIB(slang,SLang_init_tty,
642 [AC_CHECK_HEADERS(slang.h)
643 if test x$ac_cv_header_slang_h = xyes
645 slang_use_system_installed_lib=true
646 slang_check_lib=false
648 AC_CHECK_HEADERS(slang/slang.h)
649 if test x$ac_cv_header_slang_slang_h = xyes
651 slang_use_system_installed_lib=true
652 slang_check_lib=false
657 AC_ARG_WITH(terminfo,
658 [--with-terminfo SLANG: Force usage of terminfo],[
659 if test x$withval = xyes; then
661 slang_check_lib=false
662 slang_use_system_installed_lib=false
667 [--with-termcap SLANG: Force usage of termcap],[
668 if test x$withval = xyes; then
670 slang_check_lib=false
671 slang_use_system_installed_lib=false
675 AC_ARG_WITH(included-slang,
676 [--with-included-slang SLANG: use the SLang library included here],[
677 if test x$withval = xyes; then
678 slang_use_system_installed_lib=false
686 [--with-slang Compile with the slang screen manager],[
687 if test x$withval = xyes; then
700 [--with-edit Define INTERNAL_EDIT],
701 [if test x$withval = xyes
707 [dnl Default: provide the internal editor
715 [--with-netrc Compile with ftp .netrc support],[
716 if test x$withval = xyes; then
717 AC_DEFINE(USE_NETRC, 1,
718 [Define to use .netrc for FTP connections])
719 AC_MSG_RESULT([ftpfs will have .netrc parsing code])
725 if test $use_vfs = yes; then
726 AC_ARG_WITH(ext2undel,
727 [--with-ext2undel Compile with ext2 undelete code],[
728 if test x$withval != xno;
730 if test x$withval != xyes
732 LIBS="$LIBS -L$withval/lib"
733 CPPFLAGS="$CPPFLAGS -I$withval/include"
738 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL],,-lcom_err)
746 AC_CHECKING([location of ncurses.h file])
748 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
749 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
750 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
751 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")
753 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")
755 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
758 dnl We couldn't find ncurses, try SysV curses
762 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
764 AC_EGREP_CPP(USE_NCURSES,[
771 CPPFLAGS="$CPPFLAGS -DRENAMED_NCURSES"
772 AC_DEFINE(USE_NCURSES)
774 screen_manager="ncurses installed as curses"
779 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
780 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
781 dnl should be replaced by a more fine grained selection routine
785 if test -f /usr/5include/curses.h
790 # check for ncurses version, to properly ifdef mouse-fix
791 AC_MSG_CHECKING([for ncurses version])
792 ncurses_version=unknown
793 cat > conftest.$ac_ext <<EOF
794 [#]line __oline__ "configure"
795 #include "confdefs.h"
796 #ifdef RENAMED_NCURSES
802 VERSION:NCURSES_VERSION
804 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
805 egrep "VERSION:" >conftest.out 2>&1; then
806 ncurses_version=`cat conftest.out|sed -e 's/^[[^"]]*"//' -e 's/".*//'`
809 AC_MSG_RESULT([$ncurses_version])
810 case "$ncurses_version" in
812 AC_DEFINE(NCURSES_970530,2)
815 AC_DEFINE(NCURSES_970530,1)
818 AC_DEFINE(NCURSES_970530,0)
825 dnl If ncurses exports the ESCDELAY variable it should be set to 0
826 dnl or you'll have to press Esc three times to dismiss a dialog box.
828 if test -n "$ncurses_version"; then
829 AC_CACHE_CHECK([for ESCDELAY variable],
830 [mc_cv_ncurses_escdelay],
831 [AC_TRY_COMPILE([], [
838 [mc_cv_ncurses_escdelay=yes],
839 [mc_cv_ncurses_escdelay=no]
842 if test "$mc_cv_ncurses_escdelay" = yes; then
843 AC_DEFINE(HAVE_ESCDELAY, 1,
844 [Define if ncurses has ESCDELAY variable])
849 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
850 dnl check for resizeterm and keyok.
854 AC_CHECK_FUNCS(resizeterm keyok)
857 if test "x$screen_manager" = "xunknown"; then
862 dnl The variables used for expanding the auto saver.
869 cons_saver="cons.saver"
873 dnl On Linux, check for PAM authentication available
875 AC_CHECK_LIB(pam, pam_start, [
885 dnl User visible support for charset conversion.
887 AC_ARG_ENABLE([charset],
888 [--enable-charset Support for charset selection and conversion])
890 if test "x$enable_charset" = xyes; then
891 if test -z "$am_cv_func_iconv"; then
892 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
894 AC_DEFINE(HAVE_CHARSET, 1,
895 [Define to enable charset selection and conversion])
900 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
904 dnl This code should be moved to the ac_WITH_SLANG
906 dnl We check for the existance of setupterm on curses library
907 dnl this is required to load certain definitions on some termcaps
908 dnl editions (AIX and OSF/1 I seem to remember).
909 dnl Note that we avoid using setupterm
910 case $screen_manager in
916 AC_CHECK_LIB(curses,setupterm,
920 if (key_end == parm_insert_line)
924 [LIBS="$LIBS -lcurses"
925 AC_DEFINE(USE_SETUPTERM)])
931 LIBS="$LIBS $posix_libs"
943 dnl Output configuration files
945 dnl It's a hack to accomodate both Autoconf 2.13 and the 2.49x series,
946 dnl It's needed until Autoconf 2.50 is released.
947 ifelse(AC_ACVERSION, [2.13],
949 if test "x$SAMBAFILES" != x; then
951 AC_CONFIG_SUBDIRS([$mc_subdirs])
953 [if test "x$SAMBAFILES" != x; then
954 AC_CONFIG_SUBDIRS([vfs/samba])
957 AM_CONDITIONAL(USE_SAMBA_FS, [test "x$SAMBAFILES" != x])
966 doc-gnome/C/figs/Makefile
967 vfs/Makefile:vfs/Make-mc.in
997 doc/mc.1 doc/mcedit.1 doc/mcserv.8
999 intl/Makefile po/Makefile.in
1000 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
1002 if echo "$screen_manager" | grep -q "SLang" ; then
1003 screen_manager="${screen_manager}${slang_term}"
1009 Source code location: ${srcdir}
1011 Compiler flags: ${CFLAGS}
1012 File system: ${vfs_type}
1014 Text mode screen manager: ${screen_manager}
1015 Install console saver: ${install_saver}
1016 Text mode mouse library: ${mouse_lib}
1017 Text mode X11 support: ${textmode_x11_support}
1018 Debugger code: ${mem_debug}
1019 With subshell support: ${subshell}
1020 X11 versions: ${xvers}
1021 Internal editor: ${EDIT_msg}
1022 Install path: ${prefix}/bin, ${prefix}/lib/mc