Fixes for FreeBSD.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4330 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Robert Graham Merkel
2001-05-29 15:20:23 +00:00
parent 8ffb9865e7
commit 010d135579
5 changed files with 50 additions and 2 deletions

View File

@@ -1,3 +1,16 @@
2001-05-30 Robert Graham Merkel <rgmerk@mira.net>
* src/engine/date.c (printDate): Workaround for
missing nl_langinfo.
* src/engine/Query.c: moved sys/types.h before
regex.h.
* acinclude.m4 (HAVE_LANGINFO_D_FMT): add check
for working nl_langinfo(D_FMT).
* configure.in: use check for nl_langinfo(D_FMT).
2001-05-29 Robert Graham Merkel <rgmerk@mira.net>
* src/gnome/dialog-options.{ch} (gnc_options_dialog_new):

View File

@@ -262,3 +262,18 @@ int main ()
AC_DEFUN([LIBGUPPI_CHECK], [
AM_PATH_LIBGUPPI(0.35.1,,[AC_MSG_ERROR(libguppi not found)])
])
AC_DEFUN([LANGINFO_D_FMT_CHECK],
[
AC_CACHE_CHECK([for nl_langinfo and D_FMT], am_cv_langinfo_dfmt,
[AC_TRY_LINK([#include <langinfo.h>],
[char* cs = nl_langinfo(D_FMT);],
am_cv_langinfo_dfmt=yes,
am_cv_langinfo_dfmt=no)
])
if test $am_cv_langinfo_dfmt = yes; then
AC_DEFINE(HAVE_LANGINFO_D_FMT, 1,
[Define if you have <langinfo.h> and nl_langinfo(D_FMT).])
fi
])

View File

@@ -221,6 +221,8 @@ AC_ARG_WITH( locale-dir,
AC_SUBST(LOCALE_DIR)
dnl check for nl_langinfo(D_FMT) which is missing on FreeBSD
LANGINFO_D_FMT_CHECK
### --------------------------------------------------------------------------
### help files

View File

@@ -24,9 +24,10 @@
#include <glib.h>
#include <math.h>
#include <string.h>
#include <sys/types.h>
#include <regex.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <assert.h>

View File

@@ -31,7 +31,12 @@
#include "config.h"
#include <ctype.h>
#ifdef HAVE_LANGINFO_D_FMT
#include <langinfo.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -228,7 +233,19 @@ printDate (char * buff, int day, int month, int year)
tm_str.tm_sec = 0;
tm_str.tm_isdst = -1;
strftime (buff, MAX_DATE_LENGTH, nl_langinfo (D_FMT), &tm_str);
/*
* FreeBSD doesn't have nl_langinfo (or any other way of
* doing this in a locale-specific manner, AFAICT), so
* we default to something unambigious
*/
strftime (buff, MAX_DATE_LENGTH,
#ifdef HAVE_LANGINFO_D_FMT
nl_langinfo (D_FMT),
#else
"%Y-%m-%d",
#endif
&tm_str);
}
break;