Also try to fix the warnings on the GNU C Library.
Still a lot of work and testing to be done here, but making progress.
svn path=/trunk/yasm/; revision=204
/* combined test for fork/way/msg* */
#undef USE_FORKWAITMSG
+/* Check for GNU C Library */
+#undef HAVE_GNU_C_LIBRARY
+
@BOTTOM@
#endif /* YASM_CONFIG_H */
@echo "Run configure with --enable-check before running make check"
@exit 1
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@ @CHECK_CFLAGS@
EXTRA_DIST = \
NEWS \
AM_PROG_CC_STDC
+if ${dev}; then
+ DEVFLAGS="-g"
+fi
+
+if test "$GCC" = yes; then
+ ANSI_CFLAGS="-ansi -pedantic -Wall $DEVFLAGS"
+else
+ ANSI_CFLAGS="$DEVFLAGS"
+fi
+AC_SUBST(ANSI_CFLAGS)
+
ALL_LINGUAS=""
AM_GNU_GETTEXT
AC_CHECK_HEADERS(limits.h sys/queue.h sys/cdefs.h)
+# Check for GNU C Library
+AC_CHECK_HEADERS(features.h)
+if test "$ac_cv_header_features_h" = yes; then
+ AC_MSG_CHECKING([for GNU C Library])
+ AC_EGREP_CPP(gnulib,
+ [#include <features.h>
+ #ifdef __GNU_LIBRARY__
+ gnulib
+ #endif
+ ], have_gnulib=yes, have_gnulib=no)
+ AC_MSG_RESULT([$have_gnulib])
+ if test "$have_gnulib" = yes; then
+ AC_DEFINE(HAVE_GNU_C_LIBRARY)
+ fi
+fi
+
# Check for stuff wanted by the test suite. None of this is required.
+CHECK_CFLAGS=
if ${check}; then
AC_CHECK_FUNCS(fork wait msgctl msgget msgrcv msgsnd strerror)
if test "$ac_cv_func_fork" = yes &&
test "$ac_cv_func_msgrcv" = yes &&
test "$ac_cv_func_msgsnd" = yes; then
AC_DEFINE(USE_FORKWAITMSG)
+ CHECK_CFLAGS="-D_SVID_SOURCE"
fi
AC_TYPE_PID_T
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(sys/types.h sys/ipc.h sys/msg.h unistd.h)
fi
+AC_SUBST(CHECK_CFLAGS)
# Check for some target-specific stuff
case "$host" in
AM_PROG_CC_STDC
+if ${dev}; then
+ DEVFLAGS="-g"
+fi
+
+if test "$GCC" = yes; then
+ ANSI_CFLAGS="-ansi -pedantic -Wall $DEVFLAGS"
+else
+ ANSI_CFLAGS="$DEVFLAGS"
+fi
+AC_SUBST(ANSI_CFLAGS)
+
ALL_LINGUAS=""
AM_GNU_GETTEXT
AC_CHECK_HEADERS(limits.h sys/queue.h sys/cdefs.h)
+# Check for GNU C Library
+AC_CHECK_HEADERS(features.h)
+if test "$ac_cv_header_features_h" = yes; then
+ AC_MSG_CHECKING([for GNU C Library])
+ AC_EGREP_CPP(gnulib,
+ [#include <features.h>
+ #ifdef __GNU_LIBRARY__
+ gnulib
+ #endif
+ ], have_gnulib=yes, have_gnulib=no)
+ AC_MSG_RESULT([$have_gnulib])
+ if test "$have_gnulib" = yes; then
+ AC_DEFINE(HAVE_GNU_C_LIBRARY)
+ fi
+fi
+
# Check for stuff wanted by the test suite. None of this is required.
+CHECK_CFLAGS=
if ${check}; then
AC_CHECK_FUNCS(fork wait msgctl msgget msgrcv msgsnd strerror)
if test "$ac_cv_func_fork" = yes &&
test "$ac_cv_func_msgrcv" = yes &&
test "$ac_cv_func_msgsnd" = yes; then
AC_DEFINE(USE_FORKWAITMSG)
+ CHECK_CFLAGS="-D_SVID_SOURCE"
fi
AC_TYPE_PID_T
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(sys/types.h sys/ipc.h sys/msg.h unistd.h)
fi
+AC_SUBST(CHECK_CFLAGS)
# Check for some target-specific stuff
case "$host" in
# $IdPath$
+CFLAGS = @ANSI_CFLAGS@
+
if CHECK
TESTS = \
bytecode_test
#ifndef YASM_UTIL_H
#define YASM_UTIL_H
-#ifndef HAVE_STRDUP
+#if !defined(HAVE_STRDUP) || defined(HAVE_GNU_C_LIBRARY)
char *strdup(const char *str);
#endif
-#ifndef HAVE_STRTOUL
+#if !defined(HAVE_STRTOUL) || defined(HAVE_GNU_C_LIBRARY)
unsigned long strtoul(const char *nptr, char **endptr, int base);
#endif
# define strcasecmp(x, y) strncmpi(x, y)
# else
# define USE_OUR_OWN_STRCASECMP
+# endif
+#endif
+
+#if defined(USE_OUR_OWN_STRCASECMP) || defined(HAVE_GNU_C_LIBRARY)
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
-# endif
#endif
-#ifndef HAVE_TOASCII
+#if !defined(HAVE_TOASCII) || defined(HAVE_GNU_C_LIBRARY)
# define toascii(c) ((c) & 0x7F)
#endif
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
token.l bison.y: $(top_srcdir)/src/instrs.dat token.l.in bison.y.in gen_instr.pl
if DEV
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
optimizer.h \
strcasecmp.c
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
EXTRA_DIST = \
instrs.dat \
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
token.l bison.y: $(top_srcdir)/src/instrs.dat token.l.in bison.y.in gen_instr.pl
if DEV
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
# $IdPath$
+CFLAGS = @ANSI_CFLAGS@
+
if CHECK
TESTS = \
bytecode_test
#ifndef YASM_UTIL_H
#define YASM_UTIL_H
-#ifndef HAVE_STRDUP
+#if !defined(HAVE_STRDUP) || defined(HAVE_GNU_C_LIBRARY)
char *strdup(const char *str);
#endif
-#ifndef HAVE_STRTOUL
+#if !defined(HAVE_STRTOUL) || defined(HAVE_GNU_C_LIBRARY)
unsigned long strtoul(const char *nptr, char **endptr, int base);
#endif
# define strcasecmp(x, y) strncmpi(x, y)
# else
# define USE_OUR_OWN_STRCASECMP
+# endif
+#endif
+
+#if defined(USE_OUR_OWN_STRCASECMP) || defined(HAVE_GNU_C_LIBRARY)
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
-# endif
#endif
-#ifndef HAVE_TOASCII
+#if !defined(HAVE_TOASCII) || defined(HAVE_GNU_C_LIBRARY)
# define toascii(c) ((c) & 0x7F)
#endif
# $IdPath$
+CFLAGS = @ANSI_CFLAGS@
+
if CHECK
#TESTS = \
#ifndef YASM_UTIL_H
#define YASM_UTIL_H
-#ifndef HAVE_STRDUP
+#if !defined(HAVE_STRDUP) || defined(HAVE_GNU_C_LIBRARY)
char *strdup(const char *str);
#endif
-#ifndef HAVE_STRTOUL
+#if !defined(HAVE_STRTOUL) || defined(HAVE_GNU_C_LIBRARY)
unsigned long strtoul(const char *nptr, char **endptr, int base);
#endif
# define strcasecmp(x, y) strncmpi(x, y)
# else
# define USE_OUR_OWN_STRCASECMP
+# endif
+#endif
+
+#if defined(USE_OUR_OWN_STRCASECMP) || defined(HAVE_GNU_C_LIBRARY)
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
-# endif
#endif
-#ifndef HAVE_TOASCII
+#if !defined(HAVE_TOASCII) || defined(HAVE_GNU_C_LIBRARY)
# define toascii(c) ((c) & 0x7F)
#endif