Browse Source

Now possible to compile mc in different cases: as mc maintainer or as end-user.

Some debug-related code will compile just in mainteiner mode.
Also, added new parameter for configure script: --enable-werror

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Slava Zanko 15 years ago
parent
commit
2a4075d246
3 changed files with 27 additions and 5 deletions
  1. 12 3
      configure.ac
  2. 11 2
      src/Makefile.am
  3. 4 0
      src/global.h

+ 12 - 3
configure.ac

@@ -518,14 +518,22 @@ fi
 MC_CHECK_CFLAGS
 
 CFLAGS_OPTS=" -O2 "
-CFLAGS_EXTRA=""
 
 if test x$USE_MAINTAINER_MODE = xyes; then
-    CFLAGS_EXTRA="-Werror"
     CFLAGS_OPTS="-g3 -O -ggdb"
+    AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
 fi
 
-CFLAGS="$CFLAGS $mc_configured_cflags $CFLAGS_OPTS $CFLAGS_EXTRA"
+AC_ARG_ENABLE(
+    [werror],
+    AC_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors] )
+)
+
+if test "x$enable_werror" = xyes; then
+    MC_CHECK_ONE_CFLAG([-Werror])
+fi
+
+CFLAGS="$CFLAGS $mc_configured_cflags $CFLAGS_OPTS"
 
 AC_SUBST(CFLAGS)
 AC_SUBST(CPPFLAGS)
@@ -543,6 +551,7 @@ if test -n "$use_smbfs"; then
   AC_CONFIG_SUBDIRS([vfs/samba])
 fi
 
+AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
 AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
 AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes])

+ 11 - 2
src/Makefile.am

@@ -39,6 +39,13 @@ VFSLIB = ../vfs/libvfs-mc.a
 endif
 endif
 
+if USE_MAINTAINER_MODE
+    MAINTAINER_sources=logging.c logging.h
+endif
+
+
+
+
 MCCONFIGLIB = mcconfig/libmcconfig.la
 SEARCHLIB = search/libsearch.la
 TTYLIB =  tty/libmctty.la
@@ -52,7 +59,9 @@ mc_LDADD = $(EDITLIB) $(VFSLIB) $(FILEHIGHLIGHTLIB) $(SKINLIB) \
 
 CHARSET_SRC = charsets.c charsets.h selcodepage.c selcodepage.h
 
-SRCS =	args.c args.h achown.c achown.h background.c background.h	\
+SRCS = \
+	$(MAINTAINER_sources) \
+	args.c args.h achown.c achown.h background.c background.h	\
 	boxes.c boxes.h chmod.c chmod.h chown.c chown.h cmd.c cmd.h	\
 	command.c command.h complete.c cons.handler.c			\
 	cons.saver.h dialog.c dialog.h dir.c dir.h			\
@@ -62,7 +71,7 @@ SRCS =	args.c args.h achown.c achown.h background.c background.h	\
 	glibcompat.c glibcompat.h global.h help.c help.h hotlist.c	\
 	hotlist.h info.c info.h layout.c				\
 	layout.h learn.c learn.h listmode.c listmode.h history.h	\
-	logging.h logging.c main.c main.h main-widgets.h		\
+	 main.c main.h main-widgets.h		\
 	menu.c menu.h mountlist.c mountlist.h				\
 	option.c option.h panel.h panelize.c panelize.h screen.c	\
 	setup.c setup.h  subshell.c subshell.h textconf.c textconf.h	\

+ 4 - 0
src/global.h

@@ -99,6 +99,10 @@
 #include "fs.h"
 #include "util.h"
 
+#ifdef USE_MAINTAINER_MODE
+#include "../src/logging.h"
+#endif
+
 #include "textconf.h"
 
 #ifdef USE_VFS