Skip to content

Commit

Permalink
libltdl: adjust rest of tree for embedded libltdl
Browse files Browse the repository at this point in the history
Adjust .gitignore for files that we should and should not ignore in
the embedded opal/libltdl (and friends).

Also make changes to autogen.pl:

* Remove some old kruft about the preopen error diff patch and FreeBSD
  shenanigans
* Update some configure ordering of CUDA libltdl checking to ensure
  that it happens after libltdl is setup
* Set all the LTDL macros that our build system expects (i.e., that
  LTDL_INIT/libtoolize used to do for us, such as LIBLTDL, LTDLDEPS,
  LTDLINCL).
* Adjust all inclusions of `ltdl.h` to now use `#include <ltdl.h>` and
  simply set CPPFLAGS if we need it to point to the one embedded in
  the OMPI source tree.
* Adjust autogen.pl to run "autoreconf" in the opal/libltdl tree.
  Critically, we need to NOT run `libtoolize`, though (there's
  complicated sequencing in the bootstrapping of the Libtool/libltdl
  packages that makes that magically work somehow -- but now we don't
  want that magic: we want libltdl to be just like any other embedded
  package that just needs a configure script and some Automake-ified
  Makefiles).
  • Loading branch information
jsquyres committed Feb 17, 2015
1 parent b1aa1ea commit 874333d
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 93 deletions.
20 changes: 12 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,10 @@ missing
mkinstalldirs
libtool.m4
lt~obsolete.m4
ltdl.m4
argz.m4
ltargz.m4
ltsugar.m4
ltversion.m4
ltoptions.m4

config/ltoptions.m4
config/ltsugar.m4
config/ltversion.m4

config/project_list.m4
config/autogen_found_items.m4
Expand Down Expand Up @@ -163,6 +161,9 @@ ompi/mca/coll/sm/coll-sm-version.h*
ompi/mca/crcp/ompi_crcp.7

ompi/mca/io/romio/io-romio-version.h*
ompi/mca/io/romio/romio/confdb/ltoptions.m4
ompi/mca/io/romio/romio/confdb/ltsugar.m4
ompi/mca/io/romio/romio/confdb/ltversion.m4
ompi/mca/io/romio/romio/lib
ompi/mca/io/romio/romio/localdefs
ompi/mca/io/romio/romio/adio/include/romioconf.h
Expand Down Expand Up @@ -291,8 +292,6 @@ ompi/tools/wrappers/mpicxx-wrapper-data.txt
ompi/tools/wrappers/mpif77-wrapper-data.txt
ompi/tools/wrappers/mpif90-wrapper-data.txt

opal/libltdl

opal/asm/atomic-asm.S
opal/asm/atomic-test
opal/asm/generated/atomic-*.s
Expand All @@ -306,6 +305,8 @@ opal/include/opal/sys/powerpc/atomic-32.s
opal/include/opal/sys/powerpc/atomic-64.s
opal/include/opal/sys/powerpc/atomic-32-64.s

opal/libltdl/config.h

opal/mca/base/mca_base_parse_paramfile_lex.c

opal/mca/common/libfabric/libfabric/config.h
Expand All @@ -318,6 +319,9 @@ opal/mca/crs/opal_crs.7

