]> granicus.if.org Git - yasm/commitdiff
Try to fix configure and automake files so everything builds a bit cleaner.
authorPeter Johnson <peter@tortall.net>
Thu, 20 Sep 2001 06:25:05 +0000 (06:25 -0000)
committerPeter Johnson <peter@tortall.net>
Thu, 20 Sep 2001 06:25:05 +0000 (06:25 -0000)
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

21 files changed:
acconfig.h
check/Makefile.am
configure.ac
configure.in
libyasm/tests/Makefile.am
libyasm/util.h
modules/objfmts/dbg/Makefile.am
modules/optimizers/basic/Makefile.am
modules/optimizers/dbg/Makefile.am
modules/parsers/nasm/Makefile.am
modules/preprocs/raw/Makefile.am
src/Makefile.am
src/objfmts/dbg/Makefile.am
src/optimizers/basic/Makefile.am
src/optimizers/dbg/Makefile.am
src/parsers/nasm/Makefile.am
src/preprocs/raw/Makefile.am
src/tests/Makefile.am
src/util.h
tests/Makefile.am
util.h

index 50f402f2225d1c7cb26d706873d9153e44aaa73b..2d3917e9594587696d5f85c401ea1579b4c84a9d 100644 (file)
@@ -21,6 +21,9 @@
 /* combined test for fork/way/msg* */
 #undef USE_FORKWAITMSG
 
+/* Check for GNU C Library */
+#undef HAVE_GNU_C_LIBRARY
+
 @BOTTOM@
 
 #endif /* YASM_CONFIG_H */
index f6b205a7c7c6e179625ead7ddc2014a9663bae43..14634626094c1bdbc9d5280b560a0f11e7e0a190 100644 (file)
@@ -28,9 +28,7 @@ nocheck_error:
        @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    \
index 03227f5bcff39b7cb67166d5d7e594fe4eeeabba..ab07d5de256dec64602b4d5bb4c294cb8643f9ee 100644 (file)
@@ -28,6 +28,17 @@ AM_CONDITIONAL(CHECK, test x$check = xtrue)
 
 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
 
@@ -74,7 +85,24 @@ AC_REPLACE_FUNCS(strdup strtoul)
 
 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 &&
@@ -84,11 +112,13 @@ if ${check}; then
           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
index 03227f5bcff39b7cb67166d5d7e594fe4eeeabba..ab07d5de256dec64602b4d5bb4c294cb8643f9ee 100644 (file)
@@ -28,6 +28,17 @@ AM_CONDITIONAL(CHECK, test x$check = xtrue)
 
 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
 
@@ -74,7 +85,24 @@ AC_REPLACE_FUNCS(strdup strtoul)
 
 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 &&
@@ -84,11 +112,13 @@ if ${check}; then
           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
index 7dc55967c8aa8e428fe19e2b5d94babd235b2a27..9938959cf303e0a7d647a5588b8ab30da7a2477f 100644 (file)
@@ -1,5 +1,7 @@
 # $IdPath$
 
+CFLAGS = @ANSI_CFLAGS@
+
 if CHECK
 TESTS = \
        bytecode_test
index 0d56e213996e37f8ae799724c8409f96b832985f..320a957587e134a5ea15270f3e6de31a3fb8ea2e 100644 (file)
 #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
 
@@ -39,12 +39,15 @@ unsigned long strtoul(const char *nptr, char **endptr, int base);
 #  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
 
index 8c74d03e2c638ffd0e9cc4a83a7bc5ed24b144fb..6cbd9931086a2fa39b1c448698054bfa7a4ae073 100644 (file)
@@ -9,6 +9,4 @@ INCLUDES = \
        -I$(top_srcdir)/src     \
        -I$(top_builddir)/intl
 
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
index 351ce73b216d48a02eec57458f1247a196346a70..31ea1c2ae94aa20e5eb42030b1694b69468aa965 100644 (file)
@@ -9,6 +9,4 @@ INCLUDES = \
        -I$(top_srcdir)/src     \
        -I$(top_builddir)/intl
 
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
index 351ce73b216d48a02eec57458f1247a196346a70..31ea1c2ae94aa20e5eb42030b1694b69468aa965 100644 (file)
@@ -9,6 +9,4 @@ INCLUDES = \
        -I$(top_srcdir)/src     \
        -I$(top_builddir)/intl
 
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
index fd39447292d71c78bb61174e7b23e093b1d721c5..0328aa5de6ffe191a41a5d64b50dd9d6e8922acd 100644 (file)
@@ -31,9 +31,7 @@ INCLUDES = \
        -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
