Somebody corrupted es.po and no.po (did not finish merge)
[midnight-commander.git] / configure.in
blob65e770b3abe2ba54eee1aea601642299c3bbe621
1 dnl
2 dnl Configure.in file for the Midnight Commander
3 dnl
4 AC_INIT(create_vcs)
5 AC_CONFIG_HEADER(config.h)
7 PACKAGE=mc
8 VERSION=4.5.9
9 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
10 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
11 AC_SUBST(VERSION)
12 AC_SUBST(PACKAGE)
14 dnl This is path where we're looking for headers in addition to /usr/include
15 dnl and whatever cpp defaults to.
16 include_additional_path="/usr/local/include /usr/contrib/include /opt/gnu/include"
18 dnl This sets/resets compiling with -g by default. It should be set to yes for
19 dnl development versions and set to no for release versions.
20 use_cc_g_flag=yes
22 dnl We want autoconf to check whether -g is available
23 dnl We reset it back soon.
24 CCOPTS="$CFLAGS"
25 unset CFLAGS
27 dnl Find out, if we should default to /usr/local or /usr
28 AC_PREFIX_PROGRAM(mc)
30 AC_PROG_MAKE_SET
31 AC_PROG_CC
32 AC_PROG_CPP
33 AC_PROG_RANLIB
34 AC_PROG_LN_S
35 AC_PROG_AWK
36 if test x"$AWK" = x; then
37     AWK=":"
38     AWK_VAR_OPTION=""
39     dep=slowdep
40 else
41     dep=fastdep
43     # test whether awk needs -v for variables (e.g. Solaris) or not (e.g. SunOs 4)
44     if test x"`echo | $AWK 'BEGIN { print variable; exit }' variable=123`" = x123; then
45         AWK_VAR_OPTION=""
46     else
47         AWK_VAR_OPTION="-v"
48     fi
50 AC_SUBST(AWK_VAR_OPTION)
51 AC_SUBST(dep)
52 AC_PROG_GNU_MAKE
54 AC_AIX
55 AC_MINIX
56 AC_ISC_POSIX
57 MC_HPUX_PROG_CC_STDC
58 AC_HEADER_MAJOR
59 AC_C_CONST
60 AC_PATH_PROG(MV, mv, mv)
61 AC_PATH_PROG(CP, cp, cp)
62 AC_PATH_PROG(RM, rm, rm)
63 AC_PATH_PROG(CHMOD, chmod, :)
64 AC_PATH_PROG(AR, ar, ar)
66 AC_CHECK_PROG(system,uname,`uname`,unknown)
67 AC_CHECK_PROGS(X11_WWW,netscape arena Mosaic chimera)
68 if test x"$X11_WWW" = x; then
69     X11_WWW=lynx
72 ALL_LINGUAS="es fr ru ko it de pl no"
73 AM_GNU_GETTEXT
74 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
76 dnl
77 dnl This part supplies reasonable defaults for CFLAGS, if they weren't
78 dnl specified by ''CFLAGS=flags ./configure''
79 dnl
80 cc_uses_g=yes
81 if test x$GCC = xyes; then
82     if test x$ac_cv_prog_gcc_g = xyes; then
83         :
84     else
85         cc_uses_g=no
86     fi
89 dnl Debug mode is turned ON for now
90 if test "x$CCOPTS" = x; then
91     CCOPTS='-g'
94 if test "x$CCOPTS" = x; then
95     if test x$GCC = xyes; then
96         if test x$system = xLinux; then
97             CCOPTS='-O2 -fno-strength-reduce'
98             if test x$use_cc_g_flag = xyes; then
99                 if test $cc_uses_g = yes; then
100                     CCOPTS='-g -O'
101                 fi
102             fi
103         else
104             CCOPTS='-O'
105             if test x$use_cc_g_flag = xyes; then
106                 if test $cc_uses_g = yes; then
107                     CCOPTS='-g -O'
108                 fi
109             fi
110         fi
111     else
112         if test x$use_cc_g_flag = xyes; then
113             CCOPTS="$CFLAGS"
114         else
115             CCOPTS=
116         fi
117     fi
119 CFLAGS="$CCOPTS"
123 dnl We now use glib
124 dnl 
125 AM_PATH_GLIB
126 LIBS="$LIBS $GLIB_LIBS"
127 CFLAGS="$CFLAGS $GLIB_CFLAGS"
130 dnl For A/UX.  Do not move
133 posix_libs=""
134 if test $system = A/UX
135 then
136     posix_libs="-lposix"
137     AC_DEFINE(_POSIX_SOURCE)
140 AC_PROG_INSTALL
141 AC_CHECK_HEADERS(unistd.h string.h memory.h crypt.h grp.h limits.h malloc.h)
142 AC_CHECK_HEADERS(stdlib.h termios.h)
144 if test x$ac_cv_header_malloc_h = xno; then
145     echo '/* NeXTStep malloc.h stub */' > $srcdir/malloc.h
148 AC_HEADER_SYS_WAIT
149 AC_HEADER_DIRENT
150 AC_SHORT_D_NAME_LEN
151 AC_HEADER_STDC
154 #Let me check for an incompatible regcomp in HP-UX before making this
155 #the default
157 REGEX_O="regex.o"
158 AC_SUBST(REGEX_O)
160 dnl Missing structure components
161 AC_STRUCT_ST_BLKSIZE
162 AC_STRUCT_ST_BLOCKS
163 AC_STRUCT_ST_RDEV
166 dnl Check availability of some functions 
167 dnl 
169 AC_CHECK_FUNCS(strerror statfs getwd strcasecmp strncasecmp)
170 AC_CHECK_FUNCS(strdup memmove pwdauth truncate initgroups putenv)
171 AC_CHECK_FUNCS(memset memcpy tcsetattr tcgetattr cfgetospeed)
172 AC_CHECK_FUNCS(sigaction sigemptyset sigprocmask sigaddset)
173 AC_CHECK_FUNCS(sysconf setuid setreuid)
175 SHADOWLIB=
176 if test x$system = xLinux; then
177 AC_CHECK_LIB(shadow,pw_encrypt,[
178 shadow_header=no
179 AC_CHECK_HEADERS(shadow.h)
180 if test x$ac_cv_header_shadow_h = xyes; then
181     shadow_header=yes
182 else
183 AC_CHECK_HEADERS(shadow/shadow.h)
184     if test x$ac_cv_shadow_shadow_h = xyes; then
185         shadow_header=yes
186     fi
188 if test $shadow_header = yes; then
189     AC_DEFINE(LINUX_SHADOW)
190     SHADOWLIB=-lshadow
194 AC_SUBST(SHADOWLIB)
196 NEED_CRYPT_PROTOTYPE=yes
197 if test x$ac_cv_header_crypt_h = xyes; then
198 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");],[
199 NEED_CRYPT_PROTOTYPE=no])
200 else 
201     if test x$ac_cv_header_unistd_h = xyes; then
202 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");],[
203 NEED_CRYPT_PROTOTYPE=no])
204     fi
206 if test x$NEED_CRYPT_PROTOTYPE=xyes; then
207 AC_DEFINE(NEED_CRYPT_PROTOTYPE)
211 dnl AIX and Sequent need <sys/select.h> for fd_set
213 AC_CHECK_HEADERS(sys/select.h)
216 dnl On SCO and some SVR4, crypt is on libcrypt.a
217 dnl         grantpt in  libpt.a
219 LCRYPT=""
220 AC_CHECK_FUNCS(crypt, , [
221     AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
222         AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
223 AC_SUBST(LCRYPT)
225 dnl This is the correct version
226 dnl AC_CHECK_FUNCS(grantpt, , AC_CHECK_LIB(pt, grantpt))
228 dnl And workaround for a Autoconf 2.4 bug:
229 AC_CHECK_FUNCS(grantpt)
230 if test x$ac_cv_func_grantpt = xyes; then
231     :
232 else
233     AC_CHECK_LIB(pt, grantpt)
237 dnl libintl.a required on SCO to provide proper NLS support
238 dnl (using native cc links it by default)
240 if test x$GCC = xyes; then
241     AC_CHECK_LIB(intl, tolower)
244 dnl replacing lstat with statlstat on sco makes it more portable between
245 dnl sco clones
246 AC_CHECK_FUNCS(statlstat)
249 dnl If running under AIX, AC_AIX does not tell us that
251 AC_MSG_CHECKING(for AIX defines)
252 AC_EGREP_CPP(yes,
253 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
255 #endif
256 ], [
257 AC_DEFINE(IS_AIX)
258 AC_MSG_RESULT(yes)
259 ], AC_MSG_RESULT(no))
261 dnl   
262 dnl This hack is here until autoconf adds it
263 dnl Needed for Unixware: getmntent is on libgen.a
265 AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
268 dnl This is from GNU fileutils, check aclocal.m4 for more information
270 AC_GET_FS_INFO
273 dnl Missing typedefs and replacements
274 dnl 
276 AC_TYPE_MODE_T
277 AC_CHECK_TYPE(umode_t, int)
278 AC_CHECK_TYPE(off_t, long)
279 AC_TYPE_PID_T
280 AC_TYPE_UID_T
281 AC_CHECK_TYPE(nlink_t, unsigned int)
283 AC_FUNC_MMAP
284 AC_FUNC_ALLOCA
287 dnl Cool hack, but we don't use it currently 
289 dnl AC_MSG_CHECKING(for token pasting method)
290 dnl AC_EGREP_CPP(portable,[
291 dnl #define tken(a, b) a##b
292 dnl tken(port, able)
293 dnl ], [AC_DEFINE(HAVE_PORTABLE_TOKEN_PASTING)
294 dnl AC_MSG_RESULT(portable)
295 dnl ], [
296 dnl AC_MSG_RESULT(non-portable)
297 dnl ])
299 AC_PATH_XTRA
302 dnl Network related functions
305 AC_CHECK_LIB(nsl, t_accept)
306 AC_CHECK_LIB(socket, socket)
308 have_socket=no
309 AC_CHECK_FUNCS(socket, have_socket=yes)
310 if test $have_socket = no; then
311   # socket is not in the default libraries.  See if it's in some other.
312   for lib in bsd socket inet; do
313     AC_CHECK_LIB($lib, socket, [
314         LIBS="$LIBS -l$lib"
315         have_socket=yes
316         AC_DEFINE(HAVE_SOCKET)
317         break])
318   done
321 have_gethostbyname=no
322 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
323 if test $have_gethostbyname = no; then
324   # gethostbyname is not in the default libraries.  See if it's in some other.
325   for lib in bsd socket inet; do
326     AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
327   done
330 AC_CHECK_FUNCS(socketpair)
333 dnl Sequent wants getprocessstats
335 AC_CHECK_LIB(seq, get_process_stats, [
336         LIBS="$LIBS -lseq"
337         AC_DEFINE(HAVE_GET_PROCESS_STATS)])
339 GNOME_VFS_CHECKS
340 NETFILES=
341 if test $have_socket = yes; then
342    NETFILES="\$(NETFILES)"
344 AC_SUBST(NETFILES)
346 screen_manager=unknown
347 search_ncurses=false
349 CFLAGS=${CFLAGS--O}
350 LDFLAGS=${LDFLAGS--O}
352 AC_DEFUN(AC_USE_SUNOS_CURSES, [
353         search_ncurses=false
354         screen_manager="SunOS 4.x /usr/5include curses"
355         AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
356         AC_DEFINE(USE_SUNOS_CURSES)
357         AC_DEFINE(NO_COLOR_CURSES)
358         AC_DEFINE(USE_SYSV_CURSES)
359         CPPFLAGS="$CPPFLAGS -I/usr/5include"
360         XCURSES="xcurses.o /usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
361         AC_MSG_RESULT(Please note that some screen refreshs may fail)
362         AC_WARN(Reconsider using Slang)
365 AC_DEFUN(AC_USE_OSF1_CURSES, [
366        AC_MSG_RESULT(Using OSF1 curses)
367        search_ncurses=false
368        screen_manager="OSF1 curses"
369        AC_DEFINE(NO_COLOR_CURSES)
370        AC_DEFINE(USE_SYSV_CURSES)
371        XCURSES="xcurses.o"
372        LIBS="$LIBS -lcurses"
375 AC_DEFUN(AC_USE_SYSV_CURSES, [
376         AC_MSG_RESULT(Using SysV curses)
377         AC_DEFINE(USE_SYSV_CURSES)
378         XCURSES=""
379         search_ncurses=false
380         screen_manager="SysV/curses"
381         LIBS="$LIBS -lcurses"
384 XCURSES=""
385 AC_SUBST(XCURSES)
387 dnl AC_ARG_WITH(bsd-curses,
388 dnl [--with-bsd-curses         Used to compile with bsd curses, not very fancy],
389 dnl     search_ncurses=false
390 dnl     screen_manager="Ultrix/cursesX"
391 dnl     if test $system = ULTRIX
392 dnl     then
393 dnl         THIS_CURSES=cursesX
394 dnl        else
395 dnl         THIS_CURSES=curses
396 dnl     fi
398 dnl     LIBS="$LIBS -l$THIS_CURSES -ltermcap"
399 dnl     AC_DEFINE(USE_BSD_CURSES)
400 dnl     XCURSES="xcurses.o"
401 dnl     AC_MSG_RESULT(Please note that some screen refreshs may fail)
402 dnl     AC_WARN(Use of the bsdcurses extension has some)
403 dnl     AC_WARN(display/input problems.)
404 dnl     AC_WARN(Reconsider using xcurses)
405 dnl)
407 AC_ARG_WITH(sco,
408         [--with-sco                 Use this to turn on SCO-specific code],[
409         if test x$withval = xyes; then
410                 AC_DEFINE(SCO_FLAVOR)
411                 CFLAGS="$CFLAGS -D_SVID3"
412         fi
415 AC_ARG_WITH(sunos-curses,
416         [--with-sunos-curses        Used to force SunOS 4.x curses],[
417         if test x$withval = xyes; then
418                 AC_USE_SUNOS_CURSES
419         fi
422 AC_ARG_WITH(osf1-curses,
423         [--with-osf1-curses        Used to force OSF/1 curses],[
424         if test x$withval = xyes; then
425                 AC_USE_OSF1_CURSES
426         fi
429 AC_ARG_WITH(vcurses,
430         [--with-vcurses[=incdir]    Used to force SysV curses],
431         if test x$withval = xyes; then
432                 CPPFLAGS="$CPPFLAGS"
433         else
434                 CPPFLAGS="$CPPFLAGS -I$withval"
435         fi
436         AC_USE_SYSV_CURSES
439 mouse_lib="xterm only"
440 LGPM=""
441 AC_ARG_WITH(gpm-mouse, 
442         [--with-gpm-mouse[=base-dir]  Compile with gpm mouse support],[
443         if test x$withval != xno
444         then
445                 if test x$withval != xyes
446                 then
447                         LIBS="$LIBS -L$withval/lib"
448                         CPPFLAGS="$CPPFLAGS -I$withval/include"
449                 fi
450                 AC_DEFINE(HAVE_LIBGPM)
451                 mouse_lib="GPM and xterm"
452                 LGPM="-lgpm"
453         fi
454         ],[
455         AC_CHECK_LIB(gpm, Gpm_Repeat,[
456                 AC_DEFINE(HAVE_LIBGPM)
457                 mouse_lib="GPM and xterm"
458                 LGPM="-lgpm"],[
459                 if test $system = Linux
460                 then 
461                         AC_MSG_WARN("libgpm.a is missing or older than 0.18")
462                 fi
463                 ], $LIBS)
464         ]
466 AC_SUBST(LGPM)
468 AC_ARG_WITH(ncurses,
469         [--with-ncurses[=base-dir]    Compile with ncurses/locate base dir],
470         if test x$withval = xyes
471         then
472                 search_ncurses=true
473         else
474                 LIBS="$LIBS -L$withval/lib -lncurses"
475                 CPPFLAGS="$CPPFLAGS -I$withval/include"
476                 search_ncurses=false
477                 screen_manager="ncurses"
478                 AC_DEFINE(USE_NCURSES)
479         fi
482 AC_ARG_WITH(hsc,
483         [--with-hsc               Compile with support for the HSC firewall],
484         if test x$withval = xyes; then
485                 AC_DEFINE(HSC_PROXY)
486         fi
490 dnl Check for Gnome
492 mx=""
493 gmcdep=""
494 libgtkedit=""
495 AC_SUBST(insticons)
496 GNOME_INIT_HOOK([
497         mx=mx
498         gmcdep=gmcdep
499         libgtkedit="libgtkedit.a"
500         insticons=install_icons
501         if test x"$xvers" = xnone; then
502             xvers="Gnome"
503         else
504             xvers="Gnome+$xvers"
505         fi
507 AC_SUBST(mx)
508 AC_SUBST(gmcdep)
509 AC_SUBST(libgtkedit)
510 AC_SUBST(GNOMEGNORBA_LIBS)
513 dnl Check for the -mandoc package
515 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
516 if $HAVE_nroff; then
517     AC_MSG_CHECKING(for manual formatting macros)
518     AC_CACHE_VAL(ac_cv_mandoc, [
519     nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
520     if test $? = 0
521     then
522         ac_cv_mandoc=-mandoc
523     else
524         ac_cv_mandoc=-man
525     fi
526     ])
527     MANDOC=$ac_cv_mandoc
528     AC_MSG_RESULT($MANDOC)
529 else
530     MANDOC=-man
532 AC_SUBST(MANDOC)
535 dnl Check if nroff accepts -Tascii
537 if $HAVE_nroff; then
538     AC_MSG_CHECKING(If nroff accepts -Tascii)
539     AC_CACHE_VAL(ac_cv_nroff_tascii, [
540     nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
541     if test $? = 0
542     then
543         ac_cv_nroff_tascii=" -Tascii"
544         AC_MSG_RESULT(yes)
545     else
546         ac_cv_nroff_tascii=""
547         AC_MSG_RESULT(no)
548     fi
549     ])
551 TROFFASCII="$ac_cv_nroff_tascii"
552 AC_SUBST(TROFFASCII)
555 dnl Check for - option to file
557 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
558 if $HAVE_FILECMD; then
559     AC_MSG_CHECKING(for - option to file command)
560     AC_CACHE_VAL(ac_cv_filestdin, [
561     cat > conftest.c <<EOF
562 /* A comment */
563 #if 0
564 #endif
565 void main(void)
566 { return; }
568     changequote(, )
569     cat > conftest.sed <<EOF
570 s/^[^:]*:[\ \   ]*//
571 s/[\ \  ]*$//
573     filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
574     filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
575     if test "$filehyphen_1" = "$filehyphen_2"; then
576         ac_cv_filestdin=yes
577     else
578         ac_cv_filestdin=no
579     fi
580     changequote([, ])
581     rm conftest.c conftest.sed
582     unset filehyphen_1
583     unset filehyphen_2
584     ])
586     if test x$ac_cv_filestdin = xyes; then
587         AC_DEFINE(FILE_STDIN)
588     fi
589     filestdin=$ac_cv_filestdin
590     AC_MSG_RESULT($filestdin)
592     dnl
593     dnl Check for -L option to file
594     dnl
596 AC_MSG_CHECKING(for -L option to file command)
597 AC_CACHE_VAL(ac_cv_filel, [
598 file -L . > /dev/null 2>&1
599 if test $? = 0
600 then
601     ac_cv_filel=yes
602 else
603     ac_cv_filel=no
606 if test x$ac_cv_filel = xyes; then
607     AC_DEFINE(FILE_L)
609 filel=$ac_cv_filel
610 AC_MSG_RESULT($filel)
611 fi 
614 dnl Check to see if grep program allowes dash to denote stdin 
616 AC_MSG_CHECKING(for - option to grep command)
617 AC_CACHE_VAL(ac_cv_grep_stdin, [
618     grep ac_cv_grep_stdin - > /dev/null 2>&1 < ./configure
619     if test $? = 0; then
620         ac_cv_grep_stdin=yes
621     else
622         ac_cv_grep_stdin=no
623     fi
625 if test x$ac_cv_grep_stdin = xyes; then
626     AC_DEFINE(GREP_STDIN)
628 AC_MSG_RESULT($ac_cv_grep_stdin)
631 dnl The termnet support
633 termnet=false
634 AC_ARG_WITH(termnet,
635         [--with-termnet             If you want a termified net support],[
636         if test x$withval = xyes; then
637                 AC_DEFINE(USE_TERMNET)
638                 termnet=true            
639         fi
643 dnl The subshell support
646 AC_MSG_CHECKING(for subshell support)
647 AC_ARG_WITH(subshell,
648         [--with-subshell            If you want to use a concurrent shell],
649         result=no
650         if test x$withval = xoptional
651         then
652                 AC_DEFINE(SUBSHELL_OPTIONAL)
653                 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
654                 result="optional"
655         fi
656         if test x$withval = xyes
657         then 
658                 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
659                 result="yes"
660         fi,
661         dnl Default: provide the subshell support on non-ultrix machines
662         if test $system = ULTRIX        
663         then
664                 result=no
665         else
666                 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
667                 result=yes
668         fi
670 AC_MSG_RESULT($result)
671 subshell="$result"
674 dnl Check for GCC
676 if test x$GCC = x
677 then
678         AC_DEFINE(OLD_TOOLS)
679         CPPFLAGS="$CPPFLAGS"
683 dnl This option is only inteded for being used by me :-)
684 dnl It has some nasty hacks built in.
686 mem_debug="none"
687 AC_ARG_WITH(debug, 
688 [--with-debug               For use by developers only: activates -Wall and MAD],
689         [if test x$withval = xyes; then
690         CFLAGS="$CFLAGS -Wall"
691         mem_debug="Janne's MAD library"
692         AC_DEFINE(HAVE_MAD)
693         AC_DEFINE(MCDEBUG)
694         if [ echo `uname -s -r` | grep -q 'SunOS 4.1' ]
695         then
696             CFLAGS="$CFLAGS -Wno-implicit"
697         fi
698         if echo "$CFLAGS" | grep -e -g >/dev/null 2>&1; then
699                 :
700         else
701             if test $cc_uses_g = yes; then
702                 CFLAGS="$CFLAGS -g"
703             fi
704         fi
705         AC_MSG_RESULT(compiling with -Wall and the memory leak detector)
706 fi])
709 dnl This option is only inteded for being used by me :-)
710 dnl It has some nasty hacks built in.
712 AC_ARG_WITH(efence, 
713 [--with-efence              Developers only: activates -Wall and efence],
714         [if test x$withval = xyes; then
715         CFLAGS="$CFLAGS -Wall"
716         AC_DEFINE(MCDEBUG)
717         LIBS="$LIBS -lefence"
718         if [ echo `uname -s -r` | grep -q 'SunOS 4.1' ]
719         then
720             CFLAGS="$CFLAGS -Wno-implicit"
721         fi
722         if echo "$CFLAGS" | grep -e -g >/dev/null 2>&1; then
723                 :
724         else
725             if test $cc_uses_g = yes; then
726                 CFLAGS="$CFLAGS -g"
727             fi
728         fi
729         AC_MSG_RESULT(compiling with -Wall and Electric fence)
730         mem_debug="Electric Fence"
731 fi])
733 INTLSUB=""
734 LINTL=""
735 if test x$USE_NLS = xyes; then
736     if test x$USE_INCLUDED_LIBINTL = xyes; then
737         CPPFLAGS="$CPPFLAGS -I\$(builddir)/intl"
738         LINTL="-L\$(builddir)/intl -lintl"
739     fi
740     INTLSUB=intl
742 AC_SUBST(INTLSUB)
743 AC_SUBST(LINTL)
746 dnl To force mmap support
747 dnl We use only part of the functionality of mmap, so on AIX,
748 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
750 AC_ARG_WITH(mmap, 
751         [--with-mmap                To force using the mmap call (AIX)],
752         [if test x$withval = xyes; then
753         AC_DEFINE(HAVE_MMAP)
754         AC_MSG_RESULT(forcing MMAP support)
755 fi])
757 AC_DEFUN(AC_USE_TERMINFO,
758         AC_DEFINE(SLANG_TERMINFO)
759         AC_MSG_RESULT(Using SLang screen manager/terminfo)
760         slang_term=" with terminfo"
763 AC_DEFUN(AC_USE_TERMCAP,
764         AC_MSG_RESULT(Using SLang screen manager/termcap)
765         AC_DEFINE(USE_TERMCAP)
766         dnl Check with $LIBS at the end so that it works with ELF libs.
767         AC_CHECK_LIB(termcap, tgoto, LIBS="$LIBS -ltermcap", , $LIBS)
768         slang_term=" with termcap"
770         
771 slang_check_lib=true
772 slang_term=""
773 slang_use_system_installed_lib=false
774 AC_CHECK_LIB(slang,SLang_init_tty,
775         AC_CHECK_HEADERS(slang.h)
776         if test x$ac_cv_header_slang_h = xyes
777         then
778              slang_use_system_installed_lib=true
779              slang_check_lib=false
780         else
781              AC_CHECK_HEADERS(slang/slang.h)
782              if test x$ac_cv_header_slang_slang_h = xyes
783              then
784                  slang_use_system_installed_lib=true
785                  slang_check_lib=false
786                  AC_DEFINE(SLANG_H_INSIDE_SLANG_DIR)
787              fi
788         fi
791 AC_ARG_WITH(terminfo,
792         [--with-terminfo            SLANG: Force usage of terminfo],[
793         AC_USE_TERMINFO
794         slang_check_lib=false
795         slang_use_system_installed_lib=false
796         ]
799 AC_ARG_WITH(termcap,
800         [--with-termcap             SLANG: Force usage of termcap],[
801         AC_USE_TERMCAP
802         slang_check_lib=false
803         slang_use_system_installed_lib=false
804         ]
807 AC_ARG_WITH(included-slang,
808         [--with-included-slang      SLANG: use the SLang library included here],[
809             slang_use_system_installed_lib=false
810             slang_check_lib=true
811         ]
814 AC_DEFUN(AC_WITH_SLANG,
815         AC_DEFINE(HAVE_SLANG)
816         search_ncurses=false
817         if $slang_use_system_installed_lib
818         then
819             AC_DEFINE(HAVE_SYSTEM_SLANG)
820             LSLANG="-lslang"
821             screen_manager="SLang (using system-installed library)"
822             AC_MSG_RESULT(Using system installed SLang library)
823             rm slang/slang.h
824         else
825             MCCPPFLAGS="$MCCPPFLAGS -I\$(slangdir)"
826             LIBSLANG="libmcslang.a"
827             screen_manager="SLang"
828             LSLANG="-lmcslang"
829             CPPFLAGS="$CPPFLAGS -I../slang"
830             fastdepslang=fastdepslang
831             rm slang/slang.h
832             ln -s ../$srcdir/slang/slang-mc.h slang/slang.h
833         fi
834         if $slang_check_lib
835         then
836             use_terminfo=false
837             if test -d /usr/lib/terminfo; then
838                 use_terminfo=true;
839             fi
840             if test -d /usr/share/lib/terminfo; then
841                 use_terminfo=true;
842             fi
843             if test -d /usr/local/lib/terminfo; then
844                 use_terminfo=true;
845             fi
846             if test -d /lib/terminfo; then
847                 use_terminfo=true;
848             fi
849             if test -d /usr/local/share/terminfo; then
850                 use_terminfo=true;
851             fi
852             if test -d /usr/share/terminfo; then
853                 use_terminfo=true;
854             fi
855             if $use_terminfo; then
856                 AC_USE_TERMINFO
857             else
858                 AC_USE_TERMCAP
859             fi
860         fi
863 LIBSLANG=""
864 LSLANG=""
865 fastdepslang=""
866 AC_ARG_WITH(slang,
867         [--with-slang              Compile with the slang screen manager],[
868         if test x$withval = xyes; then
869                 AC_WITH_SLANG
870         fi
873 AC_SUBST(LIBSLANG)
874 AC_SUBST(LSLANG)
875 AC_SUBST(fastdepslang)
877 TERMNET=""
878 AC_DEFUN(AC_WITH_VFS, [
879         AC_DEFINE(USE_VFS)
880         if $use_net_code; then
881             AC_DEFINE(USE_NETCODE)
882         fi
883         LIBVFS="libvfs-mc.a"
884         LVFS="-lvfs-mc"
885         fastdepvfs=fastdepvfs
886         MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
887         AC_MSG_RESULT(Using the VFS switch code)
888         vfs_type="Midnight Commander Virtual File System"
890 AC_SUBST(TERMNET)
892 LIBVFS=""
893 LVFS=""
894 fastdepvfs=""
895 vfs_type="normal"
896 AC_ARG_WITH(vfs,
897         [--with-vfs                Compile with the VFS code],
898         if test x$withval = xyes
899         then 
900                 AC_WITH_VFS
901         else
902                 vfs_flags=""
903                 TERMNET=""
904                 mcserv=""
905         fi,
906         dnl Default: provide the VFS code
907         AC_WITH_VFS     
909 AC_SUBST(LIBVFS)
910 AC_SUBST(LVFS)
911 AC_SUBST(fastdepvfs)
913 AC_DEFUN(AC_WITH_EDIT, [
914         AC_DEFINE(USE_INTERNAL_EDIT)
915         LIBEDIT_A="libedit.a"
916         MCEDIT="mcedit"
917         LEDIT="-ledit"
918         CPPFLAGS="$CPPFLAGS -I\$(rootdir)"
919         EDIT_msg="yes"
920         AC_MSG_RESULT(will call internal editor)
923 LIBEDIT_A=""
924 MCEDIT=""
925 LEDIT=""
926 EDIT_msg=""
927 AC_ARG_WITH(edit,
928         [--with-edit                Define INTERNAL_EDIT],
929         if test x$withval = xyes
930         then
931                 AC_WITH_EDIT
932         else
933                 EDIT_msg="no"
934         fi, 
935         dnl Default: provide the internal editor
936         AC_WITH_EDIT
938 AC_SUBST(LIBEDIT_A)
939 AC_SUBST(MCEDIT)
940 AC_SUBST(LEDIT)
942 AC_ARG_WITH(netrc,
943         [--with-netrc               Compile with ftp .netrc support],[
944         AC_DEFINE(USE_NETRC)
945         AC_MSG_RESULT(ftpfs will have .netrc parsing code)
948 undelfs_o=""
949 AC_DEFUN(AC_EXT2_UNDEL, [
950   GNOME_UNDELFS_CHECKS
951   if test "$ext2fs_undel" = yes; then
952      AC_MSG_RESULT(With ext2fs file recovery code)
953      vfs_flags="${vfs_flags} undelfs"
954      undelfs_o="undelfs.o"
955      LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
956   else
957      AC_MSG_WARN(No ext2fs file recovery code)
958   fi
961 AC_ARG_WITH(ext2undel,
962         [--with-ext2undel           Compile with ext2 undelete code],[
963         if test x$withval != xno;
964         then
965                 if test x$withval != xyes
966                 then
967                         LIBS="$LIBS -L$withval/lib"
968                         CPPFLAGS="$CPPFLAGS -I$withval/include"
969                 fi
970                 AC_EXT2_UNDEL
971         fi],
972         dnl Default: detect
973         AC_CHECK_LIB(ext2fs, ext2fs_close, AC_EXT2_UNDEL,,-lcom_err)
976 AC_SUBST(undelfs_o)
977         
979 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
981 AC_DEFUN(AC_NCURSES, [
982     if $search_ncurses
983     then
984         if test -f $1/$2
985         then
986             AC_MSG_RESULT(Found ncurses on $1/$2)
987             LIBS="$LIBS $3"
988             CPPFLAGS="$CPPFLAGS $4"
989             search_ncurses=false
990             screen_manager=$5
991             AC_DEFINE(USE_NCURSES)
992         fi
993     fi
996 if $search_ncurses
997 then
998     AC_CHECKING("location of ncurses.h file")
1000     AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
1001     AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
1002     AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
1003     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")
1005     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")
1007     AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
1009     dnl
1010     dnl We couldn't find ncurses, try SysV curses
1011     dnl
1012     if $search_ncurses 
1013     then
1014         AC_EGREP_HEADER(init_color, /usr/include/curses.h,
1015             AC_USE_SYSV_CURSES)
1016         AC_EGREP_CPP(USE_NCURSES,[
1017 #include <curses.h>
1018 #ifdef __NCURSES_H
1019 #undef USE_NCURSES
1020 USE_NCURSES
1021 #endif
1023         CPPFLAGS="$CPPFLAGS -DRENAMED_NCURSES"
1024         AC_DEFINE(USE_NCURSES)
1025         search_ncurses=false
1026         screen_manager="ncurses installed as curses"
1028     fi
1030     dnl
1031     dnl Try SunOS 4.x /usr/5{lib,include} ncurses
1032     dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
1033     dnl should be replaced by a more fine grained selection routine
1034     dnl
1035     if $search_ncurses
1036     then
1037         if test -f /usr/5include/curses.h
1038         then
1039             AC_USE_SUNOS_CURSES
1040         fi
1041     else
1042         # check for ncurses version, to properly ifdef mouse-fix
1043         AC_MSG_CHECKING(for ncurses version)
1044         ncurses_version=unknown
1045 cat > conftest.$ac_ext <<EOF
1046 [#]line __oline__ "configure"
1047 #include "confdefs.h"
1048 #ifdef RENAMED_NCURSES
1049 #include <curses.h>
1050 #else
1051 #include <ncurses.h>
1052 #endif
1053 #undef VERSION
1054 VERSION:NCURSES_VERSION
1056         if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
1057   egrep "VERSION:" >conftest.out 2>&1; then
1058 changequote(,)dnl
1059             ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
1060 changequote([,])dnl
1061         fi
1062         rm -rf conftext*
1063         AC_MSG_RESULT($ncurses_version)
1064         case "$ncurses_version" in
1065 changequote(,)dnl
1066         4.[01])
1067 changequote([,])dnl
1068             AC_DEFINE(NCURSES_970530,2)
1069             ;;
1070         1.9.9g)
1071             AC_DEFINE(NCURSES_970530,1)
1072             ;;
1073         1*)
1074             AC_DEFINE(NCURSES_970530,0)
1075             ;;
1076         esac
1077     fi
1080 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
1081 dnl check for resizeterm and keyok.
1083 SAVED_LIBS="$LIBS"
1084 LIBS="$LIBS $LGPM"
1085 AC_CHECK_FUNCS(resizeterm keyok)
1086 LIBS="$SAVED_LIBS"
1088 if test "x$screen_manager" = "xunknown"; then
1089     AC_WITH_SLANG
1093 dnl The variables used for expanding the auto saver.
1095 saver=""
1096 saver_target=""
1097 vcs=""
1098 install_saver="no"
1099 PAMLIBS=""
1100 if test $system = Linux
1101 then
1102     saver="install.saver"
1103     saver_target="cons.saver"
1104     vcs="install.create_vcs"
1105     install_saver="yes"
1107     dnl
1108     dnl On Linux, check for PAM authentication available
1109     dnl
1110     AC_CHECK_LIB(pam, pam_start, [
1111         AC_DEFINE(HAVE_PAM)
1112         PAMLIBS="-lpam -ldl"
1113     ],[],[-ldl])
1116 AC_SUBST(saver_target)
1117 AC_SUBST(saver)
1118 AC_SUBST(vcs)
1119 AC_SUBST(PAMLIBS)
1122 dnl We need sed in order to fix the library files 
1124     SEDCMD="sed 's/-man/$MANDOC/'"
1125     SEDCMD2="sed 's%@prefix@%\$(prefix)%'"
1126 AC_SUBST(SEDCMD)
1127 AC_SUBST(SEDCMD2)
1129 if test x$no_xview = xyes; then
1130     :
1131 else
1132     AC_LIB_XPM
1133     if test x$ac_cv_has_xpm = xyes; then
1134         XPM_LIB=-lXpm
1135         AC_SUBST(XPM_LIB)
1136         AC_X_SHAPE_EXTENSION
1137         if test x$ac_cv_has_shape = xyes; then
1138             AC_DEFINE(HAVE_XPM_SHAPE)
1139             XEXT_LIB=-lXext
1140             AC_SUBST(XEXT_LIB)
1141         fi
1142     fi
1147 dnl This code should be moved to the ac_WITH_SLANG
1149 dnl We check for the existance of setupterm on curses library
1150 dnl this is required to load certain definitions on some termcaps
1151 dnl editions (AIX and OSF/1 I seem to remember).
1152 dnl Note that we avoid using setupterm 
1153 case $screen_manager in
1154 changequote(,)dnl
1155         [Ss][Ll][Aa][Nn][Gg]*)
1156 changequote([, ])dnl
1157                 if test $system = Linux
1158                 then
1159                         echo
1160                 else
1161                 AC_CHECK_LIB(curses,setupterm,[
1162                         AC_TRY_COMPILE([
1163 #include <curses.h>
1164 #include <term.h>],[
1165    if (key_end == parm_insert_line)
1166         return 1;
1167    return 0;
1169                         LIBS="$LIBS -lcurses"
1170                         AC_DEFINE(USE_SETUPTERM)])])
1171                 fi
1172                 ;;
1173 esac
1175 LIBS="$LIBS $posix_libs"
1177 CPPFLAGS="-I.. $CPPFLAGS"
1178 AC_SUBST(CFLAGS)
1179 AC_SUBST(CPPFLAGS)
1180 AC_SUBST(MCCPPFLAGS)
1181 AC_SUBST(LDFLAGS)
1182 AC_SUBST(LIBS)
1184 ac_cv_make_with_percent_rules=no
1185 if test x$ac_cv_prog_gnu_make = xyes; then
1186     MCFG='include ../Make.common'
1187     MCFGR='include ./Make.common'
1188     MCF=/dev/null
1189     PHONY='.PHONY:'
1190     DOTDEPEND='ifeq (.depend,$(wildcard .depend)) \
1191 include .depend \
1192 endif'
1193     WRITEDEP=":"
1194     ac_cv_make_with_percent_rules=yes
1195 else
1196     MCFG=""
1197     MCFGR=""
1198     MCF=./Make.common
1199     PHONY='#'
1200     DOTDEPEND=""
1201     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'
1203 AC_SUBST(PHONY)
1204 AC_SUBST(WRITEDEP)
1205 AC_SUBST(MCFG)
1206 AC_SUBST(MCFGR)
1207 AC_SUBST(DOTDEPEND)
1208 AC_SUBST_FILE(MCF)
1210 if test x$ac_cv_make_with_percent_rules = xyes; then
1211     PCENTRULE=""
1212 else
1213     PCENTRULE="#"
1215 AC_SUBST(PCENTRULE)
1217 AC_SUBST(builddir)
1218 builddir=`pwd`
1221 dnl Output configuration filesn
1224 AC_OUTPUT([
1225 Make.common 
1226 Makefile 
1227 VERSION
1228 doc/Makefile 
1229 vfs/Makefile:vfs/Make-mc.in
1230 lib/Makefile
1231 gnome/Makefile 
1232 gnome/mc.keys.in
1233 idl/Makefile
1234 src/Makefile
1235 slang/Makefile 
1236 edit/Makefile 
1237 gtkedit/Makefile 
1238 new_icons/Makefile 
1239 icons/Makefile
1241 lib/mc.ext
1242 lib/mc-gnome.ext
1244 mcfn_install
1245 vfs/extfs/ftplist vfs/extfs/uzip vfs/extfs/uzoo vfs/extfs/lslR
1246 vfs/extfs/ulha vfs/extfs/ucpio vfs/extfs/deb vfs/extfs/urar vfs/extfs/uar
1248 doc/mc.1 doc/mcedit.1 doc/mcserv.8
1250 intl/Makefile po/Makefile.in
1251 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
1253 if test x$srcdir != x; then
1254     if test $srcdir != .; then
1255         cp $srcdir/VERSION VERSION
1256         mkdir nt
1257         mkdir os2
1258         cp $srcdir/pc/Makefile nt/Makefile
1259     fi
1262 if test "x$screen_manager" = xSLang; then
1263     screen_manager="${screen_manager}${slang_term}"
1266 echo "
1267 Configuration:
1269   Source code location:       ${srcdir}
1270   Compiler:                   ${CC}
1271   Compiler flags:             ${CFLAGS}
1272   File system:                ${vfs_type}
1273                               ${vfs_flags}
1274   Text mode screen manager:   ${screen_manager}
1275   Install console saver:      ${install_saver}
1276   Text mode mouse library:    ${mouse_lib}
1277   Debugger code:              ${mem_debug}
1278   With subshell support:      ${subshell}
1279   X11 versions:               ${xvers}
1280   Internal editor:            ${EDIT_msg}
1281   Install path:               ${prefix}/bin, ${prefix}/lib/mc"
1282 if test -n "$xv_bindir"; then
1283 echo "  XView version install path: ${xv_bindir}"
1285 echo ""