[asterisk-commits] branch group/autoconf_and_menuselect r18483 - in /team/group/autoconf_and_men...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Apr 8 09:55:12 MST 2006


Author: kpfleming
Date: Sat Apr  8 11:55:10 2006
New Revision: 18483

URL: http://svn.digium.com/view/asterisk?rev=18483&view=rev
Log:
teach menuselect tool about conflicts in addition to dependencies
add simple Win32/Cygwin conflict output from configure script
teach menuselect tool to handle multiple input files

Modified:
    team/group/autoconf_and_menuselect/Makefile
    team/group/autoconf_and_menuselect/bootstrap.sh
    team/group/autoconf_and_menuselect/build_tools/menuselect-deps.in
    team/group/autoconf_and_menuselect/build_tools/menuselect.c
    team/group/autoconf_and_menuselect/configure.ac
    team/group/autoconf_and_menuselect/res/Makefile
    team/group/autoconf_and_menuselect/res/res_musiconhold.c

Modified: team/group/autoconf_and_menuselect/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/Makefile?rev=18483&r1=18482&r2=18483&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/Makefile (original)
+++ team/group/autoconf_and_menuselect/Makefile Sat Apr  8 11:55:10 2006
@@ -49,7 +49,7 @@
 # Remember the MAKELEVEL at the top
 MAKETOPLEVEL?=$(MAKELEVEL)
 
-ifneq ($(findstring dont-optimize,$(MAKECMDGOALS)),dont-optimize)
+ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),)
 # More GSM codec optimization
 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
 # which support MMX instructions.  This should be newer pentiums,
@@ -318,7 +318,7 @@
 
 LIBEDIT=editline/libedit.a
 
-ASTERISKVERSION=$(shell build_tools/make_version .)
+ASTERISKVERSION:=$(shell build_tools/make_version .)
 
 ifneq ($(wildcard .version),)
   ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
@@ -343,7 +343,7 @@
 ASTCFLAGS+= $(MALLOC_DEBUG)
 ASTCFLAGS+= $(BUSYDETECT)
 ASTCFLAGS+= $(OPTIONS)
-ifneq ($(findstring dont-optimize,$(MAKECMDGOALS)),dont-optimize)
+ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),)
 ASTCFLAGS+= -fomit-frame-pointer 
 endif
 
@@ -469,16 +469,14 @@
 all: TAGS
 endif
 
-noclean: depend asterisk subdirs
-
 editline/config.h:
 	cd editline && unset CFLAGS LIBS && ./configure ; \
 
-editline/libedit.a: FORCE
+editline/libedit.a:
 	cd editline && unset CFLAGS LIBS && test -f config.h || ./configure
 	$(MAKE) -C editline libedit.a
 
-db1-ast/libdb1.a: FORCE
+db1-ast/libdb1.a:
 	$(MAKE) -C db1-ast libdb1.a
 
 ifneq ($(wildcard .depend),)
@@ -521,21 +519,21 @@
 asterisk.txt: asterisk.sgml
 	docbook2txt asterisk.sgml
 
-defaults.h: FORCE
+defaults.h:
 	build_tools/make_defaults_h > $@.tmp
 	if cmp -s $@.tmp $@ ; then echo ; else \
 		mv $@.tmp $@ ; \
 	fi
 	rm -f $@.tmp
 
-include/asterisk/version.h: FORCE
+include/asterisk/version.h:
 	build_tools/make_version_h > $@.tmp
 	if cmp -s $@.tmp $@ ; then echo; else \
 		mv $@.tmp $@ ; \
 	fi
 	rm -f $@.tmp
 
-stdtime/libtime.a: FORCE
+stdtime/libtime.a:
 	$(MAKE) -C stdtime libtime.a
 
 cygwin_a:
@@ -946,7 +944,6 @@
 # If the cleancount has been changed, force a make clean.
 # .cleancount is the global clean count, and .lastclean is the 
 # last clean count we had
-# We can avoid this by making noclean
 
 cleantest:
 	if cmp -s .cleancount .lastclean ; then echo ; else \
