[ofa-general] [PATCH] opensm: configure scripts merge

Sasha Khapyorsky sashak at voltaire.com
Sat Sep 15 11:35:42 PDT 2007


This merges all subdirectories configure.in scripts into one toplevel
directory script. Separate configuring per subdirectory is not needed
anymore.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/Makefile.am                |    4 +-
 opensm/autogen.sh                 |   34 +++------------------
 opensm/complib/Makefile.am        |    2 +
 opensm/configure.in               |   60 ++++++++++++++++++++++++++++++------
 opensm/libvendor/Makefile.am      |    2 +
 opensm/opensm/Makefile.am         |    2 +
 opensm/osmeventplugin/Makefile.am |    2 +
 7 files changed, 65 insertions(+), 41 deletions(-)

diff --git a/opensm/Makefile.am b/opensm/Makefile.am
index f99e78b..9cbce3a 100644
--- a/opensm/Makefile.am
+++ b/opensm/Makefile.am
@@ -1,12 +1,12 @@
 
 # note that order matters: make the libs first then use them
-SUBDIRS 		= complib libvendor opensm osmtest include $(DEFAULT_EVENT_PLUGIN)
+SUBDIRS = complib libvendor opensm osmtest include $(DEFAULT_EVENT_PLUGIN)
 DIST_SUBDIRS = complib libvendor opensm osmtest include osmeventplugin
 
 # this will control the update of the files in order
 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config-h.in
 
-ACLOCAL			= aclocal -I $(ac_aux_dir)
+ACLOCAL	= aclocal -I $(ac_aux_dir)
 
 # we should provide a hint for other apps about the build mode of this project
 install-exec-hook:
diff --git a/opensm/autogen.sh b/opensm/autogen.sh
index 3ae89b4..fee8800 100755
--- a/opensm/autogen.sh
+++ b/opensm/autogen.sh
@@ -50,32 +50,8 @@ fi
 # cleanup
 find . \( -name Makefile.in -o -name aclocal.m4 -o -name autom4te.cache -o -name configure -o -name aclocal.m4 \) -exec \rm -rf {} \; -prune
 
-# handle our own autoconf:
-(aclocal -I config 2>&1 ) && \
-(automake --add-missing --gnu --copy ) && \
-(autoconf 2>&1 )
-if test $? != 0; then
-    exit 1
-fi
-
-
-
-# visit all sub directories with autogen.sh
-anyErr=0
-for a in include complib libvendor opensm osmtest osmeventplugin ; do
-	dir=`dirname $a`
-	test -d ${dir}/config || mkdir ${dir}/config
-	echo Visiting $a
-	( cd $a && \
-	set -x && \
-	aclocal -I config -I ../config && \
-	libtoolize --force --copy && \
-	autoheader && \
-	automake --foreign --add-missing --copy && \
-	autoconf ) \
-	2>&1 | sed 's/^/| /' | grep -v "arning: underquoted definition"
-	if test $? != 0; then
-		echo $a failed
-		anyErr=1
-	fi
-done
+aclocal -I config && \
+libtoolize --force --copy && \
+autoheader && \
+automake --foreign --add-missing --copy && \
+autoconf
diff --git a/opensm/complib/Makefile.am b/opensm/complib/Makefile.am
index fce797a..a77964e 100644
--- a/opensm/complib/Makefile.am
+++ b/opensm/complib/Makefile.am
@@ -17,6 +17,8 @@ else
     libosmcomp_version_script =
 endif
 
+complib_api_version=$(shell grep LIBVERSION= $(srcdir)/libosmcomp.ver | sed 's/LIBVERSION=//')
+
 libosmcomp_la_SOURCES = cl_complib.c cl_dispatcher.c \
 			cl_event.c cl_event_wheel.c \
 			cl_list.c cl_log.c cl_map.c \
diff --git a/opensm/configure.in b/opensm/configure.in
index 2efd867..6c4db9f 100644
--- a/opensm/configure.in
+++ b/opensm/configure.in
@@ -4,6 +4,7 @@ AC_PREREQ(2.57)
 AC_INIT(opensm, 3.1.1, general at lists.openfabrics.org)
 AC_CONFIG_SRCDIR([opensm/osm_opensm.c])
 AC_CONFIG_AUX_DIR(config)
+AC_CONFIG_HEADERS(include/config.h)
 AM_INIT_AUTOMAKE(opensm, 3.1.1)
 
 dnl Defines the Language
