Mac OS X support, round 2.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6878 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2002-05-18 20:32:22 +00:00
parent 094b57930f
commit 59e52d8714
11 changed files with 117 additions and 8 deletions

View File

@ -1,3 +1,22 @@
2002-05-18 David Hampton <hampton@employees.org>
* configure.in: Work around incompatibilities between autoconf
2.52 and 2.53 wrt creating the LIBLTOBJS variable.
* ltmain.sh: Mac OS X tweaks.
* libc/Makefile.am: Use LIBLTOBJS instead of LIBOBJS.
* src/backend/file/sixtp-utils.c (string_to_gint64):
(string_to_gint32): (string_to_timespec_nsecs): Work around bugs
in Mac OS X version of sscanf.
* src/gnome/druid-hierarchy.c (gnc_get_ea_locale_dir): Work around
lack of LC_MESSAGES on Mac OS X.
* src/scm/main.scm (local-prefixes): Work around
lack of LC_MESSAGES on Mac OS X.
2002-05-14 David Hampton <hampton@employees.org>
* configure.in (AC_CANONICAL_HOST): Remove redundant command.

View File

@ -805,6 +805,40 @@ chmod u+x src/bin/overrides/gnucash-make-guids
### --------------------------------------------------------------------------
### Makefile creation
#
# God, this is ugly....
#
# The libtool 2.52 and 2.53 info pages specify two different
# *incompatible* ways to create the LTLIBOBJS variable. 2.53 makes it
# an error to directly access the LIBOBJS variable, but then provides
# a hack to get past this test by introducing the four character
# sequence '@&t@' that expands to the empty string. This expansion
# occurs *after* the LIBOBJS usage test has taken place.
# Unfortunately, the '@&t@' sequence doesn't exist in 2.52, so we're
# stuck with this big ugly version check. Sigh! At some point in the
# future, Autoconf 2.53 can be made a required version and this code
# can be cleaned up.
#
# This is necessary so that .o files in LIBOBJS are also built via
# the ANSI2KNR-filtering rules.
AUTOCONF_VERSION=`autoconf --version`
autoconf_major_version=`echo ${AUTOCONF_VERSION} | \
sed 's/^.*GNU Autoconf.* \([[0-9]]*\)\.\([[0-9]]*\).*$/\1/'`
autoconf_minor_version=`echo ${AUTOCONF_VERSION} | \
sed 's/^.*GNU Autoconf.* \([[0-9]]*\)\.\([[0-9]]*\).*$/\2/'`
if test $autoconf_major_version -gt 2 -o \
\( $autoconf_major_version -eq 2 -a \
$autoconf_minor_version -gt 52 \) ; then
LIB@&t@OBJS=`echo "$LIB@&t@OBJS" |
sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'`
LTLIBOBJS=`echo "$LIB@&t@OBJS" |
sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
else
LTLIBOBJS=`echo "$LIBOBJS" | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
fi
AC_SUBST(LTLIBOBJS)
AC_OUTPUT( m4/Makefile intl/Makefile
dnl # Makefiles
Makefile

View File

@ -9,7 +9,7 @@ libc_missing_la_SOURCES = libc-missing-noop.c
# This will automatically be filled in with the necessary object file
# names. Configure does this based upon the AC_REPLACE_FUNCS macros.
libc_missing_la_LIBADD = @LIBOBJS@
libc_missing_la_LIBADD = @LTLIBOBJS@
# Not currently used. If added to AC_REPLACE_FUNCS then this line
# should be removed.

View File

@ -4,6 +4,7 @@
#if !HAVE_LOCALTIME_R
#include <time.h>
#include <string.h>
#include "localtime_r.h"
#if HAVE_PTHREAD_MUTEX_INIT
#include <pthread.h>

View File

@ -3296,7 +3296,18 @@ EOF
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
eval cmds=\"$archive_expsym_cmds\"
else
save_deplibs="$deplibs"
for conv in $convenience; do
tmp_deplibs=
for test_deplib in $deplibs; do
if test "$test_deplib" != "$conv"; then
tmp_deplibs="$tmp_deplibs $test_deplib"
fi
done
deplibs="$tmp_deplibs"
done
eval cmds=\"$archive_cmds\"
deplibs="$save_deplibs"
fi
if len=`expr "X$cmds" : ".*"` &&

View File

@ -8,6 +8,7 @@ AM_CFLAGS = \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/core-utils\
-I${top_srcdir}/lib/libc\
${GLIB_CFLAGS}
libgncmod_backend_file_la_SOURCES = \

View File

@ -41,6 +41,12 @@
#include "guid.h"
#include "gnc-numeric.h"
#include "gnc-engine-util.h"
#ifndef HAVE_STRPTIME
#include "strptime.h"
#endif
#ifndef HAVE_LOCALTIME_R
#include "localtime_r.h"
#endif
static short module = MOD_IO;
@ -218,6 +224,15 @@ string_to_gint64(const gchar *str, gint64 *v)
return(FALSE);
}
/*
* Mac OS X version 10.1 and under has a silly bug where scanf
* returns bad values in num_read if there is a space before %n. It
* is fixed in the next release 10.2 afaik
*/
while( (*((gchar*)str + num_read)!='\0') &&
isspace(*((char*)str + num_read)))
num_read++;
if (v)
*v = v_in;
@ -240,6 +255,9 @@ string_to_gint32(const gchar *str, gint32 *v)
if(sscanf(str, " %d%n", &v_in, &num_read) < 1) {
return(FALSE);
}
while( (*((gchar*)str + num_read)!='\0') &&
isspace(*((char*)str + num_read)))
num_read++;
if (v)
*v = v_in;
@ -475,14 +493,17 @@ string_to_timespec_secs(const gchar *str, Timespec *ts) {
}
gboolean
string_to_timespec_nsecs(const gchar *str, Timespec *ts) {
string_to_timespec_nsecs(const gchar *str, Timespec *ts)
{
long int nanosecs;
int charcount;
if (!str || !ts) return FALSE;
sscanf(str, " %ld%n", &nanosecs, &charcount);
while( (*((gchar*)str + charcount)!='\0') &&
isspace(*((char*)str + charcount)))
charcount++;
if(charcount != strlen(str)) return(FALSE);

View File

@ -2,7 +2,10 @@ SUBDIRS = . test-core test
pkglib_LTLIBRARIES = libgw-engine.la libgw-kvp.la libgncmod-engine.la
AM_CFLAGS = -I${top_srcdir}/src/gnc-module ${GNUCASH_ENGINE_CFLAGS}
AM_CFLAGS = \
-I${top_srcdir}/lib/libc \
-I${top_srcdir}/src/gnc-module \
${GNUCASH_ENGINE_CFLAGS}
libgncmod_engine_la_SOURCES = \
Account.c \

View File

@ -46,6 +46,13 @@
#include "date.h"
#include "gnc-engine-util.h"
#ifndef HAVE_STRPTIME
#include "strptime.h"
#endif
#ifndef HAVE_LOCALTIME_R
#include "localtime_r.h"
#endif
#define NANOS_PER_SECOND 1000000000
#ifdef HAVE_LANGINFO_D_FMT

View File

@ -312,7 +312,16 @@ gnc_get_ea_locale_dir(const char *top_dir)
gchar *locale;
struct stat buf;
#ifdef HAVE_LC_MESSAGES
locale = g_strdup(setlocale(LC_MESSAGES, NULL));
#else
/*
* Mac OS X 10.1 and earlier, not only doesn't have LC_MESSAGES
* setlocale can sometimes return NULL instead of "C"
*/
locale = g_strdup(setlocale(LC_ALL, NULL) ?
setlocale(LC_ALL, NULL) : "C");
#endif
ret = g_strdup_printf("%s/%s", top_dir, locale);

View File

@ -314,7 +314,10 @@ string and 'directories' must be a list of strings."
;; thereof.
(define (locale-prefixes)
(let* ((locale (setlocale LC_MESSAGES))
;; Mac OS X. 10.1 and earlier don't have LC_MESSAGES. Fall back to
;; LC_ALL for those systems.
(let* ((locale (or (false-if-exception (setlocale LC_MESSAGES))
(setlocale LC_ALL)))
(strings (cond ((not (string? locale)) ())
((equal? locale "C") ())
((<= (string-length locale) 4) (list locale))