From: Raja R Harinath Date: Sun, 1 Nov 1998 01:32:59 +0000 (+0000) Subject: Land glib-rrh-19981025-0.patch. X-Git-Tag: GLIB_1_1_5~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5900267cc7bfe0641709d43eaba28f6b0ff7ab0d;p=platform%2Fupstream%2Fglib.git Land glib-rrh-19981025-0.patch. * Makefile.am (glibconfig.h): New rule. (stamp-gc-h): New rule. Generate `glibconfig.h'. * configure.in (AM_CONFIG_HEADER): It is now `config.h'. (HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before concluding "broken wctype". (glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into config.status. * glib.h: Remove a lot of tests and defines. All these have been moved to `configure.in (glibconfig.h)'. * gerror.c: Include . * gmem.c: Likewise. * gstrfuncs.c: Likewise. * gutils.c: Likewise. This could cause some short term instability. --- diff --git a/ChangeLog b/ChangeLog index 3a1fa10..f3bad00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +1998-10-31 Raja R Harinath + + Land glib-rrh-19981025-0.patch. + * Makefile.am (glibconfig.h): New rule. + (stamp-gc-h): New rule. Generate `glibconfig.h'. + * configure.in (AM_CONFIG_HEADER): It is now `config.h'. + (HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before + concluding "broken wctype". + (glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into + config.status. + * glib.h: Remove a lot of tests and defines. All these have been + moved to `configure.in (glibconfig.h)'. + * gerror.c: Include . + * gmem.c: Likewise. + * gstrfuncs.c: Likewise. + * gutils.c: Likewise. + Sat Oct 31 05:08:26 1998 Tim Janik * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 3a1fa10..f3bad00 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,20 @@ +1998-10-31 Raja R Harinath + + Land glib-rrh-19981025-0.patch. + * Makefile.am (glibconfig.h): New rule. + (stamp-gc-h): New rule. Generate `glibconfig.h'. + * configure.in (AM_CONFIG_HEADER): It is now `config.h'. + (HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before + concluding "broken wctype". + (glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into + config.status. + * glib.h: Remove a lot of tests and defines. All these have been + moved to `configure.in (glibconfig.h)'. + * gerror.c: Include . + * gmem.c: Likewise. + * gstrfuncs.c: Likewise. + * gutils.c: Likewise. + Sat Oct 31 05:08:26 1998 Tim Janik * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3a1fa10..f3bad00 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,20 @@ +1998-10-31 Raja R Harinath + + Land glib-rrh-19981025-0.patch. + * Makefile.am (glibconfig.h): New rule. + (stamp-gc-h): New rule. Generate `glibconfig.h'. + * configure.in (AM_CONFIG_HEADER): It is now `config.h'. + (HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before + concluding "broken wctype". + (glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into + config.status. + * glib.h: Remove a lot of tests and defines. All these have been + moved to `configure.in (glibconfig.h)'. + * gerror.c: Include . + * gmem.c: Likewise. + * gstrfuncs.c: Likewise. + * gutils.c: Likewise. + Sat Oct 31 05:08:26 1998 Tim Janik * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 3a1fa10..f3bad00 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,20 @@ +1998-10-31 Raja R Harinath + + Land glib-rrh-19981025-0.patch. + * Makefile.am (glibconfig.h): New rule. + (stamp-gc-h): New rule. Generate `glibconfig.h'. + * configure.in (AM_CONFIG_HEADER): It is now `config.h'. + (HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before + concluding "broken wctype". + (glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into + config.status. + * glib.h: Remove a lot of tests and defines. All these have been + moved to `configure.in (glibconfig.h)'. + * gerror.c: Include . + * gmem.c: Likewise. + * gstrfuncs.c: Likewise. + * gutils.c: Likewise. + Sat Oct 31 05:08:26 1998 Tim Janik * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 3a1fa10..f3bad00 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,20 @@ +1998-10-31 Raja R Harinath + + Land glib-rrh-19981025-0.patch. + * Makefile.am (glibconfig.h): New rule. + (stamp-gc-h): New rule. Generate `glibconfig.h'. + * configure.in (AM_CONFIG_HEADER): It is now `config.h'. + (HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before + concluding "broken wctype". + (glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into + config.status. + * glib.h: Remove a lot of tests and defines. All these have been + moved to `configure.in (glibconfig.h)'. + * gerror.c: Include . + * gmem.c: Likewise. + * gstrfuncs.c: Likewise. + * gutils.c: Likewise. + Sat Oct 31 05:08:26 1998 Tim Janik * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 3a1fa10..f3bad00 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,20 @@ +1998-10-31 Raja R Harinath + + Land glib-rrh-19981025-0.patch. + * Makefile.am (glibconfig.h): New rule. + (stamp-gc-h): New rule. Generate `glibconfig.h'. + * configure.in (AM_CONFIG_HEADER): It is now `config.h'. + (HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before + concluding "broken wctype". + (glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into + config.status. + * glib.h: Remove a lot of tests and defines. All these have been + moved to `configure.in (glibconfig.h)'. + * gerror.c: Include . + * gmem.c: Likewise. + * gstrfuncs.c: Likewise. + * gutils.c: Likewise. + Sat Oct 31 05:08:26 1998 Tim Janik * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 3a1fa10..f3bad00 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,20 @@ +1998-10-31 Raja R Harinath + + Land glib-rrh-19981025-0.patch. + * Makefile.am (glibconfig.h): New rule. + (stamp-gc-h): New rule. Generate `glibconfig.h'. + * configure.in (AM_CONFIG_HEADER): It is now `config.h'. + (HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before + concluding "broken wctype". + (glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into + config.status. + * glib.h: Remove a lot of tests and defines. All these have been + moved to `configure.in (glibconfig.h)'. + * gerror.c: Include . + * gmem.c: Likewise. + * gstrfuncs.c: Likewise. + * gutils.c: Likewise. + Sat Oct 31 05:08:26 1998 Tim Janik * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3a1fa10..f3bad00 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,20 @@ +1998-10-31 Raja R Harinath + + Land glib-rrh-19981025-0.patch. + * Makefile.am (glibconfig.h): New rule. + (stamp-gc-h): New rule. Generate `glibconfig.h'. + * configure.in (AM_CONFIG_HEADER): It is now `config.h'. + (HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before + concluding "broken wctype". + (glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into + config.status. + * glib.h: Remove a lot of tests and defines. All these have been + moved to `configure.in (glibconfig.h)'. + * gerror.c: Include . + * gmem.c: Likewise. + * gstrfuncs.c: Likewise. + * gutils.c: Likewise. + Sat Oct 31 05:08:26 1998 Tim Janik * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. diff --git a/Makefile.am b/Makefile.am index 0483110..75e4483 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,10 @@ ## Process this file with automake to produce Makefile.in +# build . first, then SUBDIRS SUBDIRS = gmodule docs +all-recursive-am: all-am +# alpha `automake' supports this better +#SUBDIRS = . gmodule docs configincludedir = $(pkglibdir)/include @@ -20,10 +24,6 @@ EXTRA_DIST = \ makefile.msc \ glibconfig.h.win32 - -# build . first, then SUBDIRS -all-recursive-am: all-am - lib_LTLIBRARIES = libglib.la libglib_la_SOURCES = \ @@ -54,6 +54,13 @@ include_HEADERS = \ configinclude_DATA = \ glibconfig.h +BUILT_SOURCES = stamp-gc-h #note: not glibconfig.h +glibconfig.h: stamp-gc-h + @: +stamp-gc-h: config.status + CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=glibconfig.h ./config.status + echo timestamp > stamp-gc-h + libglib_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) INCLUDES = -I$(top_srcdir) diff --git a/configure.in b/configure.in index d683c7c..097a3d1 100644 --- a/configure.in +++ b/configure.in @@ -40,7 +40,7 @@ PACKAGE=glib AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define) # Specify a configuration file -AM_CONFIG_HEADER(glibconfig.h) +AM_CONFIG_HEADER(config.h) AC_DEFINE_UNQUOTED(GLIB_MAJOR_VERSION, $GLIB_MAJOR_VERSION) AC_DEFINE_UNQUOTED(GLIB_MINOR_VERSION, $GLIB_MINOR_VERSION) @@ -97,21 +97,26 @@ AC_PROG_CC AM_PROG_CC_STDC AC_PROG_INSTALL -if eval "test x$GCC = xyes"; then - if eval test -z \"`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`\" ; then - CFLAGS="$CFLAGS -Wall" - fi - - if eval "test x$enable_ansi = xyes"; then - if eval test -z \"`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`\" ; then - CFLAGS="$CFLAGS -ansi" - fi - - if eval test -z \"`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`\" ; then - CFLAGS="$CFLAGS -pedantic" - fi +changequote(,)dnl +if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wall" ;; + esac + + if test "x$enable_ansi" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -ansi" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -pedantic" ;; + esac fi fi +changequote([,])dnl dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R) AC_MSG_CHECKING([for extra flags to get ANSI library prototypes]) @@ -270,31 +275,34 @@ else fi fi -# This stuff is here, only so that we can define these -# things in glibconfig.h. If ../config.h was installed -# (under some other name?) then the definitions would -# belong there. (They are only used in GDK) +# These are used only in GDK (gdki18n.h) +# This stuff is here only so that we can define these +# things in glibconfig.h. If gtk+ started using an installed +# gdkconfig.h file, then the definitions would belong there. # Check for wchar.h AC_MSG_CHECKING(for wchar.h) -AC_TRY_CPP([#include ], gtk_ok=yes, gtk_ok=no) -if test $gtk_ok = yes; then +AC_TRY_CPP([#include ], glib_wchar_h=yes, glib_wchar_h=no) +if test $glib_wchar_h = yes; then AC_DEFINE(HAVE_WCHAR_H) fi -AC_MSG_RESULT($gtk_ok) +AC_MSG_RESULT($glib_wchar_h) # Check for wctype.h (for iswalnum) AC_MSG_CHECKING(for wctype.h) -AC_TRY_CPP([#include ], gtk_ok=yes, gtk_ok=no) -if test $gtk_ok = yes; then +AC_TRY_CPP([#include ], glib_wctype_h=yes, glib_wctype_h=no) +if test $glib_wctype_h = yes; then AC_DEFINE(HAVE_WCTYPE_H) fi -AC_MSG_RESULT($gtk_ok) +AC_MSG_RESULT($glib_wctype_h) -# The following is necessary for Linux libc-5.4.38 +oLIBS="$LIBS" +# in Solaris 2.5, `iswalnum' is in -lw +AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum)]) +# The following is necessary for Linux libc-5.4.38 AC_MSG_CHECKING(if iswalnum() and friends are properly defined) AC_TRY_LINK([#include ],[ #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H)) @@ -309,12 +317,14 @@ AC_TRY_LINK([#include ],[ # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c)) #endif iswalnum((wchar_t) 0); -], gtk_ok=yes, gtk_ok=no) +], glib_working_wctype=yes, glib_working_wctype=no) +LIBS="$oLIBS" -if test $gtk_ok = no; then +if test $glib_working_wctype = no; then AC_DEFINE(HAVE_BROKEN_WCTYPE) fi -AC_MSG_RESULT($gtk_ok) +AC_MSG_RESULT($glib_working_wctype) + dnl ********************** dnl *** va_copy checks *** @@ -496,6 +506,264 @@ AC_SUBST(G_MODULE_LDFLAGS) AC_SUBST(G_MODULE_HAVE_DLERROR) AC_SUBST(G_MODULE_NEED_USCORE) +AC_OUTPUT_COMMANDS([ + +## Generate `glibconfig.h' in two cases +## 1. `config.status' is run either explicitly, or via configure. +## Esp. not when it is run in `Makefile' to generate makefiles and +## config.h +## 2. CONFIG_OTHER is set explicitly +## +## Case 1 is difficult. We know that `automake' sets one of +## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works +## only when AM_CONFIG_HEADER is set, however. + +if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then + # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1 + CONFIG_OTHER=${CONFIG_OTHER:-glibconfig.h} +fi +case "$CONFIG_OTHER" in +*glibconfig.h*) + echo creating glibconfig.h + outfile=glibconfig.h-tmp + cat > $outfile <<\outfile_EOF +/* glibconfig.h */ +/* This is a generated file. Please modify `configure.in' */ + +#ifndef GLIBCONFIG_H +#define GLIBCONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +outfile_EOF + + if test x$glib_limits_h = xyes; then + echo '#include ' >> $outfile + fi + if test x$glib_float_h = xyes; then + echo '#include ' >> $outfile + fi + if test x$glib_values_h = xyes; then + echo '#include ' >> $outfile + fi + + cat >> $outfile <>$outfile <>$outfile <>$outfile <>$outfile <>$outfile <>$outfile + fi + + cat >>$outfile < +#endif + #include #include #include diff --git a/gerror.c b/gerror.c index 89edd91..6aeb8b5 100644 --- a/gerror.c +++ b/gerror.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/glib.h b/glib.h index 0639888..b7ee4f9 100644 --- a/glib.h +++ b/glib.h @@ -19,7 +19,41 @@ #ifndef __G_LIB_H__ #define __G_LIB_H__ -/* system specific config file +/* system specific config file glibconfig.h provides definitions for + * the extrema of many of the standard types. These are: + * + * G_MINSHORT, G_MAXSHORT + * G_MININT, G_MAXINT + * G_MINLONG, G_MAXLONG + * G_MINFLOAT, G_MAXFLOAT + * G_MINDOUBLE, G_MAXDOUBLE + * + * It also provides the following typedefs: + * + * gint8, guint8 + * gint16, guint16 + * gint32, guint32 + * gint64, guint64 + * + * It defines the G_BYTE_ORDER symbol to one of G_*_ENDIAN (see later in + * this file). + * + * And it provides a way to store and retrieve a `gint' in/from a `gpointer'. + * This is useful to pass an integer instead of a pointer to a callback. + * + * GINT_TO_POINTER(i), GUINT_TO_POINTER(i) + * GPOINTER_TO_INT(p), GPOINTER_TO_UINT(p) + * + * Finally, it provide the following wrappers to STDC functions: + * + * g_ATEXIT + * To register hooks which are executed on exit(). + * Usually a wrapper for STDC atexit. + * + * void *g_memmove(void *dest, const void *src, guint count); + * A wrapper for STDC memmove, or an implementation, if memmove doesn't + * exist. The prototype looks like the above, give or take a const, + * or size_t. */ #include @@ -81,56 +115,6 @@ #pragma warning(disable:4244) /* No possible loss of data warnings, please */ #endif /* _MSC_VER */ -/* glib provides definitions for the extrema of many - * of the standard types. These are: - * G_MINFLOAT - * G_MAXFLOAT - * G_MINDOUBLE - * G_MAXDOUBLE - * G_MINSHORT - * G_MAXSHORT - * G_MININT - * G_MAXINT - * G_MINLONG - * G_MAXLONG - * - * We include limits.h before float.h to work around a egcs 1.1 - * oddity on Solaris 2.5.1 - */ -#ifdef HAVE_LIMITS_H -# include -# define G_MINSHORT SHRT_MIN -# define G_MAXSHORT SHRT_MAX -# define G_MININT INT_MIN -# define G_MAXINT INT_MAX -# define G_MINLONG LONG_MIN -# define G_MAXLONG LONG_MAX -#elif HAVE_VALUES_H -# ifdef HAVE_FLOAT_H -# include -# endif /* HAVE_FLOAT_H */ -# define G_MINSHORT MINSHORT -# define G_MAXSHORT MAXSHORT -# define G_MININT MININT -# define G_MAXINT MAXINT -# define G_MINLONG MINLONG -# define G_MAXLONG MAXLONG -#endif /* HAVE_VALUES_H */ - -#ifdef HAVE_FLOAT_H -# include -# define G_MINFLOAT FLT_MIN -# define G_MAXFLOAT FLT_MAX -# define G_MINDOUBLE DBL_MIN -# define G_MAXDOUBLE DBL_MAX -#elif HAVE_VALUES_H -# include -# define G_MINFLOAT MINFLOAT -# define G_MAXFLOAT MAXFLOAT -# define G_MINDOUBLE MINDOUBLE -# define G_MAXDOUBLE MAXDOUBLE -#endif /* HAVE_VALUES_H */ - #ifdef __cplusplus extern "C" { @@ -304,26 +288,14 @@ extern "C" { #define G_GNUC_PRETTY_FUNCTION ("") #endif /* !__GNUC__ */ - /* we try to provide a usefull equivalent for ATEXIT if it is * not defined, but use is actually abandoned. people should * use g_atexit() instead. - * keep this in sync with gutils.c. */ #ifndef ATEXIT -# ifdef HAVE_ATEXIT -# ifdef NeXT /* @#%@! NeXTStep */ -# define ATEXIT(proc) (!atexit (proc)) -# else /* !NeXT */ -# define ATEXIT(proc) (atexit (proc)) -# endif /* !NeXT */ -# elif defined (HAVE_ON_EXIT) -# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL)) -# else -# error Could not determine proper atexit() implementation -# endif +# define ATEXIT(proc) g_ATEXIT(proc) #else -# define G_NATIVE_ATEXIT +# define G_NATIVE_ATEXIT #endif /* ATEXIT */ /* Hacker macro to place breakpoints for x86 machines. @@ -534,59 +506,6 @@ typedef double gldouble; typedef void* gpointer; typedef const void *gconstpointer; -#if (SIZEOF_CHAR == 1) -typedef signed char gint8; -typedef unsigned char guint8; -#endif /* SIZEOF_CHAR */ - -#if (SIZEOF_SHORT == 2) -typedef signed short gint16; -typedef unsigned short guint16; -#endif /* SIZEOF_SHORT */ - -#if (SIZEOF_INT == 4) -typedef signed int gint32; -typedef unsigned int guint32; -#elif (SIZEOF_LONG == 4) -typedef signed long gint32; -typedef unsigned long guint32; -#endif /* SIZEOF_INT */ - -#if (SIZEOF_LONG == 8) -#define HAVE_GINT64 1 -typedef signed long gint64; -typedef unsigned long guint64; -#elif (SIZEOF_LONG_LONG == 8) -#define HAVE_GINT64 1 -typedef signed long long gint64; -typedef unsigned long long guint64; -#else -/* No gint64 */ -#undef HAVE_GINT64 -#endif - - -/* Define macros for storing integers inside pointers - */ -#if (SIZEOF_INT == SIZEOF_VOID_P) - -#define GPOINTER_TO_INT(p) ((gint)(p)) -#define GPOINTER_TO_UINT(p) ((guint)(p)) - -#define GINT_TO_POINTER(i) ((gpointer)(i)) -#define GUINT_TO_POINTER(u) ((gpointer)(u)) - -#elif (SIZEOF_LONG == SIZEOF_VOID_P) - -#define GPOINTER_TO_INT(p) ((gint)(glong)(p)) -#define GPOINTER_TO_UINT(p) ((guint)(gulong)(p)) - -#define GINT_TO_POINTER(i) ((gpointer)(glong)(i)) -#define GUINT_TO_POINTER(u) ((gpointer)(gulong)(u)) - -#else -#error SIZEOF_VOID_P unknown - This should never happen -#endif typedef gint32 gssize; typedef guint32 gsize; @@ -601,12 +520,6 @@ typedef gint32 GTime; #define G_BIG_ENDIAN 4321 #define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */ -#ifdef WORDS_BIGENDIAN -#define G_BYTE_ORDER G_BIG_ENDIAN -#else -#define G_BYTE_ORDER G_LITTLE_ENDIAN -#endif - /* Basic bit swapping functions */ #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ @@ -1653,20 +1566,6 @@ gchar* g_dirname (const gchar *file_name); gchar* g_get_current_dir (void); gchar* g_getenv (const gchar *variable); -/* We make the assumption that if memmove isn't available, then - * bcopy will do the job. This isn't safe everywhere. (bcopy can't - * necessarily handle overlapping copies). - * Either way, g_memmove() will not return a value. - */ -#ifdef HAVE_MEMMOVE -#define g_memmove(dest, src, size) G_STMT_START { \ - memmove ((dest), (src), (size)); \ -} G_STMT_END -#else -#define g_memmove(dest, src, size) G_STMT_START { \ - bcopy ((src), (dest), (size)); \ -} G_STMT_END -#endif /* we use a GLib function as a replacement for ATEXIT, so * the programmer is not required to check the return value diff --git a/glib/Makefile.am b/glib/Makefile.am index 0483110..75e4483 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -1,6 +1,10 @@ ## Process this file with automake to produce Makefile.in +# build . first, then SUBDIRS SUBDIRS = gmodule docs +all-recursive-am: all-am +# alpha `automake' supports this better +#SUBDIRS = . gmodule docs configincludedir = $(pkglibdir)/include @@ -20,10 +24,6 @@ EXTRA_DIST = \ makefile.msc \ glibconfig.h.win32 - -# build . first, then SUBDIRS -all-recursive-am: all-am - lib_LTLIBRARIES = libglib.la libglib_la_SOURCES = \ @@ -54,6 +54,13 @@ include_HEADERS = \ configinclude_DATA = \ glibconfig.h +BUILT_SOURCES = stamp-gc-h #note: not glibconfig.h +glibconfig.h: stamp-gc-h + @: +stamp-gc-h: config.status + CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=glibconfig.h ./config.status + echo timestamp > stamp-gc-h + libglib_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) INCLUDES = -I$(top_srcdir) diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c index 89edd91..6aeb8b5 100644 --- a/glib/gbacktrace.c +++ b/glib/gbacktrace.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/glib/gerror.c b/glib/gerror.c index 89edd91..6aeb8b5 100644 --- a/glib/gerror.c +++ b/glib/gerror.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/glib/glib.h b/glib/glib.h index 0639888..b7ee4f9 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -19,7 +19,41 @@ #ifndef __G_LIB_H__ #define __G_LIB_H__ -/* system specific config file +/* system specific config file glibconfig.h provides definitions for + * the extrema of many of the standard types. These are: + * + * G_MINSHORT, G_MAXSHORT + * G_MININT, G_MAXINT + * G_MINLONG, G_MAXLONG + * G_MINFLOAT, G_MAXFLOAT + * G_MINDOUBLE, G_MAXDOUBLE + * + * It also provides the following typedefs: + * + * gint8, guint8 + * gint16, guint16 + * gint32, guint32 + * gint64, guint64 + * + * It defines the G_BYTE_ORDER symbol to one of G_*_ENDIAN (see later in + * this file). + * + * And it provides a way to store and retrieve a `gint' in/from a `gpointer'. + * This is useful to pass an integer instead of a pointer to a callback. + * + * GINT_TO_POINTER(i), GUINT_TO_POINTER(i) + * GPOINTER_TO_INT(p), GPOINTER_TO_UINT(p) + * + * Finally, it provide the following wrappers to STDC functions: + * + * g_ATEXIT + * To register hooks which are executed on exit(). + * Usually a wrapper for STDC atexit. + * + * void *g_memmove(void *dest, const void *src, guint count); + * A wrapper for STDC memmove, or an implementation, if memmove doesn't + * exist. The prototype looks like the above, give or take a const, + * or size_t. */ #include @@ -81,56 +115,6 @@ #pragma warning(disable:4244) /* No possible loss of data warnings, please */ #endif /* _MSC_VER */ -/* glib provides definitions for the extrema of many - * of the standard types. These are: - * G_MINFLOAT - * G_MAXFLOAT - * G_MINDOUBLE - * G_MAXDOUBLE - * G_MINSHORT - * G_MAXSHORT - * G_MININT - * G_MAXINT - * G_MINLONG - * G_MAXLONG - * - * We include limits.h before float.h to work around a egcs 1.1 - * oddity on Solaris 2.5.1 - */ -#ifdef HAVE_LIMITS_H -# include -# define G_MINSHORT SHRT_MIN -# define G_MAXSHORT SHRT_MAX -# define G_MININT INT_MIN -# define G_MAXINT INT_MAX -# define G_MINLONG LONG_MIN -# define G_MAXLONG LONG_MAX -#elif HAVE_VALUES_H -# ifdef HAVE_FLOAT_H -# include -# endif /* HAVE_FLOAT_H */ -# define G_MINSHORT MINSHORT -# define G_MAXSHORT MAXSHORT -# define G_MININT MININT -# define G_MAXINT MAXINT -# define G_MINLONG MINLONG -# define G_MAXLONG MAXLONG -#endif /* HAVE_VALUES_H */ - -#ifdef HAVE_FLOAT_H -# include -# define G_MINFLOAT FLT_MIN -# define G_MAXFLOAT FLT_MAX -# define G_MINDOUBLE DBL_MIN -# define G_MAXDOUBLE DBL_MAX -#elif HAVE_VALUES_H -# include -# define G_MINFLOAT MINFLOAT -# define G_MAXFLOAT MAXFLOAT -# define G_MINDOUBLE MINDOUBLE -# define G_MAXDOUBLE MAXDOUBLE -#endif /* HAVE_VALUES_H */ - #ifdef __cplusplus extern "C" { @@ -304,26 +288,14 @@ extern "C" { #define G_GNUC_PRETTY_FUNCTION ("") #endif /* !__GNUC__ */ - /* we try to provide a usefull equivalent for ATEXIT if it is * not defined, but use is actually abandoned. people should * use g_atexit() instead. - * keep this in sync with gutils.c. */ #ifndef ATEXIT -# ifdef HAVE_ATEXIT -# ifdef NeXT /* @#%@! NeXTStep */ -# define ATEXIT(proc) (!atexit (proc)) -# else /* !NeXT */ -# define ATEXIT(proc) (atexit (proc)) -# endif /* !NeXT */ -# elif defined (HAVE_ON_EXIT) -# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL)) -# else -# error Could not determine proper atexit() implementation -# endif +# define ATEXIT(proc) g_ATEXIT(proc) #else -# define G_NATIVE_ATEXIT +# define G_NATIVE_ATEXIT #endif /* ATEXIT */ /* Hacker macro to place breakpoints for x86 machines. @@ -534,59 +506,6 @@ typedef double gldouble; typedef void* gpointer; typedef const void *gconstpointer; -#if (SIZEOF_CHAR == 1) -typedef signed char gint8; -typedef unsigned char guint8; -#endif /* SIZEOF_CHAR */ - -#if (SIZEOF_SHORT == 2) -typedef signed short gint16; -typedef unsigned short guint16; -#endif /* SIZEOF_SHORT */ - -#if (SIZEOF_INT == 4) -typedef signed int gint32; -typedef unsigned int guint32; -#elif (SIZEOF_LONG == 4) -typedef signed long gint32; -typedef unsigned long guint32; -#endif /* SIZEOF_INT */ - -#if (SIZEOF_LONG == 8) -#define HAVE_GINT64 1 -typedef signed long gint64; -typedef unsigned long guint64; -#elif (SIZEOF_LONG_LONG == 8) -#define HAVE_GINT64 1 -typedef signed long long gint64; -typedef unsigned long long guint64; -#else -/* No gint64 */ -#undef HAVE_GINT64 -#endif - - -/* Define macros for storing integers inside pointers - */ -#if (SIZEOF_INT == SIZEOF_VOID_P) - -#define GPOINTER_TO_INT(p) ((gint)(p)) -#define GPOINTER_TO_UINT(p) ((guint)(p)) - -#define GINT_TO_POINTER(i) ((gpointer)(i)) -#define GUINT_TO_POINTER(u) ((gpointer)(u)) - -#elif (SIZEOF_LONG == SIZEOF_VOID_P) - -#define GPOINTER_TO_INT(p) ((gint)(glong)(p)) -#define GPOINTER_TO_UINT(p) ((guint)(gulong)(p)) - -#define GINT_TO_POINTER(i) ((gpointer)(glong)(i)) -#define GUINT_TO_POINTER(u) ((gpointer)(gulong)(u)) - -#else -#error SIZEOF_VOID_P unknown - This should never happen -#endif typedef gint32 gssize; typedef guint32 gsize; @@ -601,12 +520,6 @@ typedef gint32 GTime; #define G_BIG_ENDIAN 4321 #define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */ -#ifdef WORDS_BIGENDIAN -#define G_BYTE_ORDER G_BIG_ENDIAN -#else -#define G_BYTE_ORDER G_LITTLE_ENDIAN -#endif - /* Basic bit swapping functions */ #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ @@ -1653,20 +1566,6 @@ gchar* g_dirname (const gchar *file_name); gchar* g_get_current_dir (void); gchar* g_getenv (const gchar *variable); -/* We make the assumption that if memmove isn't available, then - * bcopy will do the job. This isn't safe everywhere. (bcopy can't - * necessarily handle overlapping copies). - * Either way, g_memmove() will not return a value. - */ -#ifdef HAVE_MEMMOVE -#define g_memmove(dest, src, size) G_STMT_START { \ - memmove ((dest), (src), (size)); \ -} G_STMT_END -#else -#define g_memmove(dest, src, size) G_STMT_START { \ - bcopy ((src), (dest), (size)); \ -} G_STMT_END -#endif /* we use a GLib function as a replacement for ATEXIT, so * the programmer is not required to check the return value diff --git a/glib/gmem.c b/glib/gmem.c index 179d8d2..cd7f47e 100644 --- a/glib/gmem.c +++ b/glib/gmem.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include "glib.h" diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index 37d3a8c..01816b3 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/glib/gutils.c b/glib/gutils.c index 4062243..a484821 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include "glibconfig.h" #ifdef HAVE_UNISTD_H diff --git a/gmem.c b/gmem.c index 179d8d2..cd7f47e 100644 --- a/gmem.c +++ b/gmem.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include "glib.h" diff --git a/gstrfuncs.c b/gstrfuncs.c index 37d3a8c..01816b3 100644 --- a/gstrfuncs.c +++ b/gstrfuncs.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/gutils.c b/gutils.c index 4062243..a484821 100644 --- a/gutils.c +++ b/gutils.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include "glibconfig.h" #ifdef HAVE_UNISTD_H