update
[midnight-commander.git] / configure.in
blob64444ec300cc7a681692f5cda381305ca42ae305
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.21
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 AC_PROG_MAKE_SET
28 AC_PROG_CC
29 AC_PROG_CPP
30 AC_PROG_RANLIB
31 AC_PROG_LN_S
32 AC_PROG_AWK
33 if test x"$AWK" = x; then
34     AWK=":"
35     AWK_VAR_OPTION=""
36     dep=slowdep
37 else
38     dep=fastdep
40     # test whether awk needs -v for variables (e.g. Solaris) or not (e.g. SunOs 4)
41     if test x"`echo | $AWK 'BEGIN { print variable; exit }' variable=123`" = x123; then
42         AWK_VAR_OPTION=""
43     else
44         AWK_VAR_OPTION="-v"
45     fi
47 AC_SUBST(AWK_VAR_OPTION)
48 AC_SUBST(dep)
49 AC_PROG_GNU_MAKE
51 AC_AIX
52 AC_MINIX
53 AC_ISC_POSIX
54 MC_HPUX_PROG_CC_STDC
55 AC_HEADER_MAJOR
56 AC_C_CONST
57 AC_PATH_PROG(MV, mv, mv)
58 AC_PATH_PROG(CP, cp, cp)
59 AC_PATH_PROG(RM, rm, rm)
60 AC_PATH_PROG(CHMOD, chmod, :)
61 AC_PATH_PROG(AR, ar, ar)
63 AC_CHECK_PROG(system,uname,`uname`,unknown)
64 AC_CHECK_PROGS(X11_WWW,netscape arena Mosaic chimera)
65 if test x"$X11_WWW" = x; then
66     X11_WWW=lynx
69 ALL_LINGUAS="cs da de es fr it ko no pl ru"
70 AM_GNU_GETTEXT
71 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
73 dnl
74 dnl This part supplies reasonable defaults for CFLAGS, if they weren't
75 dnl specified by ''CFLAGS=flags ./configure''
76 dnl
77 cc_uses_g=yes
78 if test x$GCC = xyes; then
79     if test x$ac_cv_prog_gcc_g = xyes; then
80         :
81     else
82         cc_uses_g=no
83     fi
86 dnl Debug mode is turned ON for now
87 if test "x$CCOPTS" = x; then
88     CCOPTS='-g'
91 if test "x$CCOPTS" = x; then
92     if test x$GCC = xyes; then
93         if test x$system = xLinux; then
94             CCOPTS='-O2 -fno-strength-reduce'
95             if test x$use_cc_g_flag = xyes; then
96                 if test $cc_uses_g = yes; then
97                     CCOPTS='-g -O'
98                 fi
99             fi
100         else
101             CCOPTS='-O'
102             if test x$use_cc_g_flag = xyes; then
103                 if test $cc_uses_g = yes; then
104                     CCOPTS='-g -O'
105                 fi
106             fi
107         fi
108     else
109         if test x$use_cc_g_flag = xyes; then
110             CCOPTS="$CFLAGS"
111         else
112             CCOPTS=
113         fi
114     fi
116 CFLAGS="$CCOPTS"
120 dnl We now use glib
121 dnl 
122 AM_PATH_GLIB(,,AC_MSG_ERROR(Test for GLIB failed.  MC requires GLIB.))
123 LIBS="$LIBS $GLIB_LIBS"
124 CFLAGS="$CFLAGS $GLIB_CFLAGS"
127 dnl For A/UX.  Do not move
130 posix_libs=""
131 if test $system = A/UX
132 then
133     posix_libs="-lposix"
134     AC_DEFINE(_POSIX_SOURCE)
137 AC_PROG_INSTALL
138 AC_CHECK_HEADERS(unistd.h string.h memory.h crypt.h grp.h limits.h malloc.h)
139 AC_CHECK_HEADERS(stdlib.h termios.h)
141 if test x$ac_cv_header_malloc_h = xno; then
142     echo '/* NeXTStep malloc.h stub */' > $srcdir/malloc.h
145 AC_HEADER_SYS_WAIT
146 AC_HEADER_DIRENT
147 AC_SHORT_D_NAME_LEN
148 AC_HEADER_STDC
151 #Let me check for an incompatible regcomp in HP-UX before making this
152 #the default
154 REGEX_O="regex.o"
155 AC_SUBST(REGEX_O)
157 dnl Missing structure components
158 AC_STRUCT_ST_BLKSIZE
159 AC_STRUCT_ST_BLOCKS
160 AC_STRUCT_ST_RDEV
163 dnl Check availability of some functions 
164 dnl 
166 AC_CHECK_FUNCS(strerror statfs getwd strcasecmp strncasecmp)
167 AC_CHECK_FUNCS(strdup memmove pwdauth truncate initgroups putenv)
168 AC_CHECK_FUNCS(memset memcpy tcsetattr tcgetattr cfgetospeed)
169 AC_CHECK_FUNCS(sigaction sigemptyset sigprocmask sigaddset)
170 AC_CHECK_FUNCS(sysconf setuid setreuid)
172 SHADOWLIB=
173 if test x$system = xLinux; then
174 AC_CHECK_LIB(shadow,pw_encrypt,[
175 shadow_header=no
176 AC_CHECK_HEADERS(shadow.h)
177 if test x$ac_cv_header_shadow_h = xyes; then
178     shadow_header=yes
179 else
180 AC_CHECK_HEADERS(shadow/shadow.h)
181     if test x$ac_cv_shadow_shadow_h = xyes; then
182         shadow_header=yes
183     fi
185 if test $shadow_header = yes; then
186     AC_DEFINE(LINUX_SHADOW)
187     SHADOWLIB=-lshadow
191 AC_SUBST(SHADOWLIB)
193 NEED_CRYPT_PROTOTYPE=yes
194 if test x$ac_cv_header_crypt_h = xyes; then
195 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");],[
196 NEED_CRYPT_PROTOTYPE=no])
197 else 
198     if test x$ac_cv_header_unistd_h = xyes; then
199 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");],[
200 NEED_CRYPT_PROTOTYPE=no])
201     fi
203 if test x$NEED_CRYPT_PROTOTYPE=xyes; then
204 AC_DEFINE(NEED_CRYPT_PROTOTYPE)
208 dnl AIX and Sequent need <sys/select.h> for fd_set
210 AC_CHECK_HEADERS(sys/select.h)
213 dnl On SCO and some SVR4, crypt is on libcrypt.a
214 dnl         grantpt in  libpt.a
216 LCRYPT=""
217 AC_CHECK_FUNCS(crypt, , [
218     AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
219         AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
220 AC_SUBST(LCRYPT)
222 dnl This is the correct version
223 dnl AC_CHECK_FUNCS(grantpt, , AC_CHECK_LIB(pt, grantpt))
225 dnl And workaround for a Autoconf 2.4 bug:
226 AC_CHECK_FUNCS(grantpt)
227 if test x$ac_cv_func_grantpt = xyes; then
228     :
229 else
230     AC_CHECK_LIB(pt, grantpt)
234 dnl libintl.a required on SCO to provide proper NLS support
235 dnl (using native cc links it by default)
237 if test x$GCC = xyes; then
238     AC_CHECK_LIB(intl, tolower)
241 dnl replacing lstat with statlstat on sco makes it more portable between
242 dnl sco clones
243 AC_CHECK_FUNCS(statlstat)
246 dnl If running under AIX, AC_AIX does not tell us that
248 AC_MSG_CHECKING(for AIX defines)
249 AC_EGREP_CPP(yes,
250 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
252 #endif
253 ], [
254 AC_DEFINE(IS_AIX)
255 AC_MSG_RESULT(yes)
256 ], AC_MSG_RESULT(no))
258 dnl   
259 dnl This hack is here until autoconf adds it
260 dnl Needed for Unixware: getmntent is on libgen.a
262 AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
265 dnl This is from GNU fileutils, check aclocal.m4 for more information
267 AC_GET_FS_INFO
270 dnl Missing typedefs and replacements
271 dnl 
273 AC_TYPE_MODE_T
274 AC_CHECK_TYPE(umode_t, int)
275 AC_CHECK_TYPE(off_t, long)
276 AC_TYPE_PID_T
277 AC_TYPE_UID_T
278 AC_CHECK_TYPE(nlink_t, unsigned int)
280 AC_FUNC_MMAP
281 AC_FUNC_ALLOCA
284 dnl Cool hack, but we don't use it currently 
286 dnl AC_MSG_CHECKING(for token pasting method)
287 dnl AC_EGREP_CPP(portable,[
288 dnl #define tken(a, b) a##b
289 dnl tken(port, able)
290 dnl ], [AC_DEFINE(HAVE_PORTABLE_TOKEN_PASTING)
291 dnl AC_MSG_RESULT(portable)
292 dnl ], [
293 dnl AC_MSG_RESULT(non-portable)
294 dnl ])
296 AC_PATH_XTRA
299 dnl Network related functions
302 AC_CHECK_LIB(nsl, t_accept)
303 AC_CHECK_LIB(socket, socket)
305 have_socket=no
306 AC_CHECK_FUNCS(socket, have_socket=yes)
307 if test $have_socket = no; then
308   # socket is not in the default libraries.  See if it's in some other.
309   for lib in bsd socket inet; do
310     AC_CHECK_LIB($lib, socket, [
311         LIBS="$LIBS -l$lib"
312         have_socket=yes
313         AC_DEFINE(HAVE_SOCKET)
314         break])
315   done
318 have_gethostbyname=no
319 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
320 if test $have_gethostbyname = no; then
321   # gethostbyname is not in the default libraries.  See if it's in some other.
322   for lib in bsd socket inet; do
323     AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
324   done
327 AC_CHECK_FUNCS(socketpair)
330 dnl Sequent wants getprocessstats
332 AC_CHECK_LIB(seq, get_process_stats, [
333         LIBS="$LIBS -lseq"
334         AC_DEFINE(HAVE_GET_PROCESS_STATS)])
336 GNOME_VFS_CHECKS
337 NETFILES=
338 if test $have_socket = yes; then
339    NETFILES="\$(NETFILES)"
341 AC_SUBST(NETFILES)
343 screen_manager=unknown
344 search_ncurses=false
346 CFLAGS=${CFLAGS--O}
347 LDFLAGS=${LDFLAGS--O}
349 AC_DEFUN(AC_USE_SUNOS_CURSES, [
350         search_ncurses=false
351         screen_manager="SunOS 4.x /usr/5include curses"
352         AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
353         AC_DEFINE(USE_SUNOS_CURSES)
354         AC_DEFINE(NO_COLOR_CURSES)
355         AC_DEFINE(USE_SYSV_CURSES)
356         CPPFLAGS="$CPPFLAGS -I/usr/5include"
357         XCURSES="xcurses.o /usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
358         AC_MSG_RESULT(Please note that some screen refreshs may fail)
359         AC_WARN(Reconsider using Slang)
362 AC_DEFUN(AC_USE_OSF1_CURSES, [
363        AC_MSG_RESULT(Using OSF1 curses)
364        search_ncurses=false
365        screen_manager="OSF1 curses"
366        AC_DEFINE(NO_COLOR_CURSES)
367        AC_DEFINE(USE_SYSV_CURSES)
368        XCURSES="xcurses.o"
369        LIBS="$LIBS -lcurses"
372 AC_DEFUN(AC_USE_SYSV_CURSES, [
373         AC_MSG_RESULT(Using SysV curses)
374         AC_DEFINE(USE_SYSV_CURSES)
375         XCURSES=""
376         search_ncurses=false
377         screen_manager="SysV/curses"
378         LIBS="$LIBS -lcurses"
381 XCURSES=""
382 AC_SUBST(XCURSES)
384 dnl AC_ARG_WITH(bsd-curses,
385 dnl [--with-bsd-curses         Used to compile with bsd curses, not very fancy],
386 dnl     search_ncurses=false
387 dnl     screen_manager="Ultrix/cursesX"
388 dnl     if test $system = ULTRIX
389 dnl     then
390 dnl         THIS_CURSES=cursesX
391 dnl        else
392 dnl         THIS_CURSES=curses
393 dnl     fi
395 dnl     LIBS="$LIBS -l$THIS_CURSES -ltermcap"
396 dnl     AC_DEFINE(USE_BSD_CURSES)
397 dnl     XCURSES="xcurses.o"
398 dnl     AC_MSG_RESULT(Please note that some screen refreshs may fail)
399 dnl     AC_WARN(Use of the bsdcurses extension has some)
400 dnl     AC_WARN(display/input problems.)
401 dnl     AC_WARN(Reconsider using xcurses)
402 dnl)
404 AC_ARG_WITH(sco,
405         [--with-sco                 Use this to turn on SCO-specific code],[
406         if test x$withval = xyes; then
407                 AC_DEFINE(SCO_FLAVOR)
408                 CFLAGS="$CFLAGS -D_SVID3"
409         fi
412 AC_ARG_WITH(sunos-curses,
413         [--with-sunos-curses        Used to force SunOS 4.x curses],[
414         if test x$withval = xyes; then
415                 AC_USE_SUNOS_CURSES
416         fi
419 AC_ARG_WITH(osf1-curses,
420         [--with-osf1-curses        Used to force OSF/1 curses],[
421         if test x$withval = xyes; then
422                 AC_USE_OSF1_CURSES
423         fi
426 AC_ARG_WITH(vcurses,
427         [--with-vcurses[=incdir]    Used to force SysV curses],
428         if test x$withval = xyes; then
429                 CPPFLAGS="$CPPFLAGS"
430         else
431                 CPPFLAGS="$CPPFLAGS -I$withval"
432         fi
433         AC_USE_SYSV_CURSES
436 mouse_lib="xterm only"
437 LGPM=""
438 AC_ARG_WITH(gpm-mouse, 
439         [--with-gpm-mouse[=base-dir]  Compile with gpm mouse support],[
440         if test x$withval != xno
441         then
442                 if test x$withval != xyes
443                 then
444                         LIBS="$LIBS -L$withval/lib"
445                         CPPFLAGS="$CPPFLAGS -I$withval/include"
446                 fi
447                 AC_DEFINE(HAVE_LIBGPM)
448                 mouse_lib="GPM and xterm"
449                 LGPM="-lgpm"
450         fi
451         ],[
452         AC_CHECK_LIB(gpm, Gpm_Repeat,[
453                 AC_DEFINE(HAVE_LIBGPM)
454                 mouse_lib="GPM and xterm"
455                 LGPM="-lgpm"],[
456                 if test $system = Linux
457                 then 
458                         AC_MSG_WARN("libgpm.a is missing or older than 0.18")
459                 fi
460                 ], $LIBS)
461         ]
463 AC_SUBST(LGPM)
465 AC_ARG_WITH(ncurses,
466         [--with-ncurses[=base-dir]    Compile with ncurses/locate base dir],
467         if test x$withval = xyes
468         then
469                 search_ncurses=true
470         else
471                 LIBS="$LIBS -L$withval/lib -lncurses"
472                 CPPFLAGS="$CPPFLAGS -I$withval/include"
473                 search_ncurses=false
474                 screen_manager="ncurses"
475                 AC_DEFINE(USE_NCURSES)
476         fi
479 AC_ARG_WITH(hsc,
480         [--with-hsc               Compile with support for the HSC firewall],
481         if test x$withval = xyes; then
482                 AC_DEFINE(HSC_PROXY)
483         fi
487 dnl Check for Gnome
489 mx=""
490 gmcdep=""
491 libgtkedit=""
493 AC_SUBST(insticons)
494 GNOME_INIT_HOOK([
495         mx=mx
496         gmcdep=gmcdep
497         libgtkedit="libgtkedit.a"
498         insticons=install_icons
499         if test x"$xvers" = xnone; then
500             xvers="Gnome"
501         else
502             xvers="Gnome+$xvers"
503         fi
504         gnomeicondir=`gnome-config --prefix`/share/pixmaps
506 AC_SUBST(gnomeicondir)
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 (system-installed library)"
822             AC_MSG_RESULT(Using system installed SLang library)
823             rm slang/slang.h
824             ac_save_LIBS="$LIBS"
825             LIBS="$LIBS $LSLANG"
826             AC_TRY_RUN(
827             [ 
828             #ifdef SLANG_H_INSIDE_SLANG_DIR
829             #include <slang/slang.h>
830             #else
831             #include <slang.h>
832             #endif
833             int main(void){
834                 SLtt_get_terminfo();
835                 SLtt_tgetflag("");
836                 return 0;
837             } ], 
838             [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO], 
839             [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
840         else
841             MCCPPFLAGS="$MCCPPFLAGS -I\$(slangdir)"
842             LIBSLANG="libmcslang.a"
843             screen_manager="SLang"
844             LSLANG="-lmcslang"
845             CPPFLAGS="$CPPFLAGS -I../slang"
846             fastdepslang=fastdepslang
847             rm slang/slang.h
848             ln -s ../$srcdir/slang/slang-mc.h slang/slang.h
849         fi
850         if $slang_check_lib
851         then
852             use_terminfo=false
853             for dir in  /usr/lib /usr/share/lib /usr/local/lib /lib \
854                         /usr/local/share /usr/share
855             do
856                 if test -d $dir/terminfo; then
857                 use_terminfo=true; 
858                 break
859                 fi
860             done
861             if $use_terminfo; then
862                 AC_USE_TERMINFO
863             else
864                 AC_USE_TERMCAP
865             fi
866         fi
869 LIBSLANG=""
870 LSLANG=""
871 fastdepslang=""
872 AC_ARG_WITH(slang,
873         [--with-slang              Compile with the slang screen manager],[
874         if test x$withval = xyes; then
875                 AC_WITH_SLANG
876         fi
879 AC_SUBST(LIBSLANG)
880 AC_SUBST(LSLANG)
881 AC_SUBST(fastdepslang)
883 TERMNET=""
884 AC_DEFUN(AC_WITH_VFS, [
885         AC_DEFINE(USE_VFS)
886         if $use_net_code; then
887             AC_DEFINE(USE_NETCODE)
888         fi
889         LIBVFS="libvfs-mc.a"
890         LVFS="-lvfs-mc"
891         fastdepvfs=fastdepvfs
892         MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
893         AC_MSG_RESULT(Using the VFS switch code)
894         vfs_type="Midnight Commander Virtual File System"
896 AC_SUBST(TERMNET)
898 LIBVFS=""
899 LVFS=""
900 fastdepvfs=""
901 vfs_type="normal"
902 AC_ARG_WITH(vfs,
903         [--with-vfs                Compile with the VFS code],
904         if test x$withval = xyes
905         then 
906                 AC_WITH_VFS
907         else
908                 vfs_flags=""
909                 TERMNET=""
910                 mcserv=""
911         fi,
912         dnl Default: provide the VFS code
913         AC_WITH_VFS     
915 AC_SUBST(LIBVFS)
916 AC_SUBST(LVFS)
917 AC_SUBST(fastdepvfs)
919 AC_DEFUN(AC_WITH_EDIT, [
920         AC_DEFINE(USE_INTERNAL_EDIT)
921         LIBEDIT_A="libedit.a"
922         MCEDIT="mcedit"
923         LEDIT="-ledit"
924         CPPFLAGS="$CPPFLAGS -I\$(rootdir)"
925         EDIT_msg="yes"
926         AC_MSG_RESULT(will call internal editor)
929 LIBEDIT_A=""
930 MCEDIT=""
931 LEDIT=""
932 EDIT_msg=""
933 AC_ARG_WITH(edit,
934         [--with-edit                Define INTERNAL_EDIT],
935         if test x$withval = xyes
936         then
937                 AC_WITH_EDIT
938         else
939                 EDIT_msg="no"
940         fi, 
941         dnl Default: provide the internal editor
942         AC_WITH_EDIT
944 AC_SUBST(LIBEDIT_A)
945 AC_SUBST(MCEDIT)
946 AC_SUBST(LEDIT)
948 AC_ARG_WITH(netrc,
949         [--with-netrc               Compile with ftp .netrc support],[
950         AC_DEFINE(USE_NETRC)
951         AC_MSG_RESULT(ftpfs will have .netrc parsing code)
954 undelfs_o=""
955 AC_DEFUN(AC_EXT2_UNDEL, [
956   GNOME_UNDELFS_CHECKS
957   if test "$ext2fs_undel" = yes; then
958      AC_MSG_RESULT(With ext2fs file recovery code)
959      vfs_flags="${vfs_flags} undelfs"
960      undelfs_o="undelfs.o"
961      LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
962   else
963      AC_MSG_WARN(No ext2fs file recovery code)
964   fi
967 AC_ARG_WITH(ext2undel,
968         [--with-ext2undel           Compile with ext2 undelete code],[
969         if test x$withval != xno;
970         then
971                 if test x$withval != xyes
972                 then
973                         LIBS="$LIBS -L$withval/lib"
974                         CPPFLAGS="$CPPFLAGS -I$withval/include"
975                 fi
976                 AC_EXT2_UNDEL
977         fi],
978         dnl Default: detect
979         AC_CHECK_LIB(ext2fs, ext2fs_close, AC_EXT2_UNDEL,,-lcom_err)
982 AC_SUBST(undelfs_o)
983         
985 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
987 AC_DEFUN(AC_NCURSES, [
988     if $search_ncurses
989     then
990         if test -f $1/$2
991         then
992             AC_MSG_RESULT(Found ncurses on $1/$2)
993             LIBS="$LIBS $3"
994             CPPFLAGS="$CPPFLAGS $4"
995             search_ncurses=false
996             screen_manager=$5
997             AC_DEFINE(USE_NCURSES)
998         fi
999     fi
1002 if $search_ncurses
1003 then
1004     AC_CHECKING("location of ncurses.h file")
1006     AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
1007     AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
1008     AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
1009     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")
1011     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")
1013     AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
1015     dnl
1016     dnl We couldn't find ncurses, try SysV curses
1017     dnl
1018     if $search_ncurses 
1019     then
1020         AC_EGREP_HEADER(init_color, /usr/include/curses.h,
1021             AC_USE_SYSV_CURSES)
1022         AC_EGREP_CPP(USE_NCURSES,[
1023 #include <curses.h>
1024 #ifdef __NCURSES_H
1025 #undef USE_NCURSES
1026 USE_NCURSES
1027 #endif
1029         CPPFLAGS="$CPPFLAGS -DRENAMED_NCURSES"
1030         AC_DEFINE(USE_NCURSES)
1031         search_ncurses=false
1032         screen_manager="ncurses installed as curses"
1034     fi
1036     dnl
1037     dnl Try SunOS 4.x /usr/5{lib,include} ncurses
1038     dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
1039     dnl should be replaced by a more fine grained selection routine
1040     dnl
1041     if $search_ncurses
1042     then
1043         if test -f /usr/5include/curses.h
1044         then
1045             AC_USE_SUNOS_CURSES
1046         fi
1047     else
1048         # check for ncurses version, to properly ifdef mouse-fix
1049         AC_MSG_CHECKING(for ncurses version)
1050         ncurses_version=unknown
1051 cat > conftest.$ac_ext <<EOF
1052 [#]line __oline__ "configure"
1053 #include "confdefs.h"
1054 #ifdef RENAMED_NCURSES
1055 #include <curses.h>
1056 #else
1057 #include <ncurses.h>
1058 #endif
1059 #undef VERSION
1060 VERSION:NCURSES_VERSION
1062         if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
1063   egrep "VERSION:" >conftest.out 2>&1; then
1064 changequote(,)dnl
1065             ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
1066 changequote([,])dnl
1067         fi
1068         rm -rf conftext*
1069         AC_MSG_RESULT($ncurses_version)
1070         case "$ncurses_version" in
1071 changequote(,)dnl
1072         4.[01])
1073 changequote([,])dnl
1074             AC_DEFINE(NCURSES_970530,2)
1075             ;;
1076         1.9.9g)
1077             AC_DEFINE(NCURSES_970530,1)
1078             ;;
1079         1*)
1080             AC_DEFINE(NCURSES_970530,0)
1081             ;;
1082         esac
1083     fi
1086 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
1087 dnl check for resizeterm and keyok.
1089 SAVED_LIBS="$LIBS"
1090 LIBS="$LIBS $LGPM"
1091 AC_CHECK_FUNCS(resizeterm keyok)
1092 LIBS="$SAVED_LIBS"
1094 if test "x$screen_manager" = "xunknown"; then
1095     AC_WITH_SLANG
1099 dnl The variables used for expanding the auto saver.
1101 saver=""
1102 saver_target=""
1103 vcs=""
1104 install_saver="no"
1105 PAMLIBS=""
1106 if test $system = Linux
1107 then
1108     saver="install.saver"
1109     saver_target="cons.saver"
1110     vcs="install.create_vcs"
1111     install_saver="yes"
1113     dnl
1114     dnl On Linux, check for PAM authentication available
1115     dnl
1116     AC_CHECK_LIB(pam, pam_start, [
1117         AC_DEFINE(HAVE_PAM)
1118         PAMLIBS="-lpam -ldl"
1119     ],[],[-ldl])
1122 AC_SUBST(saver_target)
1123 AC_SUBST(saver)
1124 AC_SUBST(vcs)
1125 AC_SUBST(PAMLIBS)
1128 dnl We need sed in order to fix the library files 
1130     SEDCMD="sed 's/-man/$MANDOC/'"
1131     SEDCMD2="sed 's%@prefix@%\$(prefix)%'"
1132 AC_SUBST(SEDCMD)
1133 AC_SUBST(SEDCMD2)
1135 if test x$no_xview = xyes; then
1136     :
1137 else
1138     AC_LIB_XPM
1139     if test x$ac_cv_has_xpm = xyes; then
1140         XPM_LIB=-lXpm
1141         AC_SUBST(XPM_LIB)
1142         AC_X_SHAPE_EXTENSION
1143         if test x$ac_cv_has_shape = xyes; then
1144             AC_DEFINE(HAVE_XPM_SHAPE)
1145             XEXT_LIB=-lXext
1146             AC_SUBST(XEXT_LIB)
1147         fi
1148     fi
1153 dnl This code should be moved to the ac_WITH_SLANG
1155 dnl We check for the existance of setupterm on curses library
1156 dnl this is required to load certain definitions on some termcaps
1157 dnl editions (AIX and OSF/1 I seem to remember).
1158 dnl Note that we avoid using setupterm 
1159 case $screen_manager in
1160 changequote(,)dnl
1161         [Ss][Ll][Aa][Nn][Gg]*)
1162 changequote([, ])dnl
1163                 if test $system = Linux
1164                 then
1165                         echo
1166                 else
1167                 AC_CHECK_LIB(curses,setupterm,[
1168                         AC_TRY_COMPILE([
1169 #include <curses.h>
1170 #include <term.h>],[
1171    if (key_end == parm_insert_line)
1172         return 1;
1173    return 0;
1175                         LIBS="$LIBS -lcurses"
1176                         AC_DEFINE(USE_SETUPTERM)])])
1177                 fi
1178                 ;;
1179 esac
1181 LIBS="$LIBS $posix_libs"
1183 CPPFLAGS="-I.. $CPPFLAGS"
1184 AC_SUBST(CFLAGS)
1185 AC_SUBST(CPPFLAGS)
1186 AC_SUBST(MCCPPFLAGS)
1187 AC_SUBST(LDFLAGS)
1188 AC_SUBST(LIBS)
1190 ac_cv_make_with_percent_rules=no
1191 if test x$ac_cv_prog_gnu_make = xyes; then
1192     MCFG='include ../Make.common'
1193     MCFGR='include ./Make.common'
1194     MCF=/dev/null
1195     PHONY='.PHONY:'
1196     DOTDEPEND='ifeq (.depend,$(wildcard .depend)) \
1197 include .depend \
1198 endif'
1199     WRITEDEP=":"
1200     ac_cv_make_with_percent_rules=yes
1201 else
1202     MCFG=""
1203     MCFGR=""
1204     MCF=./Make.common
1205     PHONY='#'
1206     DOTDEPEND=""
1207     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'
1209 AC_SUBST(PHONY)
1210 AC_SUBST(WRITEDEP)
1211 AC_SUBST(MCFG)
1212 AC_SUBST(MCFGR)
1213 AC_SUBST(DOTDEPEND)
1214 AC_SUBST_FILE(MCF)
1216 if test x$ac_cv_make_with_percent_rules = xyes; then
1217     PCENTRULE=""
1218 else
1219     PCENTRULE="#"
1221 AC_SUBST(PCENTRULE)
1223 AC_SUBST(builddir)
1224 builddir=`pwd`
1226 SHELL=${SHELL-"/bin/sh"}
1227 AC_SUBST(SHELL)
1230 dnl Output configuration filesn
1233 AC_OUTPUT([
1234 Make.common 
1235 Makefile 
1236 mc.spec
1237 VERSION
1238 doc/Makefile 
1239 vfs/Makefile:vfs/Make-mc.in
1240 lib/Makefile
1241 gnome/Makefile 
1242 gnome/mc.keys.in
1243 idl/Makefile
1244 src/Makefile
1245 slang/Makefile 
1246 edit/Makefile 
1247 gtkedit/Makefile 
1248 new_icons/Makefile 
1249 icons/Makefile
1251 lib/mc.ext
1252 lib/mc-gnome.ext
1254 mcfn_install
1255 vfs/extfs/ftplist vfs/extfs/uzip vfs/extfs/uzoo vfs/extfs/lslR
1256 vfs/extfs/ulha vfs/extfs/ucpio vfs/extfs/deb vfs/extfs/urar vfs/extfs/uar
1258 doc/mc.1 doc/mcedit.1 doc/mcserv.8
1260 intl/Makefile po/Makefile.in
1261 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
1263 if test x$srcdir != x; then
1264     if test $srcdir != .; then
1265         cp $srcdir/VERSION VERSION
1266         mkdir nt
1267         mkdir os2
1268         cp $srcdir/pc/Makefile nt/Makefile
1269     fi
1272 if echo "$screen_manager" | grep -q "SLang" ; then
1273     screen_manager="${screen_manager}${slang_term}"
1276 echo "
1277 Configuration:
1279   Source code location:       ${srcdir}
1280   Compiler:                   ${CC}
1281   Compiler flags:             ${CFLAGS}
1282   File system:                ${vfs_type}
1283                               ${vfs_flags}
1284   Text mode screen manager:   ${screen_manager}
1285   Install console saver:      ${install_saver}
1286   Text mode mouse library:    ${mouse_lib}
1287   Debugger code:              ${mem_debug}
1288   With subshell support:      ${subshell}
1289   X11 versions:               ${xvers}
1290   Internal editor:            ${EDIT_msg}
1291   Install path:               ${prefix}/bin, ${prefix}/lib/mc"
1292 if test -n "$xv_bindir"; then
1293 echo "  XView version install path: ${xv_bindir}"
1295 echo ""