@@ -986,7 +983,7 @@
 	rm -rf $(DESTDIR)$(ASTLOGDIR)
 
 menuselect: build_tools/menuselect makeopts.xml
-	- at ./build_tools/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
+	- at build_tools/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
 
 build_tools/menuselect: mxml/libmxml.a
 	$(MAKE) -C build_tools menuselect

Modified: team/group/autoconf_and_menuselect/bootstrap.sh
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/bootstrap.sh?rev=18483&r1=18482&r2=18483&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/bootstrap.sh (original)
+++ team/group/autoconf_and_menuselect/bootstrap.sh Sat Apr  8 11:55:10 2006
@@ -4,4 +4,3 @@
 autoconf
 echo "Ignore the errors generated by the next command!"
 automake --add-missing --copy
-./configure

Modified: team/group/autoconf_and_menuselect/build_tools/menuselect-deps.in
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/build_tools/menuselect-deps.in?rev=18483&r1=18482&r2=18483&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/build_tools/menuselect-deps.in (original)
+++ team/group/autoconf_and_menuselect/build_tools/menuselect-deps.in Sat Apr  8 11:55:10 2006
@@ -22,3 +22,4 @@
 VPBAPI=@PBX_LIBvpb@
 ZAPTEL=@PBX_LIBtonezone@
 OGG=@PBX_LIBogg@
+WIN32=@OSISWIN32@

Modified: team/group/autoconf_and_menuselect/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/build_tools/menuselect.c?rev=18483&r1=18482&r2=18483&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/build_tools/menuselect.c (original)
+++ team/group/autoconf_and_menuselect/build_tools/menuselect.c Sat Apr  8 11:55:10 2006
@@ -41,7 +41,7 @@
 
 #define PAGE_OFFSET	10
 
-/* #define MENUSELECT_DEBUG */
+#undef MENUSELECT_DEBUG
 
 /*!
    The member and category structures are used to maintain our own list of all
@@ -62,6 +62,13 @@
 	AST_LIST_ENTRY(depend) list;
 };
 
+struct conflict {
+	/*! the name of the conflict */
+	const char *name;
+	/*! for linking */
+	AST_LIST_ENTRY(conflict) list;
+};
+
 struct member {
 	/*! What will be sent to the makeopts file */
 	const char *name;
@@ -69,8 +76,12 @@
 	int enabled;
 	/*! This module has failed dependencies */
 	int depsfailed;
+	/*! This module has failed conflicts */
+	int conflictsfailed;
 	/*! dependencies of this module */
 	AST_LIST_HEAD_NOLOCK(, depend) deps;
+	/*! conflicts of this module */
+	AST_LIST_HEAD_NOLOCK(, conflict) conflicts;
 	/*! for making a list of modules */
 	AST_LIST_ENTRY(member) list;
 };
@@ -109,7 +120,7 @@
 	AST_LIST_ENTRY(tree) list;
 };
 
-/*! The list of trees from maketops.xml files */
+/*! The list of trees from makeopts.xml files */
 AST_LIST_HEAD_NOLOCK_STATIC(trees, tree);
 
 /*! Maximum number of characters horizontally */
@@ -199,6 +210,7 @@
 	struct tree *tree;
 	struct member *mem;
 	struct depend *dep;
+	struct conflict *cnf;
 	mxml_node_t *cur;
 	mxml_node_t *cur2;
 	mxml_node_t *cur3;
@@ -283,6 +295,19 @@
 					free(dep);
 			}
 
+			for (cur3 = mxmlFindElement(cur2, cur2, "conflict", NULL, NULL, MXML_DESCEND);
+			     cur3 && cur3->child;
+			     cur3 = mxmlFindElement(cur3, cur2, "conflict", NULL, NULL, MXML_DESCEND))
+			{
+				if (!(cnf = my_calloc(1, sizeof(*cnf))))
+					return -1;
+				if (!strlen_zero(cur3->child->value.opaque)) {
+					cnf->name = cur3->child->value.opaque;
+					AST_LIST_INSERT_HEAD(&mem->conflicts, cnf, list);
+				} else
+					free(cnf);
+			}
+
 			if (add_member(mem, cat))
 				free(mem);
 		}
