* editcmd.c (edit_block_process_cmd): Use execute(), not
[midnight-commander.git] / configure.in
blob241d53f7e97e6f4ab55826c74dc7a77ccba3ba0a
1 dnl
2 dnl Configure.in file for the Midnight Commander
3 dnl
4 AC_INIT(src/main.c)
5 AC_PREREQ(2.13)
6 AC_CANONICAL_HOST
8 AM_INIT_AUTOMAKE(mc, 4.5.54a)
9 AM_CONFIG_HEADER(config.h)
10 AM_MAINTAINER_MODE
12 AC_PROG_CC
13 AC_PROG_CPP
14 AC_PROG_RANLIB
15 AC_PROG_LN_S
16 AC_PROG_AWK
18 AC_AIX
19 AC_MINIX
20 AC_ISC_POSIX
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])
24 AC_HEADER_MAJOR
25 AC_C_CONST
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
31    AC_SYS_LARGEFILE
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
39     X11_WWW=lynx
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"
44 dnl
45 dnl Internationalization
46 dnl
47 AM_GNU_GETTEXT
48 INTLDEPS=
49 LINTL=
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'
55 AC_SUBST(LINTL)
56 AC_SUBST(INTLDEPS)
58 dnl
59 dnl Hack to make extraconf.h visible even if compiling outside srcdir.
60 dnl
61 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
63 dnl
64 dnl Enforce coding standards
65 dnl
66 if test "x$GCC" = xyes; then
67     CFLAGS="$CFLAGS -Wall"
70 dnl
71 dnl We now use glib
72 dnl 
73 AM_PATH_GLIB(1.2.0,,[AC_MSG_ERROR([Test for GLIB failed.  MC requires GLIB.])])
74 LIBS="$LIBS $GLIB_LIBS"
76 dnl
77 dnl OS specific flags.
78 dnl
80 posix_libs=""
81 case $host_os in
82 aux*)
83     # A/UX
84     posix_libs="-lposix"
85     AC_DEFINE(_POSIX_SOURCE)
86     ;;
87 sco*)
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])
90     ;;
91 esac
93 AC_PROG_INSTALL
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])
98 AC_HEADER_TIME
99 AC_HEADER_SYS_WAIT
100 AC_HEADER_DIRENT
101 AC_SHORT_D_NAME_LEN
102 AC_HEADER_STDC
104 dnl Missing structure components
105 AC_STRUCT_ST_BLKSIZE
106 AC_STRUCT_ST_BLOCKS
107 AC_STRUCT_ST_RDEV
110 dnl Check availability of some functions 
111 dnl 
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 \
118                 telldir seekdir])
121 dnl getpt is a GNU Extension (glibc 2.1.x)
123 AC_CHECK_FUNCS(getpt)
125 SHADOWLIB=
126 case $host_os in
127 linux*)
128     AC_CHECK_LIB(shadow,pw_encrypt,
129         [shadow_header=yes
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)
135             SHADOWLIB=-lshadow
136         fi])
137     ;;
138 esac
139 AC_SUBST(SHADOWLIB)
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");
144 if (p)
145 return 0;],[
146 NEED_CRYPT_PROTOTYPE=no])
147 else 
148     if test x$ac_cv_header_unistd_h = xyes; then
149 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");
150 if (p)
151 return 0;],[
152 NEED_CRYPT_PROTOTYPE=no])
153     fi
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
168 LCRYPT=""
169 AC_CHECK_FUNCS(crypt, , [
170     AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
171         AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
172 AC_SUBST(LCRYPT)
174 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
176 dnl replacing lstat with statlstat on sco makes it more portable between
177 dnl sco clones
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])
184 AC_EGREP_CPP(yes,
185 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
187 #endif
188 ], [
189 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
190 AC_MSG_RESULT(yes)
191 ], [AC_MSG_RESULT(no)])
193 dnl   
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
202 AC_GET_FS_INFO
205 dnl Missing typedefs and replacements
206 dnl 
208 AC_TYPE_MODE_T
209 AC_CHECK_TYPE(umode_t, int)
210 AC_CHECK_TYPE(off_t, long)
211 AC_TYPE_PID_T
212 AC_TYPE_UID_T
213 AC_CHECK_TYPE(nlink_t, unsigned int)
215 AC_FUNC_MMAP
216 AC_FUNC_ALLOCA
218 AC_PATH_XTRA
221 dnl X11 support in the textmode edition. 
224 dnl These variables are only used when building the text edition MC binary
225 MCCFLAGS=""
226 MCLIBS=""
227 AC_SUBST(MCCFLAGS)
228 AC_SUBST(MCLIBS)
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
234                 MCCFLAGS="$X_CFLAGS"
235                 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
236                 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT)
237                 textmode_x11_support="yes"
238         fi
242 dnl Network related functions
245 AC_CHECK_LIB(nsl, t_accept)
246 AC_CHECK_LIB(socket, socket)
248 have_socket=no
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, [
254         LIBS="$LIBS -l$lib"
255         have_socket=yes
256         AC_DEFINE(HAVE_SOCKET)
257         break])
258   done
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])
267   done
270 AC_CHECK_FUNCS(socketpair)
273 dnl Sequent wants getprocessstats
275 AC_CHECK_LIB(seq, get_process_stats, [
276         LIBS="$LIBS -lseq"
277         AC_DEFINE(HAVE_GET_PROCESS_STATS)])
279 GNOME_VFS_CHECKS
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])
290 NETFILES=
291 if test $have_socket = yes; then
292    NETFILES="\$(NETFILES)"
294 AC_SUBST(NETFILES)
296 LIBVFS=""
297 LVFS=""
298 vfs_type="normal"
299 if test $use_vfs = yes
300 then
301         LIBVFS="libvfs-mc.a"
302         LVFS="-lvfs-mc"
303         MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
304         AC_MSG_RESULT([Using the VFS switch code])
305         vfs_type="Midnight Commander Virtual File System"
307 AC_SUBST(LIBVFS)
308 AC_SUBST(LVFS)
310 screen_manager=unknown
311 search_ncurses=false
313 XCURSES=""
314 AC_SUBST(XCURSES)
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"
320 dnl     case $host_os in
321 dnl     ultrix*)
322 dnl         THIS_CURSES=cursesX
323 dnl         ;;
324 dnl     *)
325 dnl         THIS_CURSES=curses
326 dnl         ;;
327 dnl     esac
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])
336 dnl])
338 AC_ARG_WITH(sunos-curses,
339         [--with-sunos-curses        Used to force SunOS 4.x curses],[
340         if test x$withval = xyes; then
341                 AC_USE_SUNOS_CURSES
342         fi
345 AC_ARG_WITH(osf1-curses,
346         [--with-osf1-curses        Used to force OSF/1 curses],[
347         if test x$withval = xyes; then
348                 AC_USE_OSF1_CURSES
349         fi
352 AC_ARG_WITH(vcurses,
353         [--with-vcurses[=incdir]    Used to force SysV curses],
354         [if test x$withval = xyes; then :
355         else
356                 CPPFLAGS="$CPPFLAGS -I$withval"
357         fi
358         AC_USE_SYSV_CURSES
361 mouse_lib="xterm only"
362 LGPM=""
363 case $host_os in
364 linux*)
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
368         then
369                 if test x$withval != xyes
370                 then
371                         LIBS="$LIBS -L$withval/lib"
372                         CPPFLAGS="$CPPFLAGS -I$withval/include"
373                 fi
374                 AC_DEFINE(HAVE_LIBGPM)
375                 mouse_lib="GPM and xterm"
376                 LGPM="-lgpm"
377         fi],
378         [AC_CHECK_LIB(gpm, Gpm_Repeat,
379                 [AC_DEFINE(HAVE_LIBGPM)
380                 mouse_lib="GPM and xterm"
381                 LGPM="-lgpm"],
382                 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
383                 $LIBS)
384         ])
385     ;;
386 esac
387 AC_SUBST(LGPM)
389 AC_ARG_WITH(ncurses,
390         [--with-ncurses[=base-dir]    Compile with ncurses/locate base dir],
391         [if test x$withval = xyes
392         then
393                 search_ncurses=true
394         else
395                 LIBS="$LIBS -L$withval/lib -lncurses"
396                 CPPFLAGS="$CPPFLAGS -I$withval/include"
397                 search_ncurses=false
398                 screen_manager="ncurses"
399                 AC_DEFINE(USE_NCURSES)
400         fi
403 AC_ARG_WITH(hsc,
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])
408         fi
412 dnl Check for Gnome
414 mx=""
415 libgtkedit=""
416 xvers="none"
418 GNOME_INIT_HOOK([
419         mx=mx
420         libgtkedit="libgtkedit.a"
421         if test x"$xvers" = xnone; then
422             xvers="Gnome"
423         else
424             xvers="Gnome+$xvers"
425         fi
426         gnomeicondir=`gnome-config --datadir`/pixmaps
428 dnl Check for new enough gnome-libs
429         CFLAGS_save=$CFLAGS
430         LIBS_save=$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)])
437         CFLAGS=$CFLAGS_save
438         LIBS=$LIBS_save
440 AC_SUBST(gnomeicondir)
441 AC_SUBST(mx)
442 AC_SUBST(libgtkedit)
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)
450 if $HAVE_nroff; then
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
454     if test $? = 0
455     then
456         ac_cv_mandoc=-mandoc
457     else
458         ac_cv_mandoc=-man
459     fi
460     ])
461     MANDOC=$ac_cv_mandoc
462     AC_MSG_RESULT($MANDOC)
463 else
464     MANDOC=-man
466 AC_SUBST(MANDOC)
469 dnl Check if nroff accepts -Tlatin1 or -Tascii
471 if $HAVE_nroff; then
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
475     if test $? = 0
476     then
477         ac_cv_nroff_tascii=" -Tlatin1"
478     else
479         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
480         if test $? = 0
481         then
482             ac_cv_nroff_tascii=" -Tascii"
483         else
484             ac_cv_nroff_tascii=""
485         fi
486     fi
487     ])
488     if test "x$ac_cv_nroff_tascii" = x; then
489         AC_MSG_RESULT(no)
490     else
491         AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
492     fi
494 TROFFASCII="$ac_cv_nroff_tascii"
495 AC_SUBST(TROFFASCII)
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
505 /* A comment */
506 #if 0
507 #endif
508 void main(void)
509 { return; }
511     cat > conftest.sed <<\EOF
512 s/^[^:]*:[      ]*//
513 s/[     ]*$//
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
518         ac_cv_filestdin=yes
519     else
520         ac_cv_filestdin=no
521     fi
522     rm conftest.c conftest.sed
523     ]])
525     if test x$ac_cv_filestdin = xyes; then
526         AC_DEFINE(FILE_STDIN, 1,
527                   [Define if the file command accepts - for stdin])
528     fi
529     filestdin=$ac_cv_filestdin
530     AC_MSG_RESULT([$filestdin])
532     dnl
533     dnl Check for -L option to file
534     dnl
536 AC_MSG_CHECKING([for -L option to file command])
537 AC_CACHE_VAL(ac_cv_filel, [
538 file -L . > /dev/null 2>&1
539 if test $? = 0
540 then
541     ac_cv_filel=yes
542 else
543     ac_cv_filel=no
546 if test x$ac_cv_filel = xyes; then
547     AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
549 filel=$ac_cv_filel
550 AC_MSG_RESULT([$filel])
551 fi 
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
559     if test $? = 0; then
560         ac_cv_grep_stdin=yes
561     else
562         ac_cv_grep_stdin=no
563     fi
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],
577         [result=no
578         if test x$withval = xoptional
579         then
580                 AC_DEFINE(SUBSHELL_OPTIONAL)
581                 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
582                 result="optional"
583         fi
584         if test x$withval = xyes
585         then 
586                 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
587                 result="yes"
588         fi],
589         [dnl Default: provide the subshell support on non-ultrix machines
590         case $host_os in
591         ultrix*)
592                 result=no
593                 ;;
594         *)
595                 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
596                 result=yes
597                 ;;
598         esac
600 AC_MSG_RESULT([$result])
601 subshell="$result"
604 dnl Memory Allocation Debugger
606 mem_debug="none"
607 AC_ARG_WITH(mad,
608 [--with-mad                 Developers only: activates MAD (memory debugger)],
609         [if test x$withval = xyes; then
610         mem_debug="Janne's MAD library"
611         AC_DEFINE(HAVE_MAD)
612         AC_MSG_RESULT([compiling with memory leak detector])
613 fi])
616 dnl Electric Fence - another memory debugger
618 AC_ARG_WITH(efence, 
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"
624 fi])
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.
631 AC_ARG_WITH(mmap, 
632         [--with-mmap                To force using the mmap call (AIX)],
633         [if test x$withval = xyes; then
634         AC_DEFINE(HAVE_MMAP)
635         AC_MSG_RESULT([forcing MMAP support])
636 fi])
638 slang_check_lib=true
639 slang_term=""
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
644         then
645              slang_use_system_installed_lib=true
646              slang_check_lib=false
647         else
648              AC_CHECK_HEADERS(slang/slang.h)
649              if test x$ac_cv_header_slang_slang_h = xyes
650              then
651                  slang_use_system_installed_lib=true
652                  slang_check_lib=false
653              fi
654         fi
657 AC_ARG_WITH(terminfo,
658         [--with-terminfo            SLANG: Force usage of terminfo],[
659         if test x$withval = xyes; then
660                 AC_USE_TERMINFO
661                 slang_check_lib=false
662                 slang_use_system_installed_lib=false
663         fi]
666 AC_ARG_WITH(termcap,
667         [--with-termcap             SLANG: Force usage of termcap],[
668         if test x$withval = xyes; then
669                 AC_USE_TERMCAP
670                 slang_check_lib=false
671                 slang_use_system_installed_lib=false
672         fi]
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
679             slang_check_lib=true
680         fi]
683 LIBSLANG=""
684 LSLANG=""
685 AC_ARG_WITH(slang,
686         [--with-slang              Compile with the slang screen manager],[
687         if test x$withval = xyes; then
688                 AC_WITH_SLANG
689         fi
692 AC_SUBST(LIBSLANG)
693 AC_SUBST(LSLANG)
695 LIBEDIT_A=""
696 MCEDIT=""
697 LEDIT=""
698 EDIT_msg=""
699 AC_ARG_WITH(edit,
700         [--with-edit                Define INTERNAL_EDIT],
701         [if test x$withval = xyes
702         then
703                 AC_WITH_EDIT
704         else
705                 EDIT_msg="no"
706         fi], 
707         [dnl Default: provide the internal editor
708         AC_WITH_EDIT
710 AC_SUBST(LIBEDIT_A)
711 AC_SUBST(MCEDIT)
712 AC_SUBST(LEDIT)
714 AC_ARG_WITH(netrc,
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])
720         fi
723 undelfs_o=""
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;
729         then
730                 if test x$withval != xyes
731                 then
732                         LIBS="$LIBS -L$withval/lib"
733                         CPPFLAGS="$CPPFLAGS -I$withval/include"
734                 fi
735                 AC_EXT2_UNDEL
736         fi],[
737         dnl Default: detect
738         AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL],,-lcom_err)
739     ])
742 AC_SUBST(undelfs_o)
743         
744 if $search_ncurses
745 then
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")
757     dnl
758     dnl We couldn't find ncurses, try SysV curses
759     dnl
760     if $search_ncurses 
761     then
762         AC_EGREP_HEADER(init_color, /usr/include/curses.h,
763             AC_USE_SYSV_CURSES)
764         AC_EGREP_CPP(USE_NCURSES,[
765 #include <curses.h>
766 #ifdef __NCURSES_H
767 #undef USE_NCURSES
768 USE_NCURSES
769 #endif
771         CPPFLAGS="$CPPFLAGS -DRENAMED_NCURSES"
772         AC_DEFINE(USE_NCURSES)
773         search_ncurses=false
774         screen_manager="ncurses installed as curses"
776     fi
778     dnl
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
782     dnl
783     if $search_ncurses
784     then
785         if test -f /usr/5include/curses.h
786         then
787             AC_USE_SUNOS_CURSES
788         fi
789     else
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
797 #include <curses.h>
798 #else
799 #include <ncurses.h>
800 #endif
801 #undef VERSION
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/".*//'`
807         fi
808         rm -rf conftext*
809         AC_MSG_RESULT([$ncurses_version])
810         case "$ncurses_version" in
811         4.[[01]])
812             AC_DEFINE(NCURSES_970530,2)
813             ;;
814         1.9.9g)
815             AC_DEFINE(NCURSES_970530,1)
816             ;;
817         1*)
818             AC_DEFINE(NCURSES_970530,0)
819             ;;
820         esac
821     fi
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([], [
832                         extern int ESCDELAY;
833                         int main ()
834                         {
835                           ESCDELAY = 0;
836                         }
837                         ],
838                         [mc_cv_ncurses_escdelay=yes],
839                         [mc_cv_ncurses_escdelay=no]
840                   )
841   ])
842   if test "$mc_cv_ncurses_escdelay" = yes; then
843     AC_DEFINE(HAVE_ESCDELAY, 1,
844               [Define if ncurses has ESCDELAY variable])
845   fi
849 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
850 dnl check for resizeterm and keyok.
852 SAVED_LIBS="$LIBS"
853 LIBS="$LIBS $LGPM"
854 AC_CHECK_FUNCS(resizeterm keyok)
855 LIBS="$SAVED_LIBS"
857 if test "x$screen_manager" = "xunknown"; then
858     AC_WITH_SLANG
862 dnl The variables used for expanding the auto saver.
864 cons_saver=""
865 install_saver="no"
866 PAMLIBS=""
867 case $host_os in
868 linux*)
869     cons_saver="cons.saver"
870     install_saver="yes"
872     dnl
873     dnl On Linux, check for PAM authentication available
874     dnl
875     AC_CHECK_LIB(pam, pam_start, [
876         AC_DEFINE(HAVE_PAM)
877         PAMLIBS="-lpam -ldl"
878     ],[],[-ldl])
879     ;;
880 esac
881 AC_SUBST(cons_saver)
882 AC_SUBST(PAMLIBS)
885 dnl User visible support for charset conversion.
887 AC_ARG_ENABLE([charset],
888               [--enable-charset           Support for charset selection and conversion])
889 have_charset=
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])
893   else
894     AC_DEFINE(HAVE_CHARSET, 1,
895               [Define to enable charset selection and conversion])
896     have_charset=yes
897   fi
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
911 SLang*)
912         case $host_os in
913         linux*)
914                 ;;
915         *)
916                 AC_CHECK_LIB(curses,setupterm,
917                         [AC_TRY_COMPILE([
918 #include <curses.h>
919 #include <term.h>],[
920    if (key_end == parm_insert_line)
921         return 1;
922    return 0;
924                         [LIBS="$LIBS -lcurses"
925                         AC_DEFINE(USE_SETUPTERM)])
926                 ])
927         esac
928         ;;
929 esac
931 LIBS="$LIBS $posix_libs"
933 AC_SUBST(CFLAGS)
934 AC_SUBST(CPPFLAGS)
935 AC_SUBST(MCCPPFLAGS)
936 AC_SUBST(LDFLAGS)
937 AC_SUBST(LIBS)
939 MCF=./Make.common
940 AC_SUBST_FILE(MCF)
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],
948 [mc_subdirs=
949 if test "x$SAMBAFILES" != x; then
950   mc_subdirs=vfs/samba
951   AC_CONFIG_SUBDIRS([$mc_subdirs])
952 fi],
953 [if test "x$SAMBAFILES" != x; then
954   AC_CONFIG_SUBDIRS([vfs/samba])
955 fi])
957 AM_CONDITIONAL(USE_SAMBA_FS, [test "x$SAMBAFILES" != x])
959 AC_OUTPUT([
960 Make.common 
961 Makefile 
962 mc.spec
963 doc/Makefile 
964 doc-gnome/Makefile
965 doc-gnome/C/Makefile
966 doc-gnome/C/figs/Makefile
967 vfs/Makefile:vfs/Make-mc.in
968 vfs/extfs/Makefile
969 lib/Makefile
970 gnome/Makefile 
971 gnome/mc.keys.in
972 idl/Makefile
973 src/Makefile
974 slang/Makefile 
975 edit/Makefile 
976 gtkedit/Makefile 
977 syntax/Makefile
978 new_icons/Makefile 
979 pc/Makefile
981 lib/mc.ext
982 lib/mc.sh
983 lib/mc.csh
985 mcfn_install
987 vfs/extfs/deb
988 vfs/extfs/ftplist
989 vfs/extfs/lslR
990 vfs/extfs/uar
991 vfs/extfs/ucpio
992 vfs/extfs/ulha 
993 vfs/extfs/uha
994 vfs/extfs/urar
995 vfs/extfs/uzoo
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}"
1006 echo "
1007 Configuration:
1009   Source code location:       ${srcdir}
1010   Compiler:                   ${CC}
1011   Compiler flags:             ${CFLAGS}
1012   File system:                ${vfs_type}
1013                               ${vfs_flags}
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