Skip to content

Commit

Permalink
Add tests for vaiadic macros, libgen.h, sys/wait.h, basename(),
Browse files Browse the repository at this point in the history
getopt() and ffs().
  • Loading branch information
gmcgarry committed Apr 15, 2008
1 parent 93f9b05 commit 405cf8d
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 5 deletions.
18 changes: 18 additions & 0 deletions config.h.in
Expand Up @@ -33,9 +33,24 @@
*/
#undef HAVE_ALLOCA_H

/* Define to 1 if you have the `basename' function. */
#undef HAVE_BASENAME

/* Define to 1 if your compiler supports GNU GCC-style variadic macros */
#undef HAVE_CPP_VARARG_MACRO_GCC

/* Define to 1 if you have the `ffs' function. */
#undef HAVE_FFS

/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the <libgen.h> header file. */
#undef HAVE_LIBGEN_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

Expand Down Expand Up @@ -66,6 +81,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

Expand Down
136 changes: 133 additions & 3 deletions configure
Expand Up @@ -1594,7 +1594,7 @@ case "$target_os" in
abi=elf
case "$target_cpu" in
i?86) targmach=i386 ;;
powerpc*) targmach=powerpc ;;
powerpc*) targmach=powerpc endian=big ;;
esac
;;
Expand Down Expand Up @@ -4073,6 +4073,61 @@ echo "${ECHO_T}no" >&6
fi
echo "$as_me:$LINENO: checking for GNU GCC variadic macro support" >&5
echo $ECHO_N "checking for GNU GCC variadic macro support... $ECHO_C" >&6
if test "${ac_have_variadic+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#define macro(a, b...) func(a, b)
int func(int a, int b, int c);
int test() { return macro(1, 2, 3); }
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_have_variadic=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_have_varadic=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_have_variadic" >&5
echo "${ECHO_T}$ac_have_variadic" >&6
if test $ac_have_variadic = yes ; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_CPP_VARARG_MACRO_GCC 1
_ACEOF
fi
# Checks for libraries.
# Checks for header files.
Expand Down Expand Up @@ -4567,7 +4622,8 @@ done
for ac_header in string.h alloca.h
for ac_header in string.h alloca.h libgen.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
Expand Down Expand Up @@ -4716,6 +4772,77 @@ fi
done
echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6
if test "${ac_cv_header_sys_wait_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/wait.h>
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif
int
main ()
{
int s;
wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_header_sys_wait_h=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_header_sys_wait_h=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
if test $ac_cv_header_sys_wait_h = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_WAIT_H 1
_ACEOF
fi
# Checks for library functions.
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
Expand Down Expand Up @@ -5083,7 +5210,10 @@ fi
for ac_func in mkstemp strlcat strlcpy
for ac_func in mkstemp strlcat strlcpy basename getopt ffs
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
Expand Down
17 changes: 15 additions & 2 deletions configure.ac
Expand Up @@ -210,18 +210,31 @@ fi

AC_CHECK_PROG(strip,strip,yes,no)

AC_CACHE_CHECK([for GNU GCC variadic macro support], ac_have_variadic, [
AC_COMPILE_IFELSE([
#define macro(a, b...) func(a, b)
int func(int a, int b, int c);
int test() { return macro(1, 2, 3); }
], [ ac_have_variadic=yes ], [ac_have_varadic=no])])
if test $ac_have_variadic = yes ; then
AC_DEFINE([HAVE_CPP_VARARG_MACRO_GCC], 1,
[Define to 1 if your compiler supports GNU GCC-style variadic macros])
fi


# Checks for libraries.

# Checks for header files.
# AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
AC_CHECK_HEADERS([string.h alloca.h])
AC_CHECK_HEADERS([string.h alloca.h libgen.h])
AC_HEADER_SYS_WAIT

# Checks for library functions.
AC_FUNC_ALLOCA
## AC_FUNC_STRTOD
# AC_FUNC_VPRINTF
# AC_CHECK_FUNCS([memset strchr strdup strrchr strtol])
AC_CHECK_FUNCS([mkstemp strlcat strlcpy])
AC_CHECK_FUNCS([mkstemp strlcat strlcpy basename getopt ffs])

AC_SUBST(targos)
AC_SUBST(targmach)
Expand Down

0 comments on commit 405cf8d

Please sign in to comment.