opal/mca/event/libevent*/libevent/config.h.in
opal/mca/event/libevent*/libevent/config.h
opal/mca/event/libevent*/libevent/m4/ltoptions.m4
opal/mca/event/libevent*/libevent/m4/ltsugar.m4
opal/mca/event/libevent*/libevent/m4/ltversion.m4
opal/mca/event/libevent*/libevent/libevent.pc
opal/mca/event/libevent*/libevent/libevent_openssl.pc
opal/mca/event/libevent*/libevent/libevent_pthreads.pc
Expand Down
40 changes: 18 additions & 22 deletions autogen.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
#
# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
Expand Down Expand Up @@ -1257,6 +1257,23 @@ sub patch_autotools_output {

#---------------------------------------------------------------------------

# Run autotools in libltdl
++$step;
verbose "\n$step. Running autotools on opal/libltdl\n\n";

chdir("opal/libltdl");

verbose "==> Running autoreconf\n";
# Need to ensure that "libtoolize" isn't run
my %ENV_save = %ENV;
$ENV{LIBTOOLIZE} = "true";
safe_system("autoreconf -ivf");
%ENV = %ENV_save;

chdir("../..");

#---------------------------------------------------------------------------

# If we got here, all was good. Run the auto tools.
++$step;
verbose "\n$step. Running autotools on top-level tree\n\n";
Expand All @@ -1265,7 +1282,6 @@ sub patch_autotools_output {
verbose "==> Remove stale files\n";
find_and_delete(qw/config.guess config.sub depcomp compile install-sh ltconfig
ltmain.sh missing mkinstalldirs libtool/);
system("rm -rf opal/libltdl");

# Remove the old m4 file and write the new one
verbose "==> Writing m4 file with autogen.pl results\n";
Expand All @@ -1292,26 +1308,6 @@ sub patch_autotools_output {

#---------------------------------------------------------------------------

# For FreeBSD (carried over from autogen.sh); apparently some versions
# of automake don't so this (prior to 1.9.7...?).
system("chmod u+w opal/libltdl/configure");

#---------------------------------------------------------------------------

++$step;
verbose "\n$step. Patching autotools output on top-level tree :-(\n\n";

# Patch preopen error in libltdl
if (-f "opal/libltdl/loaders/preopen.c") {
verbose "=== Patching preopen error masking in libltdl\n";
safe_system("$patch_prog -N -p0 < config/libltdl-preopen-error.diff");
unlink("opal/libltdl/loaders/preopen.c.rej");
}

patch_autotools_output(".");

#---------------------------------------------------------------------------

verbose "
================================================
Open MPI autogen: completed successfully. w00t!
Expand Down
3 changes: 1 addition & 2 deletions config/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2010 Oracle and/or its affiliates. All rights
# reserved.
# Copyright (c) 2014 Intel, Inc. All rights reserved.
Expand All @@ -23,7 +23,6 @@
EXTRA_DIST = \
distscript.csh \
opal_get_version.m4sh \
libltdl-preopen-error.diff \
ltmain_pgi_tp.diff \
opal_mca_priority_sort.pl

Expand Down
27 changes: 0 additions & 27 deletions config/libltdl-preopen-error.diff

This file was deleted.

32 changes: 27 additions & 5 deletions config/opal_check_cuda.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009 IBM Corporation. All rights reserved.
dnl Copyright (c) 2009 Los Alamos National Security, LLC. All rights
Expand Down Expand Up @@ -72,10 +72,11 @@ AS_IF([test "$with_cuda" = "no" || test "x$with_cuda" = "x"],
opal_cuda_incdir="$with_cuda/include"
AC_MSG_RESULT([found ($opal_cuda_incdir/cuda.h)])])])])])

# We cannot have CUDA support without dlopen support. Check for that and
# error out if the user has also set --disable-dlopen.
AS_IF([test "$enable_dlopen" = "no" && test "$opal_check_cuda_happy" = "yes"],
[AC_MSG_ERROR([--with-cuda cannot be used with --disable-dlopen. Remove one of them and reconfigure.])])
dnl We cannot have CUDA support without dlopen support. HOWEVER, we
dnl have not determined whether we have libltdl support yet (i.e.,
dnl whether we have dlopen support or not). So we have to defer this
dnl check until later (see the OPAL_CHECK_CUDA_AFTER_LIBLTDL m4 macro,
dnl below). :-(

# If we have CUDA support, check to see if we have CUDA 4.1 support
AS_IF([test "$opal_check_cuda_happy"="yes"],
Expand Down Expand Up @@ -142,3 +143,24 @@ AC_DEFINE_UNQUOTED([OPAL_CUDA_GDR_SUPPORT],$CUDA_VERSION_60_OR_GREATER,
[Whether we have CUDA GDR support available])

])

dnl
dnl CUDA support requires libltdl support. But we do not check for
dnl libltdl support until lafter the initial OPAL_CHECK_CUDA is called.
dnl So put the CUDA+libltdl check in a separate macro that can be called
dnl after the main libltdl check in the top-level configure.ac.
dnl
AC_DEFUN([OPAL_CHECK_CUDA_AFTER_LIBLTDL],[

# We cannot have CUDA support without dlopen support. When this
# macro is invoked, we will know if we have libltdl (i.e., dlopen)
# support.

# Error out if the user wants CUDA but we do not have libltdl
# support.
AS_IF([test $OPAL_ENABLE_DLOPEN_SUPPORT -eq 0 && \
test "$opal_check_cuda_happy" = "yes"],
[AC_MSG_WARN([--with-cuda was specified, but dlopen support has been disabled.])
AC_MSG_WARN([You must enable dlopen support and reconfigure.])
AC_MSG_ERROR([Cannot continue.])])
])
14 changes: 13 additions & 1 deletion config/opal_setup_libltdl.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dnl Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
dnl reserved.
Expand Down Expand Up @@ -191,5 +191,17 @@ AC_DEFUN([_OPAL_SETUP_LIBLTDL_INTERNAL],[
fi
CFLAGS=$CFLAGS_save
# These variables used to be set by libtoolize (when we had
# Libtool insertted at autogen time). But now we have a
# hard-coded/embeded version of libltdl from Libtool 2.4.2. And
# we don't use the embed-libltdl-at-libtoolize-time functionality
# any more. So we have to set these values ourselves.
LIBLTDL='${top_build_prefix}opal/libltdl/libltdlc.la'
LTDLDEPS=$LIBLTDL
LTDLINCL='-I${top_srcdir}/opal/libltdl'
AC_SUBST(LIBLTDL)
AC_SUBST(LTDLDEPS)
AC_SUBST(LTDLINCL)
OPAL_VAR_SCOPE_POP
])dnl
11 changes: 7 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,13 @@ OPAL_SEARCH_LIBS_CORE([ceil], [m])
# -lrt might be needed for clock_gettime
OPAL_SEARCH_LIBS_CORE([clock_gettime], [rt])

