1
1

opal_search_libs: correctly AC_DEFINE results of search

1. It is not sufficient to put the result of m4_toupper() in a
variable and use that variable as the variable name in
AC_DEFINE_UNQUOTED.  Instead, just use m4_toupper() directly in
AC_DEFINE_UNQUOTED.  Also, save the result value in a "permanent"
variable that isn't erased, just in case autoconf decides to be lazy
about instantiating the body AC_DEFINE_UNQUOTED and move it later
(this is probably overkill :-) ).
1. Use the OMPI Way of always defining macros (to 0 or 1).  Then also
slightly change the logic in util/basename.c to just check
OPAL_HAVE_DIRNAME (because it will always be defined).

Refs trac:4894

This commit was SVN r32723.

The following Trac tickets were found above:
  Ticket 4894 --> https://svn.open-mpi.org/trac/ompi/ticket/4894
Этот коммит содержится в:
Jeff Squyres 2014-09-13 00:28:30 +00:00
родитель 01e62b1994
Коммит 66aeadacff
2 изменённых файлов: 15 добавлений и 12 удалений

Просмотреть файл

@ -25,7 +25,7 @@ AC_DEFUN([OPAL_SEARCH_LIBS_CORE],[
m4_ifdef([mca_component_configure_active],
[m4_fatal([*** OPAL_SEARCH_LIBS_CORE cannot be called from a component configure.m4])])
OPAL_VAR_SCOPE_PUSH([LIBS_save add uppername])
OPAL_VAR_SCOPE_PUSH([LIBS_save add])
LIBS_save=$LIBS
AC_SEARCH_LIBS([$1], [$2],
@ -33,11 +33,13 @@ AC_DEFUN([OPAL_SEARCH_LIBS_CORE],[
add=`printf '%s\n' "$LIBS" | sed -e "s/$LIBS_save$//"`
AS_IF([test -n "$add"],
[OPAL_WRAPPER_FLAGS_ADD([LIBS], [$add])])
uppername=m4_toupper($1)
AC_DEFINE_UNQUOTED([OPAL_HAVE_$uppername], [1],
[whether $1 is found and available])
opal_have_$1=1
$3],
[$4], [$5])
[opal_have_$1=0
$4], [$5])
AC_DEFINE_UNQUOTED([OPAL_HAVE_]m4_toupper($1), [$opal_have_$1],
[whether $1 is found and available])
OPAL_VAR_SCOPE_POP
])dnl
@ -54,7 +56,7 @@ AC_DEFUN([OPAL_SEARCH_LIBS_COMPONENT],[
m4_ifndef([mca_component_configure_active],
[m4_fatal([*** OPAL_SEARCH_LIBS_COMPONENT can only be called from a component configure.m4])])
OPAL_VAR_SCOPE_PUSH([LIBS_save add uppername])
OPAL_VAR_SCOPE_PUSH([LIBS_save add])
LIBS_save=$LIBS
AC_SEARCH_LIBS([$2], [$3],
@ -62,11 +64,12 @@ AC_DEFUN([OPAL_SEARCH_LIBS_COMPONENT],[
add=`printf '%s\n' "$LIBS" | sed -e "s/$LIBS_save$//"`
AS_IF([test -n "$add"],
[OPAL_FLAGS_APPEND_UNIQ($1_LIBS, [$add])])
uppername=m4_toupper($1)
AC_DEFINE_UNQUOTED([OPAL_HAVE_$uppername], [1],
[whether $1 is found and available])
$1_have_$2=1
$4],
[$5], [$6])
[$1_have_$2=0
$5], [$6])
AC_DEFINE_UNQUOTED([OPAL_HAVE_]m4_toupper($1), [$$1_have_$2],
[whether $1 is found and available])
OPAL_VAR_SCOPE_POP
])dnl

Просмотреть файл

@ -101,7 +101,7 @@ char *opal_basename(const char *filename)
char* opal_dirname(const char* filename)
{
#if defined(HAVE_DIRNAME) || defined(OPAL_HAVE_DIRNAME)
#if defined(HAVE_DIRNAME) || OPAL_HAVE_DIRNAME
char* safe_tmp = strdup(filename), *result;
result = strdup(dirname(safe_tmp));
free(safe_tmp);
@ -134,5 +134,5 @@ char* opal_dirname(const char* filename)
}
}
return strdup(".");
#endif /* defined(HAVE_DIRNAME) */
#endif /* defined(HAVE_DIRNAME) || OPAL_HAVE_DIRNAME */
}