@@ -16,17 +17,50 @@ AM_MAINTAINER_MODE
 
 dnl Required for cases make defines a MAKE=make ??? Why
 AC_PROG_MAKE_SET
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_YACC
+AC_PROG_LEX
+
+dnl Checks for libraries
+AC_CHECK_LIB(pthread, pthread_mutex_init, [],
+	AC_MSG_ERROR([pthread_mutex_init() not found.  libosmcomp requires libpthread.]))
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+AC_STRUCT_TM
+AC_C_VOLATILE
+
+dnl We use --version-script with ld if possible
+AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
+if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
+	ac_cv_version_script=yes
+else
+	ac_cv_version_script=no
+fi)
+AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes")
 
 dnl Define an input config option to control debug compile
-AC_ARG_ENABLE(debug,
-[  --enable-debug    Turn on debugging],
+AC_ARG_ENABLE(debug,    [  --enable-debug          Turn on debugging],
 [case "${enableval}" in
-  yes) debug=true ;;
-  no)  debug=false ;;
-  *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
-esac],[debug=false])
+	yes) debug=true ;;
+	no)  debug=false ;;
+	*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
+esac],debug=false)
 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
 
+AC_ARG_ENABLE(libcheck, [  --disable-libcheck      do not test for presence of ib libraries],
+[if test x$enableval = xno ; then
+	disable_libcheck=yes
+fi])
+
 dnl check if they want the socket console
 OPENIB_OSM_CONSOLE_SOCKET_SEL
 
@@ -39,9 +73,15 @@ OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL
 dnl Provide user option to select vendor
 OPENIB_APP_OSMV_SEL
 
-dnl Configure the following subdirs
-AC_CONFIG_SUBDIRS(complib libvendor opensm osmtest include osmeventplugin)
+dnl Checks for headers and libraries
+OPENIB_APP_OSMV_CHECK_HEADER
+OPENIB_APP_OSMV_CHECK_LIB
+
+# we have to revive the env CFLAGS as some how they are being overwritten...
+# see http://sources.redhat.com/automake/automake.html#Flag-Variables-Ordering
+# for why they should NEVER be modified by the configure to allow for user
+# overrides.
+CFLAGS=$ac_env_CFLAGS_value
 
 dnl Create the following Makefiles
-AC_OUTPUT(Makefile)
-AC_OUTPUT(opensm.spec)
+AC_OUTPUT([Makefile include/Makefile complib/Makefile libvendor/Makefile opensm/Makefile osmeventplugin/Makefile osmtest/Makefile opensm.spec])
diff --git a/opensm/libvendor/Makefile.am b/opensm/libvendor/Makefile.am
index 3b8c3af..cb8baaa 100644
--- a/opensm/libvendor/Makefile.am
+++ b/opensm/libvendor/Makefile.am
@@ -23,6 +23,8 @@ else
     libosmvendor_version_script =
 endif
 
+osmvendor_api_version=$(shell grep LIBVERSION= $(srcdir)/libosmvendor.ver | sed 's/LIBVERSION=//')
+
 COMM_HDRS= $(srcdir)/../include/vendor/osm_vendor_api.h \
 			$(srcdir)/../include/vendor/osm_vendor.h \
 			$(srcdir)/../include/vendor/osm_vendor_select.h \
diff --git a/opensm/opensm/Makefile.am b/opensm/opensm/Makefile.am
index 5e4229d..8440b4a 100644
--- a/opensm/opensm/Makefile.am
+++ b/opensm/opensm/Makefile.am
@@ -21,6 +21,8 @@ else
 libopensm_version_script =
 endif
 
+opensm_api_version=$(shell grep LIBVERSION= $(srcdir)/libopensm.ver | sed 's/LIBVERSION=//')
+
 libopensm_la_SOURCES = osm_log.c osm_mad_pool.c osm_helper.c
 libopensm_la_LDFLAGS = -version-info $(opensm_api_version) \
 	-export-dynamic $(libopensm_version_script)
diff --git a/opensm/osmeventplugin/Makefile.am b/opensm/osmeventplugin/Makefile.am
index bbb012f..1b7dad0 100644
--- a/opensm/osmeventplugin/Makefile.am
+++ b/opensm/osmeventplugin/Makefile.am
@@ -18,6 +18,8 @@ else
     libosmeventplugin_version_script =
 endif
 
+osmeventplugin_api_version=$(shell grep LIBVERSION= $(srcdir)/libosmeventplugin.ver | sed 's/LIBVERSION=//')
+
 libosmeventplugin_la_SOURCES = src/osmeventplugin.c
 libosmeventplugin_la_LDFLAGS = -version-info $(osmeventplugin_api_version) \
 	 -export-dynamic $(libosmeventplugin_version_script)
-- 
1.5.3.1.91.gd3392




More information about the general mailing list