Skip to content

Commit b44e927

Browse files
authored
Merge pull request #10803 from bwbarrett/cleanup/import-oac-macros
build: Import and use external Autoconf repo
2 parents 0147cd0 + 907af3d commit b44e927

File tree

7 files changed

+16
-970
lines changed

7 files changed

+16
-970
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
path = 3rd-party/openpmix
77
url = ../../openpmix/openpmix.git
88
branch = master
9+
[submodule "oac"]
10+
path = config/oac
11+
url = ../oac

autogen.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ sub replace_config_sub_guess {
17251725
# Run autoreconf
17261726
verbose "==> Running autoreconf\n";
17271727
chdir("..");
1728-
my $cmd = "autoreconf -ivf --warnings=all,no-obsolete,no-override -I config";
1728+
my $cmd = "autoreconf -ivf --warnings=all,no-obsolete,no-override -I config -I config/oac";
17291729
foreach my $project (@{$projects}) {
17301730
$cmd .= " -I $project->{dir}/config"
17311731
if (-d "$project->{dir}/config");

config/oac

Submodule oac added at 5c8de3d

config/oac_check_package.m4

Lines changed: 0 additions & 697 deletions
This file was deleted.

config/oac_literal.m4

Lines changed: 0 additions & 17 deletions
This file was deleted.

config/opal_functions.m4

Lines changed: 11 additions & 250 deletions
Original file line numberDiff line numberDiff line change
@@ -204,227 +204,50 @@ dnl #######################################################################
204204

205205
# 1 is the message
206206
# 2 is whether to put a prefix or not
207-
AC_DEFUN([OPAL_LOG_MSG],[
208-
if test -n "$2"; then
209-
echo "configure:__oline__: $1" >&5
210-
else
211-
echo $1 >&5
212-
fi])dnl
207+
AC_DEFUN([OPAL_LOG_MSG],
208+
[AS_IF([test -n "$2"], [OAC_LOG_MSG([$1])], [OAC_LOG_MSG_NOPREFIX([$1])])])
213209

214210
dnl #######################################################################
215211
dnl #######################################################################
216212
dnl #######################################################################
217213

218-
# 1 is the filename
219-
AC_DEFUN([OPAL_LOG_FILE],[
220-
if test -n "$1" && test -f "$1"; then
221-
cat $1 >&5
222-
fi])dnl
214+
m4_copy([OAC_LOG_FILE], [OPAL_LOG_FILE])
223215

224216
dnl #######################################################################
225217
dnl #######################################################################
226218
dnl #######################################################################
227219

228-
# 1 is the command
229-
# 2 is actions to do if success
230-
# 3 is actions to do if fail
231-
AC_DEFUN([OPAL_LOG_COMMAND],[
232-
echo "configure:__oline__: $1" >&5
233-
$1 1>&5 2>&1
234-
opal_status=$?
235-
OPAL_LOG_MSG([\$? = $opal_status], 1)
236-
if test "$opal_status" = "0"; then
237-
unset opal_status
238-
$2
239-
else
240-
unset opal_status
241-
$3
242-
fi])dnl
220+
m4_copy([OAC_LOG_COMMAND], [OPAL_LOG_COMMAND])
243221

244222
dnl #######################################################################
245223
dnl #######################################################################
246224
dnl #######################################################################
247225

248-
# 1 is the variable name to be uniq-ized
249-
AC_DEFUN([OPAL_UNIQ],[
250-
opal_name=$1
251-
252-
# Go through each item in the variable and only keep the unique ones
253-
254-
opal_count=0
255-
for val in ${$1}; do
256-
opal_done=0
257-
opal_i=1
258-
opal_found=0
259-
260-
# Loop over every token we've seen so far
261-
262-
opal_done="`expr $opal_i \> $opal_count`"
263-
while test "$opal_found" = "0" && test "$opal_done" = "0"; do
264-
265-
# Have we seen this token already? Prefix the comparison with
266-
# "x" so that "-Lfoo" values won't be cause an error.
267-
268-
opal_eval="expr x$val = x\$opal_array_$opal_i"
269-
opal_found=`eval $opal_eval`
270-
271-
# Check the ending condition
272-
273-
opal_done="`expr $opal_i \>= $opal_count`"
274-
275-
# Increment the counter
276-
277-
opal_i="`expr $opal_i + 1`"
278-
done
279-
280-
# If we didn't find the token, add it to the "array"
281-
282-
if test "$opal_found" = "0"; then
283-
opal_eval="opal_array_$opal_i=$val"
284-
eval $opal_eval
285-
opal_count="`expr $opal_count + 1`"
286-
else
287-
opal_i="`expr $opal_i - 1`"
288-
fi
289-
done
290-
291-
# Take all the items in the "array" and assemble them back into a
292-
# single variable
293-
294-
opal_i=1
295-
opal_done="`expr $opal_i \> $opal_count`"
296-
opal_newval=
297-
while test "$opal_done" = "0"; do
298-
opal_eval="opal_newval=\"$opal_newval \$opal_array_$opal_i\""
299-
eval $opal_eval
300-
301-
opal_eval="unset opal_array_$opal_i"
302-
eval $opal_eval
303-
304-
opal_done="`expr $opal_i \>= $opal_count`"
305-
opal_i="`expr $opal_i + 1`"
306-
done
307-
308-
# Done; do the assignment
309-
310-
opal_newval="`echo $opal_newval`"
311-
opal_eval="$opal_name=\"$opal_newval\""
312-
eval $opal_eval
313-
314-
# Clean up
315-
316-
unset opal_name opal_i opal_done opal_newval opal_eval opal_count])dnl
226+
m4_copy([OAC_UNIQ], [OPAL_UNIQ])
317227

318228
dnl #######################################################################
319229
dnl #######################################################################
320230
dnl #######################################################################
321231

322-
# OPAL_APPEND(variable, new_argument)
323-
# ----------------------------------------
324-
# Append new_argument to variable, assuming a space separated list.
325-
#
326-
AC_DEFUN([OPAL_APPEND], [
327-
AS_IF([test -z "$$1"], [$1="$2"], [$1="$$1 $2"])
328-
])
232+
m4_copy([OAC_APPEND], [OPAL_APPEND])
329233

330234
dnl #######################################################################
331235
dnl #######################################################################
332236
dnl #######################################################################
333237

334-
# OPAL_APPEND_UNIQ(variable, new_argument)
335-
# ----------------------------------------
336-
# Append new_argument to variable if not already in variable. This assumes a
337-
# space separated list.
338-
#
339-
# This could probably be made more efficient :(.
340-
AC_DEFUN([OPAL_APPEND_UNIQ], [
341-
for arg in $2; do
342-
opal_found=0;
343-
for val in ${$1}; do
344-
if test "x$val" = "x$arg" ; then
345-
opal_found=1
346-
break
347-
fi
348-
done
349-
if test "$opal_found" = "0" ; then
350-
OPAL_APPEND([$1], [$arg])
351-
fi
352-
done
353-
unset opal_found
354-
])
238+
m4_copy([OAC_APPEND_UNIQ], [OPAL_APPEND_UNIQ])
355239

356240
dnl #######################################################################
357241
dnl #######################################################################
358242
dnl #######################################################################
359243

360-
# OPAL_FLAGS_APPEND_UNIQ(variable, new_argument)
361-
# ----------------------------------------------
362-
# Append new_argument to variable if:
363-
#
364-
# - the argument does not begin with -I, -L, or -l, or
365-
# - the argument begins with -I, -L, or -l, and it's not already in variable
366-
#
367-
# This macro assumes a space separated list.
368-
AC_DEFUN([OPAL_FLAGS_APPEND_UNIQ], [
369-
OPAL_VAR_SCOPE_PUSH([opal_tmp opal_append])
370-
371-
for arg in $2; do
372-
opal_tmp=`echo $arg | cut -c1-2`
373-
opal_append=1
374-
AS_IF([test "$opal_tmp" = "-I" || test "$opal_tmp" = "-L" || test "$opal_tmp" = "-l"],
375-
[for val in ${$1}; do
376-
AS_IF([test "x$val" = "x$arg"], [opal_append=0])
377-
done])
378-
AS_IF([test "$opal_append" = "1"],
379-
[OPAL_APPEND([$1], [$arg])])
380-
done
381-
382-
OPAL_VAR_SCOPE_POP
383-
])
244+
m4_copy([OAC_FLAGS_APPEND_UNIQ], [OPAL_FLAGS_APPEND_UNIQ])
384245

385246
dnl #######################################################################
386247
dnl #######################################################################
387248
dnl #######################################################################
388249

389-
# OPAL_FLAGS_APPEND_MOVE(variable, new_argument)
390-
# ----------------------------------------------
391-
# add new_arguments to the end of variable.
392-
#
393-
# If an argument in new_arguments does not begin with -I, -L, or -l OR
394-
# the argument begins with -I, -L, or -l and it is not already in
395-
# variable, it is appended to variable.
396-
#
397-
# If an argument in new_argument begins with a -l and is already in
398-
# variable, the existing occurrences of the argument are removed from
399-
# variable and the argument is appended to variable. This behavior
400-
# is most useful in LIBS, where ordering matters and being rightmost
401-
# is usually the right behavior.
402-
#
403-
# This macro assumes a space separated list.
404-
AC_DEFUN([OPAL_FLAGS_APPEND_MOVE], [
405-
OPAL_VAR_SCOPE_PUSH([opal_tmp_variable opal_tmp opal_append])
406-
407-
for arg in $2; do
408-
AS_CASE([$arg],
409-
[-I*|-L*],
410-
[opal_append=1
411-
for val in ${$1} ; do
412-
AS_IF([test "x$val" = "x$arg"], [opal_append=0])
413-
done
414-
AS_IF([test $opal_append -eq 1], [OPAL_APPEND([$1], [$arg])])],
415-
[-l*],
416-
[opal_tmp_variable=
417-
for val in ${$1}; do
418-
AS_IF([test "x$val" != "x$arg"],
419-
[OPAL_APPEND([opal_tmp_variable], [$val])])
420-
done
421-
OPAL_APPEND([opal_tmp_variable], [$arg])
422-
$1="$opal_tmp_variable"],
423-
[OPAL_APPEND([$1], [$arg])])
424-
done
425-
426-
OPAL_VAR_SCOPE_POP
427-
])
250+
m4_copy([OAC_FLAGS_APPEND_MOVE], [OPAL_FLAGS_APPEND_MOVE])
428251

429252
dnl #######################################################################
430253
dnl #######################################################################
@@ -496,70 +319,8 @@ dnl #######################################################################
496319
dnl #######################################################################
497320
dnl #######################################################################
498321

499-
AC_DEFUN([OPAL_VAR_SCOPE_INIT],
500-
[opal_var_scope_push()
501-
{
502-
opal_var_scope_push_lineno=$[]1
503-
shift
504-
# First, check to see if any of these variables are already set.
505-
# This is a simple sanity check to ensure we're not already
506-
# overwriting pre-existing variables (that have a non-empty
507-
# value). It's not a perfect check, but at least it's something.
508-
for opal_var_scope_tmp_var in $[]@; do
509-
AS_VAR_SET_IF([$opal_var_scope_tmp_var],
510-
[AS_VAR_COPY([opal_var_scope_tmp_var_val], [$opal_var_scope_tmp_var])
511-
AC_MSG_WARN([Found configure shell variable clash at line $opal_var_scope_push_lineno!])
512-
AC_MSG_WARN([[OPAL_VAR_SCOPE_PUSH] called on "$opal_var_scope_tmp_var",])
513-
AC_MSG_WARN([but it is already defined with value "$opal_var_scope_tmp_var_val"])
514-
AC_MSG_WARN([This usually indicates an error in configure.])
515-
AC_MSG_ERROR([Cannot continue])])
516-
done
517-
AS_UNSET([opal_var_scope_push_lineno])
518-
AS_UNSET([opal_var_scope_tmp_var])
519-
AS_UNSET([opal_var_scope_tmp_var_val])
520-
}
521-
522-
opal_var_scope_pop()
523-
{
524-
# Iterate over all the variables and unset them all
525-
for opal_var_scope_tmp_var in $[]@; do
526-
AS_UNSET([$opal_var_scope_tmp_var])
527-
done
528-
AS_UNSET([opal_var_scope_tmp_var])
529-
}])
530-
531-
# OPAL_VAR_SCOPE_PUSH(vars list)
532-
# ------------------------------
533-
# Scope-check that the vars in the space-separated vars list are not already
534-
# in use. Generate a configure-time error if a conflict is found. Note that
535-
# the in use check is defined as "defined", so even if a var in vars list is
536-
# set outside of OPAL_VAR_SCOPE_PUSH, the check will still trip.
537-
AC_DEFUN([OPAL_VAR_SCOPE_PUSH],[
538-
AC_REQUIRE([OPAL_VAR_SCOPE_INIT])dnl
539-
m4_pushdef([opal_var_scope_stack], [$1])dnl
540-
m4_foreach_w([opal_var_scope_var], [$1],
541-
[m4_set_add([opal_var_scope_active_set], opal_var_scope_var,
542-
[], [m4_fatal([OPAL_VAR_SCOPE_PUSH found the variable ]opal_var_scope_var[
543-
active in a previous scope.])])])dnl
544-
opal_var_scope_push ${LINENO} $1
545-
])dnl
546-
547-
# OPAL_VAR_SCOPE_POP()
548-
# --------------------
549-
# Unset the last set of variables set in OPAL_VAR_SCOPE_POP. Every call to
550-
# OPAL_VAR_SCOPE_PUSH should have a matched call to this macro.
551-
AC_DEFUN([OPAL_VAR_SCOPE_POP],[
552-
AC_REQUIRE([OPAL_VAR_SCOPE_INIT])dnl
553-
m4_ifdef([opal_var_scope_stack], [],
554-
[m4_fatal([OPAL_VAR_SCOPE_POP was called without a defined
555-
variable stack. This usually means that OPAL_VAR_SCOPE_POP was called more
556-
times than OPAL_VAR_SCOPE_PUSH.])])dnl
557-
m4_foreach_w([opal_var_scope_var], opal_var_scope_stack,
558-
[m4_set_remove([opal_var_scope_active_set], opal_var_scope_var)])dnl
559-
opal_var_scope_pop opal_var_scope_stack
560-
m4_popdef([opal_var_scope_stack])dnl
561-
])dnl
562-
322+
m4_copy([OAC_VAR_SCOPE_PUSH], [OPAL_VAR_SCOPE_PUSH])
323+
m4_copy([OAC_VAR_SCOPE_POP], [OPAL_VAR_SCOPE_POP])
563324

564325
dnl #######################################################################
565326
dnl #######################################################################

configure.ac

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ OPAL_CONFIGURE_SETUP
7777
opal_show_title "Configuring project_name_long"
7878
opal_show_subtitle "Prerequisites"
7979

80-
# compatibility for oac_check_package
81-
m4_copy([OPAL_LOG_COMMAND], [OAC_LOG_COMMAND])
82-
m4_copy([OPAL_LOG_MSG], [OAC_LOG_MSG])
83-
m4_copy([OPAL_APPEND], [OAC_APPEND])
84-
8580
AC_PROG_SED
8681

8782
AC_CHECK_PROG([PERL],[perl],[perl],[no])

0 commit comments

Comments
 (0)