From: Bruno Haible Date: Tue, 23 Sep 2003 10:14:26 +0000 (+0000) Subject: Portability to SunOS 4, which lacks atexit(). X-Git-Tag: v0.13~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e2f4d76f7f6fd6c861231754db74cd313865933;p=thirdparty%2Fgettext.git Portability to SunOS 4, which lacks atexit(). --- diff --git a/gettext-tools/ChangeLog b/gettext-tools/ChangeLog index 9ed08e3cc..6be53021c 100644 --- a/gettext-tools/ChangeLog +++ b/gettext-tools/ChangeLog @@ -1,3 +1,8 @@ +2003-09-16 Bruno Haible + + Portability to SunOS 4. + * configure.ac: Also check for atexit. + 2003-09-14 Bruno Haible * windows/gettextlib.def: Export fwriteerror. diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac index 97c1c9c7b..f7c44a1fc 100644 --- a/gettext-tools/configure.ac +++ b/gettext-tools/configure.ac @@ -103,7 +103,7 @@ gl_FUNC_ALLOCA AC_FUNC_VPRINTF AC_CHECK_FUNCS([chown getcwd posix_spawn raise select strerror strtoul uname \ utime utimes]) -AC_REPLACE_FUNCS([memmove memset stpcpy strcspn \ +AC_REPLACE_FUNCS([atexit memmove memset stpcpy strcspn \ strcasecmp strncasecmp strpbrk strstr vasprintf]) AM_FUNC_GETLINE if test $am_cv_func_working_getline != yes; then diff --git a/gettext-tools/lib/ChangeLog b/gettext-tools/lib/ChangeLog index bd837290d..fce03c96f 100644 --- a/gettext-tools/lib/ChangeLog +++ b/gettext-tools/lib/ChangeLog @@ -1,3 +1,9 @@ +2003-09-16 Bruno Haible + + Portability to SunOS 4. + * atexit.c: New file, from gnulib with modifications. + * Makefile.am (LIBADD_SOURCE): Add atexit.c. + 2003-09-14 Bruno Haible * closeout.c: Include fwriteerror.h. diff --git a/gettext-tools/lib/Makefile.am b/gettext-tools/lib/Makefile.am index b6addbb80..bbdd05935 100644 --- a/gettext-tools/lib/Makefile.am +++ b/gettext-tools/lib/Makefile.am @@ -78,6 +78,7 @@ libgettextlib_la_SOURCES = \ LIBADD_SOURCE = \ alloca.c \ + atexit.c \ canonicalize.h canonicalize.c \ fnmatch.c \ getline.h getline.c \ diff --git a/gettext-tools/lib/atexit.c b/gettext-tools/lib/atexit.c new file mode 100644 index 000000000..fdc7b4308 --- /dev/null +++ b/gettext-tools/lib/atexit.c @@ -0,0 +1,15 @@ +/* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */ +/* This function is in the public domain. --Mike Stump. */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +int +atexit (void (*f)()) +{ + /* If the system doesn't provide a definition for atexit, use on_exit + if the system provides that. */ + on_exit (f, 0); + return 0; +}