Skip site navigation (1) Skip section navigation (2)

Compile failure on nl_langinfo

From: Euler Taveira de Oliveira <euler(at)ufgnet(dot)ufg(dot)br>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Compile failure on nl_langinfo
Date: 2004-07-31 14:10:28
Message-ID: 20040731111028.2f497019.euler@ufgnet.ufg.br (view raw or flat)
Thread:
Lists: pgsql-hackers
Hi,

I am seeing the following compile failure in currrent CVS.

gmake[4]: Leaving directory `/dados/pgsql/cvs/pgsql/src/port'
gcc -O2 -fno-strict-aliasing -g -Wall -Wmissing-prototypes -Wmissing-declarations -DFRONTEND -I../../../src/interfaces/libpq -I../../../src/include -I/usr/local/include -I/usr/local/include/tcl8.4  -c -o initdb.o initdb.c -MMD
initdb.c: In function `get_encoding_from_locale':
initdb.c:758: `CODESET' undeclared (first use in this function)
initdb.c:758: (Each undeclared identifier is reported only once
initdb.c:758: for each function it appears in.)
gmake[3]: *** [initdb.o] Error 1
gmake[3]: Leaving directory `/dados/pgsql/cvs/pgsql/src/bin/initdb'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/dados/pgsql/cvs/pgsql/src/bin'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/dados/pgsql/cvs/pgsql/src'
gmake: *** [all] Error 2
$ 

I am using an OpenBSD 3.5. OpenBSD doesn't have 'CODESET' symbol.
How can we fix it?

1) just define it on configure.in when we don't have it. Like this:
dnl Check for nl_langinfo and CODESET
AC_MSG_CHECKING([for nl_langinfo (CODESET)])
AC_TRY_LINK([#include <langinfo.h>],
            [char *codeset = nl_langinfo (CODESET);],
            [AC_MSG_RESULT(yes)],
            [AC_MSG_RESULT(no)
            AC_DEFINE(CODESET, 0, [Define to 0 if you don't have CODESET.])
            ])

2) define a 'HAVE_CODESET' symbol and just ifdef in initdb.c

3) another?

Personally I prefer the first one. The completed patch is attached. It requires to run 'autoheader' and 'autoconf'. CODESET 0 is ASCII.
So in those plataforms that do not have 'CODESET' we'll always go with locale C.

Comments?

-- 
Euler Taveira de Oliveira
euler (at) ufgnet.ufg.br
Desenvolvedor Web e Administrador de Sistemas
UFGNet - Universidade Federal de Goiás

Attachment: foo.diff
Description: application/octet-stream (623 bytes)

Responses

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2004-07-31 14:59:09
Subject: Re: Compile failure on nl_langinfo
Previous:From: Peter EisentrautDate: 2004-07-31 08:15:52
Subject: Fwd: init scripts and su

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group