allow regular expressions in compiler arguments for the multi-lib support
This commit was SVN r14897.
Этот коммит содержится в:
родитель
a61ed0596a
Коммит
5e2d9bec39
@ -592,7 +592,7 @@ AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h \
|
|||||||
stdarg.h sys/stat.h sys/statvfs.h sys/time.h sys/tree.h \
|
stdarg.h sys/stat.h sys/statvfs.h sys/time.h sys/tree.h \
|
||||||
sys/types.h sys/uio.h sys/utsname.h sys/wait.h syslog.h \
|
sys/types.h sys/uio.h sys/utsname.h sys/wait.h syslog.h \
|
||||||
time.h termios.h ulimit.h unistd.h util.h utmp.h malloc.h \
|
time.h termios.h ulimit.h unistd.h util.h utmp.h malloc.h \
|
||||||
ifaddrs.h sys/sysctl.h crt_externs.h])
|
ifaddrs.h sys/sysctl.h crt_externs.h regex.h])
|
||||||
|
|
||||||
# Needed to work around Darwin requiring sys/socket.h for
|
# Needed to work around Darwin requiring sys/socket.h for
|
||||||
# net/if.h
|
# net/if.h
|
||||||
@ -730,7 +730,7 @@ OMPI_CHECK_FUNC_LIB([dirname], [gen])
|
|||||||
# Darwin doesn't need -lm, as it's a symlink to libSystem.dylib
|
# Darwin doesn't need -lm, as it's a symlink to libSystem.dylib
|
||||||
OMPI_CHECK_FUNC_LIB([ceil], [m])
|
OMPI_CHECK_FUNC_LIB([ceil], [m])
|
||||||
|
|
||||||
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty htonl ntohl htons ntohs getpwuid fork waitpid execve pipe ptsname setsid mmap mallopt tcgetpgrp posix_memalign strsignal sysconf syslog _NSGetEnviron])
|
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty htonl ntohl htons ntohs getpwuid fork waitpid execve pipe ptsname setsid mmap mallopt tcgetpgrp posix_memalign strsignal sysconf syslog regcmp regexec regfree _NSGetEnviron])
|
||||||
|
|
||||||
#
|
#
|
||||||
# Make sure we can copy va_lists (need check declared, not linkable)
|
# Make sure we can copy va_lists (need check declared, not linkable)
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif /* HAVE_SYS_TYPES_H */
|
#endif /* HAVE_SYS_TYPES_H */
|
||||||
|
#ifdef HAVE_REGEX_H
|
||||||
|
#include <regex.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif /* HAVE_SYS_WAIT_H */
|
#endif /* HAVE_SYS_WAIT_H */
|
||||||
@ -176,26 +179,36 @@ static int
|
|||||||
find_options_index(const char *arg)
|
find_options_index(const char *arg)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
#ifdef HAVE_REGEXEC
|
||||||
|
int args_count;
|
||||||
|
regex_t res;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0 ; i <= parse_options_idx ; ++i) {
|
for (i = 0 ; i <= parse_options_idx ; ++i) {
|
||||||
if (NULL == options_data[i].compiler_args) {
|
if (NULL == options_data[i].compiler_args) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_REGEXEC
|
||||||
|
args_count = opal_argv_count(options_data[i].compiler_args);
|
||||||
|
for (j = 0 ; j < args_count ; ++j) {
|
||||||
|
if (0 != regcomp(&res, options_data[i].compiler_args[j], REG_NOSUB)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == regexec(&res, arg, (size_t) 0, NULL, 0)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
regfree(&res);
|
||||||
|
}
|
||||||
|
#else
|
||||||
for (j = 0 ; j < opal_argv_count(options_data[i].compiler_args) ; ++j) {
|
for (j = 0 ; j < opal_argv_count(options_data[i].compiler_args) ; ++j) {
|
||||||
/* BWB: If in the future, we want to allow architecture
|
|
||||||
flags to be wildcard specified (like, say,
|
|
||||||
-xarch=amd64*), this strcmp would have to be changed to
|
|
||||||
something that understands wildcards. This is the only
|
|
||||||
change that will have to be made, provided you didn't
|
|
||||||
want to add some extra logic to have a general
|
|
||||||
-xarch=amd64* rule and another one that was an exact
|
|
||||||
match (like, say, -xarch=amd64a). Then this entire
|
|
||||||
loop will have to be modified, but no other parts of
|
|
||||||
this file would have to change. */
|
|
||||||
if (0 == strcmp(arg, options_data[i].compiler_args[j])) {
|
if (0 == strcmp(arg, options_data[i].compiler_args[j])) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user