2 dnl Configure.in file for the Midnight Commander
8 AM_INIT_AUTOMAKE(mc, 4.5.54)
9 AM_CONFIG_HEADER(config.h)
18 if test x"$AWK" = x; then
25 # test whether awk needs -v for variables (e.g. Solaris) or not (e.g. SunOs 4)
26 if test x"`echo | $AWK 'BEGIN { print variable; exit }' variable=123`" = x123; then
32 AC_SUBST(AWK_VAR_OPTION)
39 dnl It's a hack to accomodate both Autoconf 2.13 and the 2.49x series,
40 dnl It's needed until Autoconf 2.50 is released.
41 ifdef([AC_PROG_CC_STDC], [AC_PROG_CC_STDC], [AM_PROG_CC_STDC])
44 AC_CHECK_TOOL(AR, ar, ar)
46 AC_CHECK_PROGS(X11_WWW,netscape arena Mosaic chimera)
47 if test x"$X11_WWW" = x; then
51 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"
56 dnl Enforce coding standards
58 if test "x$GCC" = xyes; then
59 CFLAGS="$CFLAGS -Wall"
65 AM_PATH_GLIB(1.2.0,,[AC_MSG_ERROR([Test for GLIB failed. MC requires GLIB.])])
66 LIBS="$LIBS $GLIB_LIBS"
69 dnl For A/UX. Do not move
76 AC_DEFINE(_POSIX_SOURCE)
80 AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
81 malloc.h stdlib.h termios.h utime.h fcntl.h sys/statfs.h \
82 sys/time.h sys/timeb.h])
90 dnl Missing structure components
96 dnl Check availability of some functions
99 AC_CHECK_FUNCS(strerror statfs getwd strcasecmp strncasecmp strcoll strftime)
100 AC_CHECK_FUNCS(strdup memmove pwdauth truncate initgroups putenv)
101 AC_CHECK_FUNCS(memset memcpy tcsetattr tcgetattr cfgetospeed)
102 AC_CHECK_FUNCS(sigaction sigemptyset sigprocmask sigaddset)
103 AC_CHECK_FUNCS(sysconf setuid setreuid)
106 dnl getpt is a GNU Extension (glibc 2.1.x)
108 AC_CHECK_FUNCS(getpt)
113 AC_CHECK_LIB(shadow,pw_encrypt,
115 AC_CHECK_HEADERS(shadow.h,,
116 [AC_CHECK_HEADERS(shadow/shadow.h,,
117 [shadow_header=no])])
118 if test $shadow_header = yes; then
119 AC_DEFINE(LINUX_SHADOW)
126 NEED_CRYPT_PROTOTYPE=yes
127 if test x$ac_cv_header_crypt_h = xyes; then
128 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");],[
129 NEED_CRYPT_PROTOTYPE=no])
131 if test x$ac_cv_header_unistd_h = xyes; then
132 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");],[
133 NEED_CRYPT_PROTOTYPE=no])
136 if test x$NEED_CRYPT_PROTOTYPE=xyes; then
137 AC_DEFINE(NEED_CRYPT_PROTOTYPE)
141 dnl AIX and Sequent need <sys/select.h> for fd_set
143 AC_CHECK_HEADERS(sys/select.h)
146 dnl On SCO and some SVR4, crypt is on libcrypt.a
147 dnl grantpt in libpt.a
150 AC_CHECK_FUNCS(crypt, , [
151 AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
152 AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
155 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
158 dnl libintl.a required on SCO to provide proper NLS support
159 dnl (using native cc links it by default)
161 if test x$GCC = xyes; then
162 AC_CHECK_LIB(intl, tolower)
165 dnl replacing lstat with statlstat on sco makes it more portable between
167 AC_CHECK_FUNCS(statlstat)
170 dnl If running under AIX, AC_AIX does not tell us that
172 AC_MSG_CHECKING([for AIX defines])
174 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
180 ], [AC_MSG_RESULT(no)])
183 dnl This hack is here until autoconf adds it
184 dnl Needed for Unixware: getmntent is on libgen.a
186 AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
189 dnl This is from GNU fileutils, check aclocal.m4 for more information
194 dnl Missing typedefs and replacements
198 AC_CHECK_TYPE(umode_t, int)
199 AC_CHECK_TYPE(off_t, long)
202 AC_CHECK_TYPE(nlink_t, unsigned int)
208 dnl Cool hack, but we don't use it currently
210 dnl AC_MSG_CHECKING([for token pasting method])
211 dnl AC_EGREP_CPP(portable,[
212 dnl #define tken(a, b) a##b
214 dnl ], [AC_DEFINE(HAVE_PORTABLE_TOKEN_PASTING)
215 dnl AC_MSG_RESULT(portable)
217 dnl AC_MSG_RESULT(non-portable)
223 dnl X11 support in the textmode edition.
226 dnl These variables are only used when building the text edition MC binary
232 textmode_x11_support="no"
233 AC_ARG_WITH(tm-x-support,
234 [--with-tm-x-support Add X Window System support to the text edition],
235 [if test x$withval = xyes; then
237 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
238 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT)
239 textmode_x11_support="yes"
244 dnl Network related functions
247 AC_CHECK_LIB(nsl, t_accept)
248 AC_CHECK_LIB(socket, socket)
251 AC_CHECK_FUNCS(socket, have_socket=yes)
252 if test $have_socket = no; then
253 # socket is not in the default libraries. See if it's in some other.
254 for lib in bsd socket inet; do
255 AC_CHECK_LIB($lib, socket, [
258 AC_DEFINE(HAVE_SOCKET)
263 have_gethostbyname=no
264 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
265 if test $have_gethostbyname = no; then
266 # gethostbyname is not in the default libraries. See if it's in some other.
267 for lib in bsd socket inet; do
268 AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
272 AC_CHECK_FUNCS(socketpair)
275 dnl Sequent wants getprocessstats
277 AC_CHECK_LIB(seq, get_process_stats, [
279 AC_DEFINE(HAVE_GET_PROCESS_STATS)])
284 dnl Install mcserv only if explicitly enabled
286 AC_ARG_ENABLE([mcserv-install],
287 [--enable-mcserv-install Install mcserv - Midnight Commander file server])
289 AM_CONDITIONAL(MCSERV_INSTALL,
290 [test "x$enable_mcserv_install$mcserv" = xyesmcserv])
293 if test $have_socket = yes; then
294 NETFILES="\$(NETFILES)"
302 if test $use_vfs = yes
306 fastdepvfs=fastdepvfs
307 MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
308 AC_MSG_RESULT([Using the VFS switch code])
309 vfs_type="Midnight Commander Virtual File System"
315 screen_manager=unknown
321 dnl AC_ARG_WITH(bsd-curses,
322 dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
323 dnl [search_ncurses=false
324 dnl screen_manager="Ultrix/cursesX"
327 dnl THIS_CURSES=cursesX
330 dnl THIS_CURSES=curses
334 dnl LIBS="$LIBS -l$THIS_CURSES -ltermcap"
335 dnl AC_DEFINE(USE_BSD_CURSES)
336 dnl XCURSES="xcurses.o"
337 dnl AC_MSG_RESULT([Please note that some screen refreshs may fail])
338 dnl AC_MSG_WARN([Use of the bsdcurses extension has some])
339 dnl AC_MSG_WARN([display/input problems.])
340 dnl AC_MSG_WARN([Reconsider using xcurses])
344 [--with-sco Use this to turn on SCO-specific code],[
345 if test x$withval = xyes; then
346 AC_DEFINE(SCO_FLAVOR)
347 CFLAGS="$CFLAGS -D_SVID3"
351 AC_ARG_WITH(sunos-curses,
352 [--with-sunos-curses Used to force SunOS 4.x curses],[
353 if test x$withval = xyes; then
358 AC_ARG_WITH(osf1-curses,
359 [--with-osf1-curses Used to force OSF/1 curses],[
360 if test x$withval = xyes; then
366 [--with-vcurses[=incdir] Used to force SysV curses],
367 [if test x$withval = xyes; then :
369 CPPFLAGS="$CPPFLAGS -I$withval"
374 mouse_lib="xterm only"
378 AC_ARG_WITH(gpm-mouse,
379 [--with-gpm-mouse[=base-dir] Compile with gpm mouse support (Linux only)],
380 [if test x$withval != xno
382 if test x$withval != xyes
384 LIBS="$LIBS -L$withval/lib"
385 CPPFLAGS="$CPPFLAGS -I$withval/include"
387 AC_DEFINE(HAVE_LIBGPM)
388 mouse_lib="GPM and xterm"
391 [AC_CHECK_LIB(gpm, Gpm_Repeat,
392 [AC_DEFINE(HAVE_LIBGPM)
393 mouse_lib="GPM and xterm"
395 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
403 [--with-ncurses[=base-dir] Compile with ncurses/locate base dir],
404 [if test x$withval = xyes
408 LIBS="$LIBS -L$withval/lib -lncurses"
409 CPPFLAGS="$CPPFLAGS -I$withval/include"
411 screen_manager="ncurses"
412 AC_DEFINE(USE_NCURSES)
417 [--with-hsc Compile with support for the HSC firewall],
418 [if test x$withval = xyes; then
434 libgtkedit="libgtkedit.a"
435 if test x"$xvers" = xnone; then
440 gnomeicondir=`gnome-config --datadir`/pixmaps
442 dnl Check for new enough gnome-libs
445 CFLAGS=`gnome-config --cflags gnomeui`
446 LIBS=`gnome-config --libs gnomeui`
448 AC_CHECK_LIB(gnomeui, gnome_window_icon_set_default_from_file,
449 [AC_DEFINE(HAVE_GNOME_WINDOW_ICON)])
454 AC_SUBST(gnomeicondir)
458 AC_SUBST(GNOMEGNORBA_LIBS)
459 AM_CONDITIONAL(GNOME, [test x"$mx" = xmx])
462 dnl Check for the -mandoc package
464 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
466 AC_MSG_CHECKING([for manual formatting macros])
467 AC_CACHE_VAL(ac_cv_mandoc, [
468 nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
477 AC_MSG_RESULT($MANDOC)
484 dnl Check if nroff accepts -Tlatin1 or -Tascii
487 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
488 AC_CACHE_VAL(ac_cv_nroff_tascii, [
489 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
492 ac_cv_nroff_tascii=" -Tlatin1"
494 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
497 ac_cv_nroff_tascii=" -Tascii"
499 ac_cv_nroff_tascii=""
503 if test "x$ac_cv_nroff_tascii" = x; then
506 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
509 TROFFASCII="$ac_cv_nroff_tascii"
513 dnl Check for - option to file
515 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
516 if $HAVE_FILECMD; then
517 AC_MSG_CHECKING([for - option to file command])
518 AC_CACHE_VAL(ac_cv_filestdin, [
519 cat > conftest.c <<EOF
527 cat > conftest.sed <<EOF
531 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
532 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
533 if test "$filehyphen_1" = "$filehyphen_2"; then
539 rm conftest.c conftest.sed
544 if test x$ac_cv_filestdin = xyes; then
545 AC_DEFINE(FILE_STDIN)
547 filestdin=$ac_cv_filestdin
548 AC_MSG_RESULT([$filestdin])
551 dnl Check for -L option to file
554 AC_MSG_CHECKING([for -L option to file command])
555 AC_CACHE_VAL(ac_cv_filel, [
556 file -L . > /dev/null 2>&1
564 if test x$ac_cv_filel = xyes; then
568 AC_MSG_RESULT([$filel])
572 dnl Check to see if grep program allowes dash to denote stdin
574 AC_MSG_CHECKING([for - option to grep command])
575 AC_CACHE_VAL(ac_cv_grep_stdin, [
576 grep ac_cv_grep_stdin - > /dev/null 2>&1 < ./configure
583 if test x$ac_cv_grep_stdin = xyes; then
584 AC_DEFINE(GREP_STDIN)
586 AC_MSG_RESULT([$ac_cv_grep_stdin])
589 dnl The subshell support
592 AC_MSG_CHECKING([for subshell support])
593 AC_ARG_WITH(subshell,
594 [--with-subshell If you want to use a concurrent shell],
596 if test x$withval = xoptional
598 AC_DEFINE(SUBSHELL_OPTIONAL)
599 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
602 if test x$withval = xyes
604 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
607 [dnl Default: provide the subshell support on non-ultrix machines
613 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
618 AC_MSG_RESULT([$result])
630 dnl Memory Allocation Debugger
634 [--with-mad Developers only: activates MAD (memory debugger)],
635 [if test x$withval = xyes; then
636 mem_debug="Janne's MAD library"
638 AC_MSG_RESULT([compiling with memory leak detector])
642 dnl Electric Fence - another memory debugger
645 [--with-efence Developers only: activates Electric Fence],
646 [if test x$withval = xyes; then
647 LIBS="$LIBS -lefence"
648 AC_MSG_RESULT([compiling with Electric fence])
649 mem_debug="Electric Fence"
654 if test x$USE_NLS = xyes; then
655 if test x$USE_INCLUDED_LIBINTL = xyes; then
656 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl"
657 LINTL="-L\$(top_builddir)/intl -lintl"
665 dnl To force mmap support
666 dnl We use only part of the functionality of mmap, so on AIX,
667 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
670 [--with-mmap To force using the mmap call (AIX)],
671 [if test x$withval = xyes; then
673 AC_MSG_RESULT([forcing MMAP support])
678 slang_use_system_installed_lib=false
679 AC_CHECK_LIB(slang,SLang_init_tty,
680 [AC_CHECK_HEADERS(slang.h)
681 if test x$ac_cv_header_slang_h = xyes
683 slang_use_system_installed_lib=true
684 slang_check_lib=false
686 AC_CHECK_HEADERS(slang/slang.h)
687 if test x$ac_cv_header_slang_slang_h = xyes
689 slang_use_system_installed_lib=true
690 slang_check_lib=false
691 AC_DEFINE(SLANG_H_INSIDE_SLANG_DIR)
696 AC_ARG_WITH(terminfo,
697 [--with-terminfo SLANG: Force usage of terminfo],[
698 if test x$withval = xyes; then
700 slang_check_lib=false
701 slang_use_system_installed_lib=false
706 [--with-termcap SLANG: Force usage of termcap],[
707 if test x$withval = xyes; then
709 slang_check_lib=false
710 slang_use_system_installed_lib=false
714 AC_ARG_WITH(included-slang,
715 [--with-included-slang SLANG: use the SLang library included here],[
716 if test x$withval = xyes; then
717 slang_use_system_installed_lib=false
726 [--with-slang Compile with the slang screen manager],[
727 if test x$withval = xyes; then
734 AC_SUBST(fastdepslang)
741 [--with-edit Define INTERNAL_EDIT],
742 [if test x$withval = xyes
748 [dnl Default: provide the internal editor
756 [--with-netrc Compile with ftp .netrc support],[
757 if test x$withval = xyes; then
759 AC_MSG_RESULT([ftpfs will have .netrc parsing code])
765 if test $use_vfs = yes; then
766 AC_ARG_WITH(ext2undel,
767 [--with-ext2undel Compile with ext2 undelete code],[
768 if test x$withval != xno;
770 if test x$withval != xyes
772 LIBS="$LIBS -L$withval/lib"
773 CPPFLAGS="$CPPFLAGS -I$withval/include"
778 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL],,-lcom_err)
786 AC_CHECKING([location of ncurses.h file])
788 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
789 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
790 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
791 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")
793 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")
795 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
798 dnl We couldn't find ncurses, try SysV curses
802 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
804 AC_EGREP_CPP(USE_NCURSES,[
811 CPPFLAGS="$CPPFLAGS -DRENAMED_NCURSES"
812 AC_DEFINE(USE_NCURSES)
814 screen_manager="ncurses installed as curses"
819 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
820 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
821 dnl should be replaced by a more fine grained selection routine
825 if test -f /usr/5include/curses.h
830 # check for ncurses version, to properly ifdef mouse-fix
831 AC_MSG_CHECKING([for ncurses version])
832 ncurses_version=unknown
833 cat > conftest.$ac_ext <<EOF
834 [#]line __oline__ "configure"
835 #include "confdefs.h"
836 #ifdef RENAMED_NCURSES
842 VERSION:NCURSES_VERSION
844 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
845 egrep "VERSION:" >conftest.out 2>&1; then
847 ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
851 AC_MSG_RESULT([$ncurses_version])
852 case "$ncurses_version" in
856 AC_DEFINE(NCURSES_970530,2)
859 AC_DEFINE(NCURSES_970530,1)
862 AC_DEFINE(NCURSES_970530,0)
868 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
869 dnl check for resizeterm and keyok.
873 AC_CHECK_FUNCS(resizeterm keyok)
876 if test "x$screen_manager" = "xunknown"; then
881 dnl The variables used for expanding the auto saver.
888 cons_saver="cons.saver"
892 dnl On Linux, check for PAM authentication available
894 AC_CHECK_LIB(pam, pam_start, [
904 dnl We need sed in order to fix the library files
906 SEDCMD="sed 's/-man/$MANDOC/'"
907 SEDCMD2="sed 's%@prefix@%\$(prefix)%'"
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"
948 ac_cv_make_with_percent_rules=no
949 if test x$ac_cv_prog_gnu_make = xyes; then
951 DOTDEPEND='-include .depend'
953 ac_cv_make_with_percent_rules=yes
957 WRITEDEP='sed "/^. \*\*\*Dependencies\*\*\*/,/^. \*\*\*End of dependencies\*\*\*/d" < Makefile > Makefile.conf; { cat Makefile.conf; echo "# ***Dependencies***Do not edit***"; cat .depend; echo "# ***End of dependencies***" } > Makefile; $(RMF) Makefile.conf .depend'
966 if test x$ac_cv_make_with_percent_rules = xyes; then
974 dnl Output configuration files
976 dnl It's a hack to accomodate both Autoconf 2.13 and the 2.49x series,
977 dnl It's needed until Autoconf 2.50 is released.
978 ifelse(AC_ACVERSION, [2.13],
980 if test "x$SAMBAFILES" != x; then
982 AC_CONFIG_SUBDIRS([$mc_subdirs])
984 [if test "x$SAMBAFILES" != x; then
985 AC_CONFIG_SUBDIRS([vfs/samba])
988 AM_CONDITIONAL(USE_SAMBA_FS, [test "x$SAMBAFILES" != x])
997 doc-gnome/C/figs/Makefile
998 vfs/Makefile:vfs/Make-mc.in
1028 doc/mc.1 doc/mcedit.1 doc/mcserv.8
1030 intl/Makefile po/Makefile.in
1031 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
1033 if echo "$screen_manager" | grep -q "SLang" ; then
1034 screen_manager="${screen_manager}${slang_term}"
1040 Source code location: ${srcdir}
1042 Compiler flags: ${CFLAGS}
1043 File system: ${vfs_type}
1045 Text mode screen manager: ${screen_manager}
1046 Install console saver: ${install_saver}
1047 Text mode mouse library: ${mouse_lib}
1048 Text mode X11 support: ${textmode_x11_support}
1049 Debugger code: ${mem_debug}
1050 With subshell support: ${subshell}
1051 X11 versions: ${xvers}
1052 Internal editor: ${EDIT_msg}
1053 Install path: ${prefix}/bin, ${prefix}/lib/mc