summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/acinclude.m431
-rw-r--r--m4/threads.m421
2 files changed, 35 insertions, 17 deletions
diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
index c9c5f11f2b2..d119a61d8b0 100644
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -66,17 +66,21 @@ dnl Usage: ACE_TRY_COMPILE(COMPILER-FLAGS, INCLUDES, FUNCTION-BODY,
dnl [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
AC_DEFUN(ACE_TRY_COMPILE, dnl
[
- ace_pre_try_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $1"
-
- ace_pre_try_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $1"
+ ifelse(AC_LANG, [CPLUSPLUS],
+ [
+ ace_pre_try_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $1"
+ ],
+ [
+ ace_pre_try_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ ])
AC_TRY_COMPILE($2, $3, $4, $5)
dnl Restore the C++ and C flags
- CXXFLAGS="$ace_pre_try_CXXFLAGS"
- CFLAGS="$ace_pre_try_CFLAGS"
+ ifelse(AC_LANG, [CPLUSPLUS],
+ [CXXFLAGS="$ace_pre_try_CXXFLAGS"],[CFLAGS="$ace_pre_try_CFLAGS"])
])
@@ -90,12 +94,22 @@ dnl header when doing an AC_TRY_COMPILE.
dnl Usage: ACE_USE_TEMP_FILE(TEMP-FILE-TO-CREATE, COMMANDS-THAT-WILL-USE-IT)
AC_DEFUN(ACE_USE_TEMP_FILE, dnl
[
+ test -d ./$1 && AC_MSG_ERROR([cannot create file: $acetmp is a directory])
test -f ${srcdir}/$1 && mv ${srcdir}/$1 ${srcdir}/$1.conf
touch ${srcdir}/$1
if test ${srcdir}/$1 != "./$1"; then
test -f ./$1 && mv ./$1 ./$1.conf
+ dnl Create all of the sub-directories (assume "mkdir -p" is not portable).
+ acetmp="."
+changequote(, )dnl
+ for ace_dir in `echo $1 | sed -e 's,/[^/][^/]*\$,,' -e 's,/, ,g'`; do
+changequote([, ])dnl
+ acetmp="$acetmp/$ace_dir"
+ test -f $acetmp && AC_MSG_ERROR([cannot create directory: $acetmp])
+ test -d $acetmp || mkdir $acetmp
+ done
touch ./$1
fi
@@ -111,6 +125,9 @@ AC_DEFUN(ACE_USE_TEMP_FILE, dnl
if test -f ./$1.conf; then
mv ./$1.conf ./$1
else
+ dnl Remove the file. Any sub-directories will not be removed
+ dnl since we have no way to tell if they existed prior to the
+ dnl creation of this file.
rm ./$1
fi
fi
diff --git a/m4/threads.m4 b/m4/threads.m4
index 8a8d778b9bb..373c50b978b 100644
--- a/m4/threads.m4
+++ b/m4/threads.m4
@@ -257,12 +257,12 @@ AC_DEFUN(ACE_SEARCH_THREAD_FLAGS, dnl
ACE_CACHE_CHECK(for compiler thread flag,
ace_cv_thread_flag_search,
[
- ace_save_CXXFLAGS="$CXXFLAGS"
- ace_save_CFLAGS="$CFLAGS"
+ ifelse(AC_LANG, [CPLUSPLUS],
+ [ace_save_CXXFLAGS="$CXXFLAGS"],[ace_save_CFLAGS="$CFLAGS"])
for i in $1; do
- CXXFLAGS="$CXXFLAGS -$i"
- CFLAGS="$CFLAGS -$i"
+ ifelse(AC_LANG, [CPLUSPLUS],
+ [CXXFLAGS="$CXXFLAGS -$i"],[CFLAGS="$CFLAGS -$i"])
ACE_CHECK_THREAD_FLAGS(
[
@@ -276,20 +276,21 @@ AC_DEFUN(ACE_SEARCH_THREAD_FLAGS, dnl
])
dnl Reset the flags for the next flag check.
- CXXFLAGS="$ace_save_CXXFLAGS"
- CFLAGS="$ace_save_CFLAGS"
+ ifelse(AC_LANG, [CPLUSPLUS],
+ [CXXFLAGS="$ace_save_CXXFLAGS"],[CFLAGS="$ace_save_CFLAGS"])
done
dnl Reset the flags to a consistent state.
dnl This prevents duplicate flags from being added to
dnl the C/CXXFLAGS variable.
- CXXFLAGS="$ace_save_CXXFLAGS"
- CFLAGS="$ace_save_CFLAGS"
+ ifelse(AC_LANG, [CPLUSPLUS],
+ [CXXFLAGS="$ace_save_CXXFLAGS"],[CFLAGS="$ace_save_CFLAGS"])
],
[
dnl Add the found/cached thread flag to the C/CXXFLAGS variables
- CXXFLAGS="$CXXFLAGS $ace_cv_thread_flag_search"
- CFLAGS="$CFLAGS $ace_cv_thread_flag_search"
+ ifelse(AC_LANG, [CPLUSPLUS],
+ [CXXFLAGS="$CXXFLAGS $ace_cv_thread_flag_search"],
+ [CFLAGS="$CFLAGS $ace_cv_thread_flag_search"])
$2
],