index 55874d15881d21fedf956414c60ce7dd1d9f04ad..6b9c8ce7b89159d875e41dbaabe1d790db6edac1 100644 (file)
@@ -9,6 +9,4 @@ INCLUDES = \
        -I$(top_srcdir)/src     \
        -I$(top_builddir)/intl
 
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
index 8e9cc755d384faf3c7d4b2cbca936b3adab095b6..f97493d8296a050754c93183096f89c3af61e578 100644 (file)
@@ -41,9 +41,7 @@ libyasm_a_SOURCES = \
        optimizer.h             \
        strcasecmp.c
 
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
 
 EXTRA_DIST = \
        instrs.dat              \
index 8c74d03e2c638ffd0e9cc4a83a7bc5ed24b144fb..6cbd9931086a2fa39b1c448698054bfa7a4ae073 100644 (file)
@@ -9,6 +9,4 @@ INCLUDES = \
        -I$(top_srcdir)/src     \
        -I$(top_builddir)/intl
 
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
index 351ce73b216d48a02eec57458f1247a196346a70..31ea1c2ae94aa20e5eb42030b1694b69468aa965 100644 (file)
@@ -9,6 +9,4 @@ INCLUDES = \
        -I$(top_srcdir)/src     \
        -I$(top_builddir)/intl
 
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
index 351ce73b216d48a02eec57458f1247a196346a70..31ea1c2ae94aa20e5eb42030b1694b69468aa965 100644 (file)
@@ -9,6 +9,4 @@ INCLUDES = \
        -I$(top_srcdir)/src     \
        -I$(top_builddir)/intl
 
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
index fd39447292d71c78bb61174e7b23e093b1d721c5..0328aa5de6ffe191a41a5d64b50dd9d6e8922acd 100644 (file)
@@ -31,9 +31,7 @@ INCLUDES = \
        -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
index 55874d15881d21fedf956414c60ce7dd1d9f04ad..6b9c8ce7b89159d875e41dbaabe1d790db6edac1 100644 (file)
@@ -9,6 +9,4 @@ INCLUDES = \
        -I$(top_srcdir)/src     \
        -I$(top_builddir)/intl
 
-if DEV
-CFLAGS = -ansi -pedantic -Wall -g
-endif
+CFLAGS = @ANSI_CFLAGS@
index 7dc55967c8aa8e428fe19e2b5d94babd235b2a27..9938959cf303e0a7d647a5588b8ab30da7a2477f 100644 (file)
@@ -1,5 +1,7 @@
 # $IdPath$
 
+CFLAGS = @ANSI_CFLAGS@
+
 if CHECK
 TESTS = \
        bytecode_test
index 0d56e213996e37f8ae799724c8409f96b832985f..320a957587e134a5ea15270f3e6de31a3fb8ea2e 100644 (file)
 #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
 
@@ -39,12 +39,15 @@ unsigned long strtoul(const char *nptr, char **endptr, int base);
 #  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
 
index 5a72427b2b4ff1c8c200f2e39fc95c9200b3186c..537a2069e4ffa2ac6566d4e5a1442d023617f682 100644 (file)
@@ -1,5 +1,7 @@
 # $IdPath$
 
+CFLAGS = @ANSI_CFLAGS@
+
 if CHECK
 #TESTS = \
 
diff --git a/util.h b/util.h
index 0d56e213996e37f8ae799724c8409f96b832985f..320a957587e134a5ea15270f3e6de31a3fb8ea2e 100644 (file)
--- a/util.h
+++ b/util.h
 #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
 
@@ -39,12 +39,15 @@ unsigned long strtoul(const char *nptr, char **endptr, int base);
 #  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