From 9c15a30b755c9399725d84f900feb91b85110ab4 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 1 Nov 2010 23:28:50 +0000 Subject: [PATCH] Really fix the libevent make distcheck problem. The main issue is how libevent creates its event-config.h during "make all" (vs. during configure). The prior method around this didn't work because it wrote an event-config.h.in in the source tree -- a Bad Idea(tm). The new way uses AC_CONFIG_COMMAND to get stuff executed at the end of config.status to create event-config.h. This seems to work properly during make distcheck. This commit was SVN r23975. --- opal/mca/event/libevent207/Makefile.am | 3 ++- opal/mca/event/libevent207/configure.m4 | 31 +++++++++++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/opal/mca/event/libevent207/Makefile.am b/opal/mca/event/libevent207/Makefile.am index 272a593439..9bde8f77e5 100644 --- a/opal/mca/event/libevent207/Makefile.am +++ b/opal/mca/event/libevent207/Makefile.am @@ -45,7 +45,6 @@ headers += libevent/event.h libevent/evutil.h libevent/util-internal.h \ libevent/include/event2/dns_struct.h \ libevent/include/event2/event_compat.h \ libevent/include/event2/event_struct.h \ - libevent/include/event2/event-config.h \ libevent/include/event2/event.h \ libevent/include/event2/http_compat.h \ libevent/include/event2/http_struct.h \ @@ -61,6 +60,8 @@ headers += libevent/event.h libevent/evutil.h libevent/util-internal.h \ libevent/include/event2/util.h opaldir = $(includedir)/openmpi/$(subdir) nobase_opal_HEADERS = $(headers) + +nobase_nodist_opal_HEADERS = libevent/include/event2/event-config.h endif # Make the output library in this directory, and name it either diff --git a/opal/mca/event/libevent207/configure.m4 b/opal/mca/event/libevent207/configure.m4 index 1e6babea4a..a8bfe99838 100644 --- a/opal/mca/event/libevent207/configure.m4 +++ b/opal/mca/event/libevent207/configure.m4 @@ -127,13 +127,11 @@ AC_DEFUN([MCA_opal_event_libevent207_CONFIG],[ # other things are built before the event framework that # end up including event-config.h). The steps below were # copied from libevent's Makefile.am. - file="$basedir/libevent/include/event2/event-config.h" - mkdir -p "`dirname $OMPI_TOP_SRCDIR/$file`" - AS_IF([test ! -d "`dirname $OMPI_TOP_SRCDIR/$file`"], - [AC_MSG_WARN([Failed to mkdir `dirname $file`]) - AC_MSG_ERROR([Cannot continue])]) - - cat > "$OMPI_TOP_SRCDIR/$file.in" < "$file.new" <> "$OMPI_TOP_SRCDIR/$file.in" - echo "#endif" >> "$OMPI_TOP_SRCDIR/$file.in" - AC_CONFIG_FILES([$file]) + sed -e 's/#define /#define _EVENT_/' \ + -e 's/#undef /#undef _EVENT_/' \ + -e 's/#ifndef /#ifndef _EVENT_/' < "$basedir/libevent/config.h" >> "$file.new" + echo "#endif" >> "$file.new" + + # Only make a new .h file if the + # contents haven't changed + diff -q $file "$file.new" > /dev/null 2> /dev/null + if test "$?" = "0"; then + echo $file is unchanged + else + cp "$file.new" $file + rm -f "$file.new" + fi]) # Must set this variable so that the framework m4 knows # what file to include in opal/mca/event/event.h