# See if we can find libltdl
OPAL_SETUP_LIBLTDL

# Do some more CUDA checks after we determine whether we have libltdl
# support or not
OPAL_CHECK_CUDA_AFTER_LIBLTDL

AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv])

# Sanity check: ensure that we got at least one of statfs or statvfs.
Expand Down Expand Up @@ -1225,8 +1232,6 @@ fi
# a C++ compiler.
AS_IF([test "$OMPI_WANT_FORTRAN_BINDINGS" != "1"],[F77=no FC=no])

LT_CONFIG_LTDL_DIR([opal/libltdl], [subproject])
LTDL_CONVENIENCE
LT_INIT([dlopen win32-dll])

# What's the suffix of shared libraries? Inspired by generated
Expand Down Expand Up @@ -1263,8 +1268,6 @@ esac
AC_SUBST(OPAL_DYN_LIB_PREFIX)
AC_SUBST(OPAL_DYN_LIB_SUFFIX)

OPAL_SETUP_LIBLTDL

# Need the libtool binary before the rpathify stuff
LT_OUTPUT

Expand Down
6 changes: 4 additions & 2 deletions ompi/debuggers/dlopen_test.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -13,7 +13,9 @@
#include <string.h>
#include <stdlib.h>

#include "opal/libltdl/ltdl.h"
#if OPAL_WANT_LIBLTDL
#include <ltdl.h>
#endif

#if !OPAL_WANT_LIBLTDL
int main(int argc, char *argv[])
Expand Down
10 changes: 5 additions & 5 deletions opal/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand All @@ -30,12 +30,12 @@ SUBDIRS = \
. \
$(MCA_opal_FRAMEWORK_COMPONENT_DSO_SUBDIRS)

# libltdl is included by variable because if --disable-dlopen was
# used, there will be no generated Makefile in that directory (and
# therefore make distclean will fail).
# Note that if we were configured with --disable-dlopen or
# --with-libltdl=external, there will be no Makefile in libltdl/, and
# "make dist" will fail.
DIST_SUBDIRS = \
include \
$(LIBLTDL_SUBDIR) \
libltdl \
asm \
datatype \
etc \
Expand Down
8 changes: 2 additions & 6 deletions opal/mca/base/mca_base_component_find.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -42,11 +42,7 @@
#endif

#if OPAL_WANT_LIBLTDL
#if OPAL_LIBLTDL_INTERNAL
#include "opal/libltdl/ltdl.h"
#else
#include "ltdl.h"
#endif
#include <ltdl.h>
#endif

#include "opal/mca/installdirs/installdirs.h"
Expand Down
8 changes: 2 additions & 6 deletions opal/mca/base/mca_base_component_repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -27,11 +27,7 @@
#include <stdio.h>

#if OPAL_WANT_LIBLTDL
#if OPAL_LIBLTDL_INTERNAL
#include "opal/libltdl/ltdl.h"
#else
#include "ltdl.h"
#endif
#include <ltdl.h>
#endif

#include "opal/class/opal_list.h"
Expand Down
6 changes: 1 addition & 5 deletions opal/util/lt_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
#include "opal/util/output.h"

#if OPAL_WANT_LIBLTDL
#if OPAL_LIBLTDL_INTERNAL
#include "opal/libltdl/ltdl.h"
#else
#include "ltdl.h"
#endif
#include <ltdl.h>
#endif

#if OPAL_WANT_LIBLTDL
Expand Down

0 comments on commit 874333d

Please sign in to comment.