Skip to content

Commit

Permalink
Rewrite TSRM_CHECK_GCC_ARG to cache its result
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Schumann committed Dec 30, 1999
1 parent 06dda03 commit 9aef667
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions TSRM/tsrm.m4
Original file line number Original file line Diff line number Diff line change
@@ -1,14 +1,24 @@

dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
AC_DEFUN(TSRM_CHECK_GCC_ARG,[ AC_DEFUN(TSRM_CHECK_GCC_ARG,[
AC_MSG_CHECKING(whether $CC supports $1) gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
> conftest.c AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
echo 'void somefunc() { };' > conftest.c
cmd='$CC $1 -c conftest.c' cmd='$CC $1 -c conftest.c'
if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
$2=no ac_result=no
else else
$2=yes ac_result=yes
fi fi
AC_MSG_RESULT($$2) eval $gcc_arg_name=$ac_result
rm -f conftest.* rm -f conftest.*
])
if eval test "\$$gcc_arg_name" = "yes"; then
$2
else
:
$3
fi
]) ])


AC_DEFUN(TSRM_BASIC_CHECKS,[ AC_DEFUN(TSRM_BASIC_CHECKS,[
Expand Down Expand Up @@ -46,13 +56,12 @@ AC_DEFUN(TSRM_CHECK_PTHREADS,[
old_CFLAGS="$CFLAGS" old_CFLAGS="$CFLAGS"
if test -n "$GCC"; then if test -n "$GCC"; then
for i in -pthread -pthreads; do TSRM_CHECK_GCC_ARG(-pthread, [
TSRM_CHECK_GCC_ARG($i, gcc_opt) CFLAGS="$CFLAGS -pthread"
if test "$gcc_opt" = "yes"; then ],[
CFLAGS="$CFLAGS $i" TSRM_CHECK_GCC_ARG(-pthreads, [
break CFLAGS="$CFLAGS -pthreads"
fi ])])
done
fi fi
AC_CHECK_FUNCS(pthread_kill) AC_CHECK_FUNCS(pthread_kill)
Expand Down

0 comments on commit 9aef667

Please sign in to comment.