@@ -299,6 +324,7 @@
 	struct category *cat;
 	struct member *mem;
 	struct depend *dep;
+	struct conflict *cnf;
 	FILE *f;
 	struct dep_file {
 		char name[32];
@@ -316,8 +342,7 @@
 	}
 
 	/* Build a dependency list from the file generated by configure */	
-	memset(buf, 0, sizeof(buf));
-	while (fgets(buf, sizeof(buf), f)) {
+	while (memset(buf, 0, sizeof(buf)), fgets(buf, sizeof(buf), f)) {
 		p = buf;
 		strsep(&p, "=");
 		if (!p)
@@ -325,9 +350,8 @@
 		if (!(dep_file = my_calloc(1, sizeof(*dep_file))))
 			break;
 		strncpy(dep_file->name, buf, sizeof(dep_file->name) - 1);
-		dep_file->met = !strcmp(p, "1");
+		dep_file->met = atoi(p);
 		AST_LIST_INSERT_TAIL(&deps_file, dep_file, list);
-		memset(buf, 0, sizeof(buf));
 	}
 
 	fclose(f);
@@ -364,13 +388,43 @@
 		}
 	}
 
+	/* Process conflicts of all modules */
+	AST_LIST_TRAVERSE(&categories, cat, list) {
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) {
+				mem->conflictsfailed = 0;
+				AST_LIST_TRAVERSE(&deps_file, dep_file, list) {
+					if (!strcasecmp(dep_file->name, cnf->name)) {
+						if (dep_file->met)
+							mem->conflictsfailed = 1;
+						break;
+					}
+				}
+				if (mem->conflictsfailed)
+					break; /* This conflict was found, so we can stop now */
+			}
+			if (mem->conflictsfailed) {
+				if (check_deps && existing_config && mem->enabled) {
+					/* Config already existed, but this module was not disabled.
+					 * However, according to our current list of conflicts that
+					 * exist, this can not be built. */
+					res = -1;
+					fprintf(stderr, "\nThe existing menuselect.makeopts did not specify that %s should not be built\n", mem->name);
+					fprintf(stderr, "However, menuselect-deps indicates that conflicts for this module exist.\n");
+					fprintf(stderr, "So, either remove the existing menuselect.makeopts file, or run\n");
+					fprintf(stderr, "'make menuselect' to generate a file that is correct.\n\n");
+					goto deps_file_free;
+				}
+				mem->enabled = 0; /* Automatically disable it if conflicts exist */
+			}
+		}
+	}
+
 deps_file_free:
 
 	/* Free the dependency list we built from the file */
-	AST_LIST_TRAVERSE_SAFE_BEGIN(&deps_file, dep_file, list) {
+	while (dep_file = AST_LIST_REMOVE_HEAD(&deps_file, list))
 		free(dep_file);
-	}
-	AST_LIST_TRAVERSE_SAFE_END
 
 	return res;
 }
@@ -426,7 +480,7 @@
 			break;
 	}
 
