corrected some lines too long...
[midnight-commander.git] / configure.in
blob522e0e3503f0d02b17c438682048c7da93befc76
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.41
9 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
10 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
11 AC_SUBST(VERSION)
12 AC_SUBST(PACKAGE)
13 top_srcdir=`dirname $0`
14 AC_SUBST(top_srcdir)
16 AC_CANONICAL_SYSTEM
18 dnl This is path where we're looking for headers in addition to /usr/include
19 dnl and whatever cpp defaults to.
20 include_additional_path="/usr/local/include /usr/contrib/include /opt/gnu/include"
22 dnl This sets/resets compiling with -g by default. It should be set to yes for
23 dnl development versions and set to no for release versions.
24 use_cc_g_flag=yes
26 dnl We want autoconf to check whether -g is available
27 dnl We reset it back soon.
28 CCOPTS="$CFLAGS"
29 unset CFLAGS
31 AC_PROG_MAKE_SET
32 AC_PROG_CC
33 AC_PROG_CPP
34 AC_PROG_RANLIB
35 AC_PROG_LN_S
36 AC_PROG_AWK
37 if test x"$AWK" = x; then
38     AWK=":"
39     AWK_VAR_OPTION=""
40     dep=slowdep
41 else
42     dep=fastdep
44     # test whether awk needs -v for variables (e.g. Solaris) or not (e.g. SunOs 4)
45     if test x"`echo | $AWK 'BEGIN { print variable; exit }' variable=123`" = x123; then
46         AWK_VAR_OPTION=""
47     else
48         AWK_VAR_OPTION="-v"
49     fi
51 AC_SUBST(AWK_VAR_OPTION)
52 AC_SUBST(dep)
53 AC_PROG_GNU_MAKE
55 AC_AIX
56 AC_MINIX
57 AC_ISC_POSIX
58 MC_HPUX_PROG_CC_STDC
59 AC_HEADER_MAJOR
60 AC_C_CONST
61 AC_PATH_PROG(MV, mv, mv)
62 AC_PATH_PROG(CP, cp, cp)
63 AC_PATH_PROG(RM, rm, rm)
64 AC_PATH_PROG(CHMOD, chmod, :)
65 AC_PATH_PROG(AR, ar, ar)
67 AC_CHECK_PROG(system,uname,`uname`,unknown)
68 AC_CHECK_PROGS(X11_WWW,netscape arena Mosaic chimera)
69 if test x"$X11_WWW" = x; then
70     X11_WWW=lynx
73 ALL_LINGUAS="ca cs da de el es es_ES fi fr hu it ja ko nl no pl pt_BR ro ru sv uk wa zh_TW.Big5"
75 dnl ultra ulgy hack to get MKINSTALLDIRS right
76 AM_GNU_GETTEXT
78 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
80 dnl
81 dnl This part supplies reasonable defaults for CFLAGS, if they weren't
82 dnl specified by ''CFLAGS=flags ./configure''
83 dnl
84 cc_uses_g=yes
85 if test x$GCC = xyes; then
86     if test x$ac_cv_prog_gcc_g = xyes; then
87         :
88     else
89         cc_uses_g=no
90     fi
93 dnl Debug mode is turned ON for now
94 if test "x$CCOPTS" = x; then
95     CCOPTS='-g'
98 if test "x$CCOPTS" = x; then
99     if test x$GCC = xyes; then
100         if test x$system = xLinux; then
101             CCOPTS='-O2 -fno-strength-reduce'
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         else
108             CCOPTS='-O'
109             if test x$use_cc_g_flag = xyes; then
110                 if test $cc_uses_g = yes; then
111                     CCOPTS='-g -O'
112                 fi
113             fi
114         fi
115     else
116         if test x$use_cc_g_flag = xyes; then
117             CCOPTS="$CFLAGS"
118         else
119             CCOPTS=
120         fi
121     fi
123 CFLAGS="$CCOPTS"
127 dnl We now use glib
128 dnl 
129 AM_PATH_GLIB(1.2.0,,AC_MSG_ERROR(Test for GLIB failed.  MC requires GLIB.))
130 LIBS="$LIBS $GLIB_LIBS"
131 CFLAGS="$CFLAGS $GLIB_CFLAGS"
134 dnl For A/UX.  Do not move
137 posix_libs=""
138 if test $system = A/UX
139 then
140     posix_libs="-lposix"
141     AC_DEFINE(_POSIX_SOURCE)
144 AC_PROG_INSTALL
145 AC_CHECK_HEADERS(unistd.h string.h memory.h crypt.h grp.h limits.h malloc.h)
146 AC_CHECK_HEADERS(stdlib.h termios.h utime.h fcntl.h sys/statfs.h)
148 if test x$ac_cv_header_malloc_h = xno; then
149     echo '/* NeXTStep malloc.h stub */' > $srcdir/malloc.h
152 AC_HEADER_SYS_WAIT
153 AC_HEADER_DIRENT
154 AC_SHORT_D_NAME_LEN
155 AC_HEADER_STDC
158 #Let me check for an incompatible regcomp in HP-UX before making this
159 #the default
161 REGEX_O="regex.o"
162 AC_SUBST(REGEX_O)
164 dnl Missing structure components
165 AC_STRUCT_ST_BLKSIZE
166 AC_STRUCT_ST_BLOCKS
167 AC_STRUCT_ST_RDEV
170 dnl Check availability of some functions 
171 dnl 
173 AC_CHECK_FUNCS(strerror statfs getwd strcasecmp strncasecmp)
174 AC_CHECK_FUNCS(strdup memmove pwdauth truncate initgroups putenv)
175 AC_CHECK_FUNCS(memset memcpy tcsetattr tcgetattr cfgetospeed)
176 AC_CHECK_FUNCS(sigaction sigemptyset sigprocmask sigaddset)
177 AC_CHECK_FUNCS(sysconf setuid setreuid)
180 dnl getpt is a GNU Extension (glibc 2.1.x)
182 AC_CHECK_FUNCS(getpt)
184 SHADOWLIB=
185 if test x$system = xLinux; then
186 AC_CHECK_LIB(shadow,pw_encrypt,[
187 shadow_header=no
188 AC_CHECK_HEADERS(shadow.h)
189 if test x$ac_cv_header_shadow_h = xyes; then
190     shadow_header=yes
191 else
192 AC_CHECK_HEADERS(shadow/shadow.h)
193     if test x$ac_cv_shadow_shadow_h = xyes; then
194         shadow_header=yes
195     fi
197 if test $shadow_header = yes; then
198     AC_DEFINE(LINUX_SHADOW)
199     SHADOWLIB=-lshadow
203 AC_SUBST(SHADOWLIB)
205 NEED_CRYPT_PROTOTYPE=yes
206 if test x$ac_cv_header_crypt_h = xyes; then
207 AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");],[
208 NEED_CRYPT_PROTOTYPE=no])
209 else 
210     if test x$ac_cv_header_unistd_h = xyes; then
211 AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");],[
212 NEED_CRYPT_PROTOTYPE=no])
213     fi
215 if test x$NEED_CRYPT_PROTOTYPE=xyes; then
216 AC_DEFINE(NEED_CRYPT_PROTOTYPE)
220 dnl AIX and Sequent need <sys/select.h> for fd_set
222 AC_CHECK_HEADERS(sys/select.h)
225 dnl On SCO and some SVR4, crypt is on libcrypt.a
226 dnl         grantpt in  libpt.a
228 LCRYPT=""
229 AC_CHECK_FUNCS(crypt, , [
230     AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt",[
231         AC_CHECK_LIB(crypt_i, crypt, LCRYPT="-lcrypt_i")])])
232 AC_SUBST(LCRYPT)
234 dnl This is the correct version
235 dnl AC_CHECK_FUNCS(grantpt, , AC_CHECK_LIB(pt, grantpt))
237 dnl And workaround for a Autoconf 2.4 bug:
238 AC_CHECK_FUNCS(grantpt)
239 if test x$ac_cv_func_grantpt = xyes; then
240     :
241 else
242     AC_CHECK_LIB(pt, grantpt)
246 dnl libintl.a required on SCO to provide proper NLS support
247 dnl (using native cc links it by default)
249 if test x$GCC = xyes; then
250     AC_CHECK_LIB(intl, tolower)
253 dnl replacing lstat with statlstat on sco makes it more portable between
254 dnl sco clones
255 AC_CHECK_FUNCS(statlstat)
258 dnl If running under AIX, AC_AIX does not tell us that
260 AC_MSG_CHECKING(for AIX defines)
261 AC_EGREP_CPP(yes,
262 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
264 #endif
265 ], [
266 AC_DEFINE(IS_AIX)
267 AC_MSG_RESULT(yes)
268 ], AC_MSG_RESULT(no))
270 dnl   
271 dnl This hack is here until autoconf adds it
272 dnl Needed for Unixware: getmntent is on libgen.a
274 AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
277 dnl This is from GNU fileutils, check aclocal.m4 for more information
279 AC_GET_FS_INFO
282 dnl Missing typedefs and replacements
283 dnl 
285 AC_TYPE_MODE_T
286 AC_CHECK_TYPE(umode_t, int)
287 AC_CHECK_TYPE(off_t, long)
288 AC_TYPE_PID_T
289 AC_TYPE_UID_T
290 AC_CHECK_TYPE(nlink_t, unsigned int)
292 AC_FUNC_MMAP
293 AC_FUNC_ALLOCA
296 dnl Cool hack, but we don't use it currently 
298 dnl AC_MSG_CHECKING(for token pasting method)
299 dnl AC_EGREP_CPP(portable,[
300 dnl #define tken(a, b) a##b
301 dnl tken(port, able)
302 dnl ], [AC_DEFINE(HAVE_PORTABLE_TOKEN_PASTING)
303 dnl AC_MSG_RESULT(portable)
304 dnl ], [
305 dnl AC_MSG_RESULT(non-portable)
306 dnl ])
308 AC_PATH_XTRA
311 dnl X11 support in the textmode edition. 
314 dnl These variables are only used when building the text edition MC binary
315 MCCFLAGS=""
316 MCLIBS=""
317 AC_SUBST(MCCFLAGS)
318 AC_SUBST(MCLIBS)
320 textmode_x11_support="no"
321 AC_ARG_WITH(tm-x-support,
322         [--with-tm-x-support        Add X Window System support to the text edition],
323         if test x$withval = xyes; then
324                 MCCFLAGS="$X_CFLAGS"
325                 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
326                 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT)
327                 textmode_x11_support="yes"
328         fi
332 dnl Network related functions
335 AC_CHECK_LIB(nsl, t_accept)
336 AC_CHECK_LIB(socket, socket)
338 have_socket=no
339 AC_CHECK_FUNCS(socket, have_socket=yes)
340 if test $have_socket = no; then
341   # socket is not in the default libraries.  See if it's in some other.
342   for lib in bsd socket inet; do
343     AC_CHECK_LIB($lib, socket, [
344         LIBS="$LIBS -l$lib"
345         have_socket=yes
346         AC_DEFINE(HAVE_SOCKET)
347         break])
348   done
351 have_gethostbyname=no
352 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
353 if test $have_gethostbyname = no; then
354   # gethostbyname is not in the default libraries.  See if it's in some other.
355   for lib in bsd socket inet; do
356     AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
357   done
360 AC_CHECK_FUNCS(socketpair)
363 dnl Sequent wants getprocessstats
365 AC_CHECK_LIB(seq, get_process_stats, [
366         LIBS="$LIBS -lseq"
367         AC_DEFINE(HAVE_GET_PROCESS_STATS)])
369 GNOME_VFS_CHECKS
370 NETFILES=
371 if test $have_socket = yes; then
372    NETFILES="\$(NETFILES)"
374 AC_SUBST(NETFILES)
376 LIBVFS=""
377 LVFS=""
378 fastdepvfs=""
379 vfs_type="normal"
380 if test $use_vfs = yes
381 then
382         LIBVFS="libvfs-mc.a"
383         LVFS="-lvfs-mc"
384         fastdepvfs=fastdepvfs
385         MCCPPFLAGS="$MCCPPFLAGS -I\$(vfsdir)"
386         AC_MSG_RESULT(Using the VFS switch code)
387         vfs_type="Midnight Commander Virtual File System"
389 AC_SUBST(LIBVFS)
390 AC_SUBST(LVFS)
391 AC_SUBST(fastdepvfs)
393 screen_manager=unknown
394 search_ncurses=false
396 CFLAGS=${CFLAGS--O}
397 LDFLAGS=${LDFLAGS--O}
399 AC_DEFUN(AC_USE_SUNOS_CURSES, [
400         search_ncurses=false
401         screen_manager="SunOS 4.x /usr/5include curses"
402         AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
403         AC_DEFINE(USE_SUNOS_CURSES)
404         AC_DEFINE(NO_COLOR_CURSES)
405         AC_DEFINE(USE_SYSV_CURSES)
406         CPPFLAGS="$CPPFLAGS -I/usr/5include"
407         XCURSES="xcurses.o /usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
408         AC_MSG_RESULT(Please note that some screen refreshs may fail)
409         AC_WARN(Reconsider using Slang)
412 AC_DEFUN(AC_USE_OSF1_CURSES, [
413        AC_MSG_RESULT(Using OSF1 curses)
414        search_ncurses=false
415        screen_manager="OSF1 curses"
416        AC_DEFINE(NO_COLOR_CURSES)
417        AC_DEFINE(USE_SYSV_CURSES)
418        XCURSES="xcurses.o"
419        LIBS="$LIBS -lcurses"
422 AC_DEFUN(AC_USE_SYSV_CURSES, [
423         AC_MSG_RESULT(Using SysV curses)
424         AC_DEFINE(USE_SYSV_CURSES)
425         XCURSES=""
426         search_ncurses=false
427         screen_manager="SysV/curses"
428         LIBS="$LIBS -lcurses"
431 XCURSES=""
432 AC_SUBST(XCURSES)
434 dnl AC_ARG_WITH(bsd-curses,
435 dnl [--with-bsd-curses         Used to compile with bsd curses, not very fancy],
436 dnl     search_ncurses=false
437 dnl     screen_manager="Ultrix/cursesX"
438 dnl     if test $system = ULTRIX
439 dnl     then
440 dnl         THIS_CURSES=cursesX
441 dnl        else
442 dnl         THIS_CURSES=curses
443 dnl     fi
445 dnl     LIBS="$LIBS -l$THIS_CURSES -ltermcap"
446 dnl     AC_DEFINE(USE_BSD_CURSES)
447 dnl     XCURSES="xcurses.o"
448 dnl     AC_MSG_RESULT(Please note that some screen refreshs may fail)
449 dnl     AC_WARN(Use of the bsdcurses extension has some)
450 dnl     AC_WARN(display/input problems.)
451 dnl     AC_WARN(Reconsider using xcurses)
452 dnl)
454 AC_ARG_WITH(sco,
455         [--with-sco                 Use this to turn on SCO-specific code],[
456         if test x$withval = xyes; then
457                 AC_DEFINE(SCO_FLAVOR)
458                 CFLAGS="$CFLAGS -D_SVID3"
459         fi
462 AC_ARG_WITH(sunos-curses,
463         [--with-sunos-curses        Used to force SunOS 4.x curses],[
464         if test x$withval = xyes; then
465                 AC_USE_SUNOS_CURSES
466         fi
469 AC_ARG_WITH(osf1-curses,
470         [--with-osf1-curses        Used to force OSF/1 curses],[
471         if test x$withval = xyes; then
472                 AC_USE_OSF1_CURSES
473         fi
476 AC_ARG_WITH(vcurses,
477         [--with-vcurses[=incdir]    Used to force SysV curses],
478         if test x$withval = xyes; then
479                 CPPFLAGS="$CPPFLAGS"
480         else
481                 CPPFLAGS="$CPPFLAGS -I$withval"
482         fi
483         AC_USE_SYSV_CURSES
486 mouse_lib="xterm only"
487 LGPM=""
488 AC_ARG_WITH(gpm-mouse, 
489         [--with-gpm-mouse[=base-dir]  Compile with gpm mouse support],[
490         if test x$withval != xno
491         then
492                 if test x$withval != xyes
493                 then
494                         LIBS="$LIBS -L$withval/lib"
495                         CPPFLAGS="$CPPFLAGS -I$withval/include"
496                 fi
497                 AC_DEFINE(HAVE_LIBGPM)
498                 mouse_lib="GPM and xterm"
499                 LGPM="-lgpm"
500         fi
501         ],[
502         AC_CHECK_LIB(gpm, Gpm_Repeat,[
503                 AC_DEFINE(HAVE_LIBGPM)
504                 mouse_lib="GPM and xterm"
505                 LGPM="-lgpm"],[
506                 if test $system = Linux
507                 then 
508                         AC_MSG_WARN("libgpm.a is missing or older than 0.18")
509                 fi
510                 ], $LIBS)
511         ]
513 AC_SUBST(LGPM)
515 AC_ARG_WITH(ncurses,
516         [--with-ncurses[=base-dir]    Compile with ncurses/locate base dir],
517         if test x$withval = xyes
518         then
519                 search_ncurses=true
520         else
521                 LIBS="$LIBS -L$withval/lib -lncurses"
522                 CPPFLAGS="$CPPFLAGS -I$withval/include"
523                 search_ncurses=false
524                 screen_manager="ncurses"
525                 AC_DEFINE(USE_NCURSES)
526         fi
529 AC_ARG_WITH(hsc,
530         [--with-hsc               Compile with support for the HSC firewall],
531         if test x$withval = xyes; then
532                 AC_DEFINE(HSC_PROXY)
533         fi
537 dnl Check for Gnome
539 mx=""
540 gmcdep=""
541 libgtkedit=""
543 AC_SUBST(insticons)
544 GNOME_INIT_HOOK([
545         mx=mx
546         gmcdep=gmcdep
547         libgtkedit="libgtkedit.a"
548         insticons=install_icons
549         if test x"$xvers" = xnone; then
550             xvers="Gnome"
551         else
552             xvers="Gnome+$xvers"
553         fi
554         gnomeicondir=`gnome-config --datadir`/pixmaps
556 AC_SUBST(gnomeicondir)
557 AC_SUBST(mx)
558 AC_SUBST(gmcdep)
559 AC_SUBST(libgtkedit)
560 AC_SUBST(GNOMEGNORBA_LIBS)
563 dnl Check for the -mandoc package
565 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
566 if $HAVE_nroff; then
567     AC_MSG_CHECKING(for manual formatting macros)
568     AC_CACHE_VAL(ac_cv_mandoc, [
569     nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
570     if test $? = 0
571     then
572         ac_cv_mandoc=-mandoc
573     else
574         ac_cv_mandoc=-man
575     fi
576     ])
577     MANDOC=$ac_cv_mandoc
578     AC_MSG_RESULT($MANDOC)
579 else
580     MANDOC=-man
582 AC_SUBST(MANDOC)
585 dnl Check if nroff accepts -Tlatin1 or -Tascii
587 if $HAVE_nroff; then
588     AC_MSG_CHECKING(if nroff accepts -Tlatin1 or -Tascii)
589     AC_CACHE_VAL(ac_cv_nroff_tascii, [
590     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
591     if test $? = 0
592     then
593         ac_cv_nroff_tascii=" -Tlatin1"
594         AC_MSG_RESULT(yes)
595     else
596         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
597         if test $? = 0
598         then
599             ac_cv_nroff_tascii=" -Tascii"
600             AC_MSG_RESULT(yes)
601         else
602             ac_cv_nroff_tascii=""
603             AC_MSG_RESULT(no)
604         fi
605     fi
606     ])
608 TROFFASCII="$ac_cv_nroff_tascii"
609 AC_SUBST(TROFFASCII)
612 dnl Check for - option to file
614 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
615 if $HAVE_FILECMD; then
616     AC_MSG_CHECKING(for - option to file command)
617     AC_CACHE_VAL(ac_cv_filestdin, [
618     cat > conftest.c <<EOF
619 /* A comment */
620 #if 0
621 #endif
622 void main(void)
623 { return; }
625     changequote(, )
626     cat > conftest.sed <<EOF
627 s/^[^:]*:[\ \   ]*//
628 s/[\ \  ]*$//
630     filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
631     filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
632     if test "$filehyphen_1" = "$filehyphen_2"; then
633         ac_cv_filestdin=yes
634     else
635         ac_cv_filestdin=no
636     fi
637     changequote([, ])
638     rm conftest.c conftest.sed
639     unset filehyphen_1
640     unset filehyphen_2
641     ])
643     if test x$ac_cv_filestdin = xyes; then
644         AC_DEFINE(FILE_STDIN)
645     fi
646     filestdin=$ac_cv_filestdin
647     AC_MSG_RESULT($filestdin)
649     dnl
650     dnl Check for -L option to file
651     dnl
653 AC_MSG_CHECKING(for -L option to file command)
654 AC_CACHE_VAL(ac_cv_filel, [
655 file -L . > /dev/null 2>&1
656 if test $? = 0
657 then
658     ac_cv_filel=yes
659 else
660     ac_cv_filel=no
663 if test x$ac_cv_filel = xyes; then
664     AC_DEFINE(FILE_L)
666 filel=$ac_cv_filel
667 AC_MSG_RESULT($filel)
668 fi 
671 dnl Check to see if grep program allowes dash to denote stdin 
673 AC_MSG_CHECKING(for - option to grep command)
674 AC_CACHE_VAL(ac_cv_grep_stdin, [
675     grep ac_cv_grep_stdin - > /dev/null 2>&1 < ./configure
676     if test $? = 0; then
677         ac_cv_grep_stdin=yes
678     else
679         ac_cv_grep_stdin=no
680     fi
682 if test x$ac_cv_grep_stdin = xyes; then
683     AC_DEFINE(GREP_STDIN)
685 AC_MSG_RESULT($ac_cv_grep_stdin)
688 dnl The subshell support
691 AC_MSG_CHECKING(for subshell support)
692 AC_ARG_WITH(subshell,
693         [--with-subshell            If you want to use a concurrent shell],
694         result=no
695         if test x$withval = xoptional
696         then
697                 AC_DEFINE(SUBSHELL_OPTIONAL)
698                 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
699                 result="optional"
700         fi
701         if test x$withval = xyes
702         then 
703                 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
704                 result="yes"
705         fi,
706         dnl Default: provide the subshell support on non-ultrix machines
707         if test $system = ULTRIX        
708         then
709                 result=no
710         else
711                 AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
712                 result=yes
713         fi
715 AC_MSG_RESULT($result)
716 subshell="$result"
719 dnl Check for GCC
721 if test x$GCC = x
722 then
723         AC_DEFINE(OLD_TOOLS)
724         CPPFLAGS="$CPPFLAGS"
728 dnl This option is only inteded for being used by me :-)
729 dnl It has some nasty hacks built in.
731 mem_debug="none"
732 AC_ARG_WITH(debug, 
733 [--with-debug               For use by developers only: activates -Wall and MAD],
734         [if test x$withval = xyes; then
735         CFLAGS="$CFLAGS -Wall"
736         mem_debug="Janne's MAD library"
737         AC_DEFINE(HAVE_MAD)
738         AC_DEFINE(MCDEBUG)
739         if [ echo `uname -s -r` | grep -q 'SunOS 4.1' ]
740         then
741             CFLAGS="$CFLAGS -Wno-implicit"
742         fi
743         if echo "$CFLAGS" | grep -e -g >/dev/null 2>&1; then
744                 :
745         else
746             if test $cc_uses_g = yes; then
747                 CFLAGS="$CFLAGS -g"
748             fi
749         fi
750         AC_MSG_RESULT(compiling with -Wall and the memory leak detector)
751 fi])
754 dnl This option is only inteded for being used by me :-)
755 dnl It has some nasty hacks built in.
757 AC_ARG_WITH(efence, 
758 [--with-efence              Developers only: activates -Wall and efence],
759         [if test x$withval = xyes; then
760         CFLAGS="$CFLAGS -Wall"
761         AC_DEFINE(MCDEBUG)
762         LIBS="$LIBS -lefence"
763         if [ echo `uname -s -r` | grep -q 'SunOS 4.1' ]
764         then
765             CFLAGS="$CFLAGS -Wno-implicit"
766         fi
767         if echo "$CFLAGS" | grep -e -g >/dev/null 2>&1; then
768                 :
769         else
770             if test $cc_uses_g = yes; then
771                 CFLAGS="$CFLAGS -g"
772             fi
773         fi
774         AC_MSG_RESULT(compiling with -Wall and Electric fence)
775         mem_debug="Electric Fence"
776 fi])
778 INTLSUB=""
779 LINTL=""
780 if test x$USE_NLS = xyes; then
781     if test x$USE_INCLUDED_LIBINTL = xyes; then
782         CPPFLAGS="$CPPFLAGS -I\$(builddir)/intl"
783         LINTL="-L\$(builddir)/intl -lintl"
784     fi
785     INTLSUB=intl
787 AC_SUBST(INTLSUB)
788 AC_SUBST(LINTL)
791 dnl To force mmap support
792 dnl We use only part of the functionality of mmap, so on AIX,
793 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
795 AC_ARG_WITH(mmap, 
796         [--with-mmap                To force using the mmap call (AIX)],
797         [if test x$withval = xyes; then
798         AC_DEFINE(HAVE_MMAP)
799         AC_MSG_RESULT(forcing MMAP support)
800 fi])
802 AC_DEFUN(AC_USE_TERMINFO,
803         AC_DEFINE(SLANG_TERMINFO)
804         AC_MSG_RESULT(Using SLang screen manager/terminfo)
805         slang_term=" with terminfo"
808 AC_DEFUN(AC_USE_TERMCAP,
809         AC_MSG_RESULT(Using SLang screen manager/termcap)
810         AC_DEFINE(USE_TERMCAP)
811         dnl Check with $LIBS at the end so that it works with ELF libs.
812         AC_CHECK_LIB(termcap, tgoto, LIBS="$LIBS -ltermcap", , $LIBS)
813         slang_term=" with termcap"
815         
816 slang_check_lib=true
817 slang_term=""
818 slang_use_system_installed_lib=false
819 AC_CHECK_LIB(slang,SLang_init_tty,
820         AC_CHECK_HEADERS(slang.h)
821         if test x$ac_cv_header_slang_h = xyes
822         then
823              slang_use_system_installed_lib=true
824              slang_check_lib=false
825         else
826              AC_CHECK_HEADERS(slang/slang.h)
827              if test x$ac_cv_header_slang_slang_h = xyes
828              then
829                  slang_use_system_installed_lib=true
830                  slang_check_lib=false
831                  AC_DEFINE(SLANG_H_INSIDE_SLANG_DIR)
832              fi
833         fi
836 AC_ARG_WITH(terminfo,
837         [--with-terminfo            SLANG: Force usage of terminfo],[
838         if test x$withval = xyes; then
839                 AC_USE_TERMINFO
840                 slang_check_lib=false
841                 slang_use_system_installed_lib=false
842         fi]
845 AC_ARG_WITH(termcap,
846         [--with-termcap             SLANG: Force usage of termcap],[
847         if test x$withval = xyes; then
848                 AC_USE_TERMCAP
849                 slang_check_lib=false
850                 slang_use_system_installed_lib=false
851         fi]
854 AC_ARG_WITH(included-slang,
855         [--with-included-slang      SLANG: use the SLang library included here],[
856         if test x$withval = xyes; then
857             slang_use_system_installed_lib=false
858             slang_check_lib=true
859         fi]
862 AC_DEFUN(AC_WITH_SLANG,[
863         AC_DEFINE(HAVE_SLANG)
864         search_ncurses=false
865         if $slang_use_system_installed_lib
866         then
867             AC_DEFINE(HAVE_SYSTEM_SLANG)
868             LSLANG="-lslang"
869             screen_manager="SLang (system-installed library)"
870             AC_MSG_RESULT(Using system installed SLang library)
871             rm -f slang/slang.h
872             ac_save_LIBS="$LIBS"
873             LIBS="$LIBS $LSLANG"
874             AC_TRY_RUN(
875             [ 
876             #ifdef SLANG_H_INSIDE_SLANG_DIR
877             #include <slang/slang.h>
878             #else
879             #include <slang.h>
880             #endif
881             int main(void){
882                 SLtt_get_terminfo();
883                 SLtt_tgetflag("");
884                 return 0;
885             } ], 
886             [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO], 
887             [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
888         else
889             MCCPPFLAGS="$MCCPPFLAGS -I\$(slangdir)"
890             LIBSLANG="libmcslang.a"
891             screen_manager="SLang"
892             LSLANG="-lmcslang"
893             CPPFLAGS="$CPPFLAGS -I../slang"
894             fastdepslang=fastdepslang
895             mkdir -p slang
896             rm -f slang/slang.h
897             case "$srcdir" in
898                 /*) ln -sf  $srcdir/slang/slang-mc.h slang/slang.h;;
899                 *)  ln -sf  ../$srcdir/slang/slang-mc.h slang/slang.h;;
900             esac
901         fi
902         if $slang_check_lib
903         then
904             use_terminfo=false
905             for dir in  /usr/lib /usr/share/lib /usr/local/lib /lib \
906                         /usr/local/share /usr/share
907             do
908                 if test -d $dir/terminfo; then
909                 use_terminfo=true; 
910                 break
911                 fi
912             done
913             if $use_terminfo; then
914                 AC_USE_TERMINFO
915             else
916                 AC_USE_TERMCAP
917             fi
918         fi]
921 LIBSLANG=""
922 LSLANG=""
923 fastdepslang=""
924 AC_ARG_WITH(slang,
925         [--with-slang              Compile with the slang screen manager],[
926         if test x$withval = xyes; then
927                 AC_WITH_SLANG
928         fi
931 AC_SUBST(LIBSLANG)
932 AC_SUBST(LSLANG)
933 AC_SUBST(fastdepslang)
935 AC_DEFUN(AC_WITH_EDIT, [
936         AC_DEFINE(USE_INTERNAL_EDIT)
937         LIBEDIT_A="libedit.a"
938         MCEDIT="mcedit"
939         LEDIT="-ledit"
940         CPPFLAGS="$CPPFLAGS -I\$(rootdir)"
941         EDIT_msg="yes"
942         AC_MSG_RESULT(will call internal editor)
945 LIBEDIT_A=""
946 MCEDIT=""
947 LEDIT=""
948 EDIT_msg=""
949 AC_ARG_WITH(edit,
950         [--with-edit                Define INTERNAL_EDIT],
951         if test x$withval = xyes
952         then
953                 AC_WITH_EDIT
954         else
955                 EDIT_msg="no"
956         fi, 
957         dnl Default: provide the internal editor
958         AC_WITH_EDIT
960 AC_SUBST(LIBEDIT_A)
961 AC_SUBST(MCEDIT)
962 AC_SUBST(LEDIT)
964 AC_ARG_WITH(netrc,
965         [--with-netrc               Compile with ftp .netrc support],[
966         if test x$withval = xyes; then
967                 AC_DEFINE(USE_NETRC)
968                 AC_MSG_RESULT(ftpfs will have .netrc parsing code)
969         fi
972 undelfs_o=""
973 AC_DEFUN(AC_EXT2_UNDEL, [
974   GNOME_UNDELFS_CHECKS
975   if test "$ext2fs_undel" = yes; then
976      AC_MSG_RESULT(With ext2fs file recovery code)
977      vfs_flags="${vfs_flags}, undelfs"
978      undelfs_o="undelfs.o"
979      LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
980   else
981      AC_MSG_WARN(No ext2fs file recovery code)
982   fi
985 AC_ARG_WITH(ext2undel,
986         [--with-ext2undel           Compile with ext2 undelete code],[
987         if test x$withval != xno;
988         then
989                 if test x$withval != xyes
990                 then
991                         LIBS="$LIBS -L$withval/lib"
992                         CPPFLAGS="$CPPFLAGS -I$withval/include"
993                 fi
994                 AC_EXT2_UNDEL
995         fi],
996         dnl Default: detect
997         AC_CHECK_LIB(ext2fs, ext2fs_close, AC_EXT2_UNDEL,,-lcom_err)
1000 AC_SUBST(undelfs_o)
1001         
1003 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
1005 AC_DEFUN(AC_NCURSES, [
1006     if $search_ncurses
1007     then
1008         if test -f $1/$2
1009         then
1010             AC_MSG_RESULT(Found ncurses on $1/$2)
1011             LIBS="$LIBS $3"
1012             CPPFLAGS="$CPPFLAGS $4"
1013             search_ncurses=false
1014             screen_manager=$5
1015             AC_DEFINE(USE_NCURSES)
1016         fi
1017     fi
1020 if $search_ncurses
1021 then
1022     AC_CHECKING("location of ncurses.h file")
1024     AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
1025     AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
1026     AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
1027     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")
1029     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")
1031     AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
1033     dnl
1034     dnl We couldn't find ncurses, try SysV curses
1035     dnl
1036     if $search_ncurses 
1037     then
1038         AC_EGREP_HEADER(init_color, /usr/include/curses.h,
1039             AC_USE_SYSV_CURSES)
1040         AC_EGREP_CPP(USE_NCURSES,[
1041 #include <curses.h>
1042 #ifdef __NCURSES_H
1043 #undef USE_NCURSES
1044 USE_NCURSES
1045 #endif
1047         CPPFLAGS="$CPPFLAGS -DRENAMED_NCURSES"
1048         AC_DEFINE(USE_NCURSES)
1049         search_ncurses=false
1050         screen_manager="ncurses installed as curses"
1052     fi
1054     dnl
1055     dnl Try SunOS 4.x /usr/5{lib,include} ncurses
1056     dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
1057     dnl should be replaced by a more fine grained selection routine
1058     dnl
1059     if $search_ncurses
1060     then
1061         if test -f /usr/5include/curses.h
1062         then
1063             AC_USE_SUNOS_CURSES
1064         fi
1065     else
1066         # check for ncurses version, to properly ifdef mouse-fix
1067         AC_MSG_CHECKING(for ncurses version)
1068         ncurses_version=unknown
1069 cat > conftest.$ac_ext <<EOF
1070 [#]line __oline__ "configure"
1071 #include "confdefs.h"
1072 #ifdef RENAMED_NCURSES
1073 #include <curses.h>
1074 #else
1075 #include <ncurses.h>
1076 #endif
1077 #undef VERSION
1078 VERSION:NCURSES_VERSION
1080         if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
1081   egrep "VERSION:" >conftest.out 2>&1; then
1082 changequote(,)dnl
1083             ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
1084 changequote([,])dnl
1085         fi
1086         rm -rf conftext*
1087         AC_MSG_RESULT($ncurses_version)
1088         case "$ncurses_version" in
1089 changequote(,)dnl
1090         4.[01])
1091 changequote([,])dnl
1092             AC_DEFINE(NCURSES_970530,2)
1093             ;;
1094         1.9.9g)
1095             AC_DEFINE(NCURSES_970530,1)
1096             ;;
1097         1*)
1098             AC_DEFINE(NCURSES_970530,0)
1099             ;;
1100         esac
1101     fi
1104 dnl Ncurses may be linked against libgpm. Change LIBS temporary for
1105 dnl check for resizeterm and keyok.
1107 SAVED_LIBS="$LIBS"
1108 LIBS="$LIBS $LGPM"
1109 AC_CHECK_FUNCS(resizeterm keyok)
1110 LIBS="$SAVED_LIBS"
1112 if test "x$screen_manager" = "xunknown"; then
1113     AC_WITH_SLANG
1117 dnl The variables used for expanding the auto saver.
1119 saver=""
1120 saver_target=""
1121 vcs=""
1122 install_saver="no"
1123 PAMLIBS=""
1124 if test $system = Linux
1125 then
1126     saver="install.saver"
1127     saver_target="cons.saver"
1128     vcs="install.create_vcs"
1129     install_saver="yes"
1131     dnl
1132     dnl On Linux, check for PAM authentication available
1133     dnl
1134     AC_CHECK_LIB(pam, pam_start, [
1135         AC_DEFINE(HAVE_PAM)
1136         PAMLIBS="-lpam -ldl"
1137     ],[],[-ldl])
1140 AC_SUBST(saver_target)
1141 AC_SUBST(saver)
1142 AC_SUBST(vcs)
1143 AC_SUBST(PAMLIBS)
1146 dnl We need sed in order to fix the library files 
1148     SEDCMD="sed 's/-man/$MANDOC/'"
1149     SEDCMD2="sed 's%@prefix@%\$(prefix)%'"
1150 AC_SUBST(SEDCMD)
1151 AC_SUBST(SEDCMD2)
1153 if test x$no_xview = xyes; then
1154     :
1155 else
1156     AC_LIB_XPM
1157     if test x$ac_cv_has_xpm = xyes; then
1158         XPM_LIB=-lXpm
1159         AC_SUBST(XPM_LIB)
1160         AC_X_SHAPE_EXTENSION
1161         if test x$ac_cv_has_shape = xyes; then
1162             AC_DEFINE(HAVE_XPM_SHAPE)
1163             XEXT_LIB=-lXext
1164             AC_SUBST(XEXT_LIB)
1165         fi
1166     fi
1171 dnl This code should be moved to the ac_WITH_SLANG
1173 dnl We check for the existance of setupterm on curses library
1174 dnl this is required to load certain definitions on some termcaps
1175 dnl editions (AIX and OSF/1 I seem to remember).
1176 dnl Note that we avoid using setupterm 
1177 case $screen_manager in
1178 changequote(,)dnl
1179         [Ss][Ll][Aa][Nn][Gg]*)
1180 changequote([, ])dnl
1181                 if test $system = Linux
1182                 then
1183                         echo
1184                 else
1185                 AC_CHECK_LIB(curses,setupterm,[
1186                         AC_TRY_COMPILE([
1187 #include <curses.h>
1188 #include <term.h>],[
1189    if (key_end == parm_insert_line)
1190         return 1;
1191    return 0;
1193                         LIBS="$LIBS -lcurses"
1194                         AC_DEFINE(USE_SETUPTERM)])])
1195                 fi
1196                 ;;
1197 esac
1199 LIBS="$LIBS $posix_libs"
1201 CPPFLAGS="-I.. $CPPFLAGS"
1202 AC_SUBST(CFLAGS)
1203 AC_SUBST(CPPFLAGS)
1204 AC_SUBST(MCCPPFLAGS)
1205 AC_SUBST(LDFLAGS)
1206 AC_SUBST(LIBS)
1208 ac_cv_make_with_percent_rules=no
1209 if test x$ac_cv_prog_gnu_make = xyes; then
1210     MCFG='include ../Make.common'
1211     MCFGR='include ./Make.common'
1212     MCF=/dev/null
1213     PHONY='.PHONY:'
1214     DOTDEPEND='ifeq (.depend,$(wildcard .depend)) \
1215 include .depend \
1216 endif'
1217     WRITEDEP=":"
1218     ac_cv_make_with_percent_rules=yes
1219 else
1220     MCFG=""
1221     MCFGR=""
1222     MCF=./Make.common
1223     PHONY='#'
1224     DOTDEPEND=""
1225     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'
1227 AC_SUBST(PHONY)
1228 AC_SUBST(WRITEDEP)
1229 AC_SUBST(MCFG)
1230 AC_SUBST(MCFGR)
1231 AC_SUBST(DOTDEPEND)
1232 AC_SUBST_FILE(MCF)
1234 if test x$ac_cv_make_with_percent_rules = xyes; then
1235     PCENTRULE=""
1236 else
1237     PCENTRULE="#"
1239 AC_SUBST(PCENTRULE)
1241 AC_SUBST(builddir)
1242 builddir=`pwd`
1244 SHELL=${SHELL-"/bin/sh"}
1245 AC_SUBST(SHELL)
1248 dnl Output configuration filesn
1251 AC_CONFIG_SUBDIRS(vfs/samba)
1253 AC_OUTPUT([
1254 Make.common 
1255 Makefile 
1256 mc.spec
1257 VERSION
1258 doc/Makefile 
1259 doc-gnome/Makefile
1260 doc-gnome/C/Makefile
1261 vfs/Makefile:vfs/Make-mc.in
1262 lib/Makefile
1263 gnome/Makefile 
1264 gnome/mc.keys.in
1265 idl/Makefile
1266 src/Makefile
1267 slang/Makefile 
1268 edit/Makefile 
1269 gtkedit/Makefile 
1270 syntax/Makefile
1271 new_icons/Makefile 
1272 icons/Makefile
1274 lib/mc.ext
1275 lib/mc-gnome.ext
1276 lib/mc.sh
1277 lib/mc.csh
1279 mcfn_install
1280 vfs/extfs/ftplist vfs/extfs/uzip vfs/extfs/uzoo vfs/extfs/lslR vfs/extfs/ulha 
1281 vfs/extfs/uha vfs/extfs/ucpio vfs/extfs/deb vfs/extfs/urar vfs/extfs/uar
1283 doc/mc.1 doc/mcedit.1 doc/mcserv.8
1285 intl/Makefile po/Makefile.in
1286 ],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
1288 if test x$srcdir != x; then
1289     if test $srcdir != .; then
1290         mkdir nt
1291         mkdir os2
1292         cp $srcdir/pc/Makefile nt/Makefile
1293     fi
1296 if echo "$screen_manager" | grep -q "SLang" ; then
1297     screen_manager="${screen_manager}${slang_term}"
1300 echo "
1301 Configuration:
1303   Source code location:       ${srcdir}
1304   Compiler:                   ${CC}
1305   Compiler flags:             ${CFLAGS}
1306   File system:                ${vfs_type}
1307                               ${vfs_flags}
1308   Text mode screen manager:   ${screen_manager}
1309   Install console saver:      ${install_saver}
1310   Text mode mouse library:    ${mouse_lib}
1311   Text mode X11 support:      ${textmode_x11_support}
1312   Debugger code:              ${mem_debug}
1313   With subshell support:      ${subshell}
1314   X11 versions:               ${xvers}
1315   Internal editor:            ${EDIT_msg}
1316   Install path:               ${prefix}/bin, ${prefix}/lib/mc"
1317 if test -n "$xv_bindir"; then
1318 echo "  XView version install path: ${xv_bindir}"
1320 echo ""