-	if (mem && !mem->depsfailed) {
+	if (mem && !(mem->depsfailed || mem->conflictsfailed)) {
 		mem->enabled = !mem->enabled;
 		if (cat->force_clean_on_change)
 			force_clean = 1;
@@ -434,17 +488,17 @@
 }
 
 /*! \brief Parse an existing output makeopts file and enable members previously selected */
-void parse_existing_config(void)
+void parse_existing_config(const char *infile)
 {
 	FILE *f;
 	char buf[2048];
 	char *category, *parse, *member;
 	int lineno = 0;
 
-	if (!(f = fopen(output_makeopts, "r"))) {
+	if (!(f = fopen(infile, "r"))) {
 #ifdef MENUSELECT_DEBUG
 		/* This isn't really an error, so only print the message in debug mode */
-		fprintf(stderr, "Unable to open '%s' for reading exisiting config.\n", output_makeopts);
+		fprintf(stderr, "Unable to open '%s' for reading existing config.\n", infile);
 #endif	
 		return;
 	}
@@ -498,8 +552,8 @@
 	AST_LIST_TRAVERSE(&categories, cat, list) {
 		fprintf(f, "%s=", cat->name);
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
-			if ( (!cat->positive_output && (!mem->enabled || mem->depsfailed)) 
-				|| (cat->positive_output && mem->enabled && !mem->depsfailed) )
+			if ((!cat->positive_output && (!mem->enabled || mem->depsfailed || mem->conflictsfailed)) ||
+			    (cat->positive_output && mem->enabled && !mem->depsfailed && !mem->conflictsfailed))
 				fprintf(f, "%s ", mem->name);
 		}
 		fprintf(f, "\n");
@@ -517,6 +571,7 @@
 	struct category *cat;
 	struct member *mem;
 	struct depend *dep;
+	struct conflict *cnf;
 
 	AST_LIST_TRAVERSE(&categories, cat, list) {
 		fprintf(stderr, "Category: '%s'\n", cat->name);
@@ -526,6 +581,10 @@
 				fprintf(stderr, "      --> Depends on: '%s'\n", dep->name);
 			if (!AST_LIST_EMPTY(&mem->deps))
 				fprintf(stderr, "      --> Dependencies Met: %s\n", mem->depsfailed ? "No" : "Yes");	
+			AST_LIST_TRAVERSE(&mem->conflicts, cnf, list)
+				fprintf(stderr, "      --> Conflicts with: '%s'\n", cnf->name);
+			if (!AST_LIST_EMPTY(&mem->conflicts))
+				fprintf(stderr, "      --> Conflicts Found: %s\n", mem->conflictsfailed ? "Yes" : "No");
 		}
 	}
 }
@@ -536,15 +595,19 @@
 {
 	struct category *cat;
 	struct member *mem;
-
-	AST_LIST_TRAVERSE_SAFE_BEGIN(&categories, cat, list) {
-		AST_LIST_TRAVERSE_SAFE_BEGIN(&cat->members, mem, list) {
+	struct depend *dep;
+	struct conflict *cnf;
+
+	while (cat = AST_LIST_REMOVE_HEAD(&categories, list)) {
+		while (mem = AST_LIST_REMOVE_HEAD(&cat->members, list)) {
+			while (dep = AST_LIST_REMOVE_HEAD(&mem->deps, list))
+				free(dep);
+			while (cnf = AST_LIST_REMOVE_HEAD(&mem->conflicts, list))
+				free(cnf);
 			free(mem);
 		}
-		AST_LIST_TRAVERSE_SAFE_END
 		free(cat);
 	}
-	AST_LIST_TRAVERSE_SAFE_END
 }
 
 /*! \brief Free all of the XML trees */
@@ -552,7 +615,7 @@
 {
 	struct tree *tree;
 
-	AST_LIST_TRAVERSE(&trees, tree, list) {
+	while (tree = AST_LIST_REMOVE_HEAD(&trees, list)) {
 		mxmlDelete(tree->root);
 		free(tree);
 	}
@@ -584,13 +647,13 @@
 	getch(); /* display the help until the user hits a key */
 }
 
-/*! \brief Enable/Disable all members of a category as long as dependencies have been met */
+/*! \brief Enable/Disable all members of a category as long as dependencies have been met and no conflicts are found */
 void set_all(struct category *cat, int val)
 {
 	struct member *mem;
 
 	AST_LIST_TRAVERSE(&cat->members, mem, list) {
-		if (!mem->depsfailed)
+		if (!(mem->depsfailed || mem->conflictsfailed))
 			mem->enabled = val;
 	}
 }
@@ -832,21 +895,23 @@
 int main(int argc, char *argv[])
 {
 	int res = 0;
+	unsigned int x;
 
 	/* Parse the input XML files to build the list of available options */
 	if ((res = build_member_list()))
 		exit(res);
-
-	/* Read in the existing makeopts, if they exist */
-	parse_existing_config();
 
 	/* This option is used to ask this application to check to see if
 	 * that an existing menuselect.makeopts file contails all of the
 	 * modules that have dependencies that have not been met.  If this
 	 * is not the case, an informative message will be printed to the
 	 * user and the build will fail. */
-	if ((argc > 1) && !strcmp(argv[1], "--check-deps"))
-		check_deps = 1;
+	for (x = 1; x < argc; x++) {
+		if (!strcmp(argv[x], "--check-deps"))
+			check_deps = 1;
+		else
+			parse_existing_config(argv[x]);
+	}
 
 	/* Process module dependencies */
 	res = process_deps();

Modified: team/group/autoconf_and_menuselect/configure.ac
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/configure.ac?rev=18483&r1=18482&r2=18483&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/configure.ac (original)
+++ team/group/autoconf_and_menuselect/configure.ac Sat Apr  8 11:55:10 2006
@@ -55,6 +55,9 @@
     AC_DEFINE(Win32, 1,
               [Define according to your operating system type.])
     PBX_OSTYPE="CYGWIN"
+# this is ugly - KPF
+  OSISWIN32=1
+  AC_SUBST(OSISWIN32)
     ;;
   *linux*)
     AC_DEFINE(Linux, 1,

Modified: team/group/autoconf_and_menuselect/res/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/res/Makefile?rev=18483&r1=18482&r2=18483&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/res/Makefile (original)
+++ team/group/autoconf_and_menuselect/res/Makefile Sat Apr  8 11:55:10 2006
@@ -31,54 +31,10 @@
   endif
 endif
 
-ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include $(CROSS_COMPILE_TARGET)/usr/include/pgsql $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql $(CROSS_COMPILE_TARGET)/opt/pgsql/include $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h),)
-  MODS:=$(filter-out res_config_pgsql.so,$(MODS))
-endif
-
 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/net-snmp/net-snmp-config.h),)
   MODS:=$(filter-out res_snmp.so,$(MODS))
 else
   SNMP_LDLIBS+=$(shell net-snmp-config --agent-libs)
-endif
-
-ifeq (${WITH_SMDI},)
-  MODS:=$(filter-out res_smdi.so,$(MODS))
-endif
-
-MLFLAGS=
-
-# Now, go find postgresql libraries
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/postgresql
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib/postgresql
-endif
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/pgsql/lib
-endif
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/pgsql
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib/pgsql
-endif
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include/pgsql
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib/pgsql
-endif
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/opt/pgsql/include
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/opt/pgsql/lib
-endif
-
-ifneq ($(wilcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/postgresql
-endif
-
-ifneq ($(wilcard $(CROSS_COMPILE_TARGET)/usr/lib/libpq.so),)
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib
 endif
 
 ifeq (${OSARCH},CYGWIN)
@@ -86,12 +42,7 @@
   CYGSOLIB=-L.. -L. -lasterisk.dll
   CYG_RES_CONFIG_ODBC_LIB=-lres_odbc.so
   CYG_RES_FEATURES_LIB=-lres_adsi.so -lres_monitor.so
-  MODS:=$(filter-out res_musiconhold.so,$(MODS))
 endif
-
-CRYPTO_LIBS=-lssl -lcrypto
-
-CFLAGS+=
 
 ifndef WITHOUT_ZAPTEL
 ifeq ($(ZAPTEL),1)

Modified: team/group/autoconf_and_menuselect/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/res/res_musiconhold.c?rev=18483&r1=18482&r2=18483&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/res/res_musiconhold.c (original)
+++ team/group/autoconf_and_menuselect/res/res_musiconhold.c Sat Apr  8 11:55:10 2006
@@ -1226,3 +1226,7 @@
 {
 	return ASTERISK_GPL_KEY;
 }
+
+/*** MODULEINFO
+	<conflict>win32</conflict>
+ ***/



More information about the asterisk-commits mailing list