From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] HP-UX 11.11 build fixes Date: Thu, 17 Jul 2008 00:33:23 +0200 Message-ID: <87wsjlv4r0.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1216247633 3606 80.91.229.12 (16 Jul 2008 22:33:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Jul 2008 22:33:53 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jul 17 00:34:41 2008 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KJFZz-0001Gt-38 for guile-devel@m.gmane.org; Thu, 17 Jul 2008 00:34:35 +0200 Original-Received: from localhost ([127.0.0.1]:56009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJFZ6-0004O2-Ka for guile-devel@m.gmane.org; Wed, 16 Jul 2008 18:33:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJFZ3-0004Nm-Pb for guile-devel@gnu.org; Wed, 16 Jul 2008 18:33:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJFZ1-0004Mv-DM for guile-devel@gnu.org; Wed, 16 Jul 2008 18:33:37 -0400 Original-Received: from [199.232.76.173] (port=43547 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJFZ1-0004Ms-9h for guile-devel@gnu.org; Wed, 16 Jul 2008 18:33:35 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:40469 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KJFZ0-0003x0-Gu for guile-devel@gnu.org; Wed, 16 Jul 2008 18:33:35 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KJFYx-0008PA-Tp for guile-devel@gnu.org; Wed, 16 Jul 2008 22:33:32 +0000 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Jul 2008 22:33:31 +0000 Original-Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Jul 2008 22:33:31 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 212 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: reverse-83.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 30 Messidor an 216 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: i686-pc-linux-gnu User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:agen2on3EH3dMhokskeNA8s0fDg= X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:7391 Archived-At: --=-=-= Hi, FYI, I committed the attached patch, which handles the lack of `struct dirent64' and `readdir64_r ()' on HP-UX 11.11 (and possibly other versions). I tested it on GNU/Linux (glibc 2.7) and HP-UX 11.11. It'd be nice if somebody could check whether the `dirent64' detection doesn't break on MinGW since it normally uses custom `dirent' code (in `win32-dirent.h'). Thanks, Ludovic. --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: inline; filename=0001-Handle-lack-of-struct-dirent64-and-readdir64_r.patch Content-Transfer-Encoding: 8bit Content-Description: The patch >From dc329592ff09b7300977d177eba430fe5dd83ecc Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 17 Jul 2008 00:17:56 +0200 Subject: [PATCH] Handle lack of `struct dirent64' and `readdir64_r ()' on HP-UX 11.11. --- ChangeLog | 5 +++++ NEWS | 1 + configure.in | 34 ++++++++++++++++++++++++++++++++-- libguile/ChangeLog | 10 ++++++++++ libguile/_scm.h | 12 ++++++++++-- libguile/gen-scmconfig.c | 13 +++++++++++++ libguile/gen-scmconfig.h.in | 1 + 7 files changed, 72 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index be0c84e..a33cf69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-16 Ludovic Courtès + + * configure.in: Look for `struct dirent64' and `readdir64_r ()', + not available on HP-UX 11.11. + 2008-07-06 Ludovic Courtès * configure.in: Update to Autoconf 2.61. diff --git a/NEWS b/NEWS index aaea7af..3684490 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,7 @@ application code. ** `guile-config link' now prints `-L$libdir' before `-lguile' ** Fix build issue on Tru64 and ia64-hp-hpux11.23 (`SCM_UNPACK' macro) ** Fix build issue on mips, mipsel, powerpc and ia64 (stack direction) +** Fix build issue on hppa2.0w-hp-hpux11.11 (`dirent64' and `readdir64_r') Changes in 1.8.5 (since 1.8.4) diff --git a/configure.in b/configure.in index d5d2264..2c0d671 100644 --- a/configure.in +++ b/configure.in @@ -583,9 +583,38 @@ AC_SUBST([SCM_I_GSC_NEEDS_STDINT_H]) AC_SUBST([SCM_I_GSC_NEEDS_INTTYPES_H]) AC_HEADER_STDC -AC_HEADER_DIRENT AC_HEADER_TIME AC_HEADER_SYS_WAIT +AC_HEADER_DIRENT + +# Reason for checking: +# +# HP-UX 11.11 (at least) doesn't provide `struct dirent64', even +# with `_LARGEFILE64_SOURCE', so check whether it's available. +# +AC_CHECK_MEMBER([struct dirent64.d_name], + [SCM_I_GSC_HAVE_STRUCT_DIRENT64=1], [SCM_I_GSC_HAVE_STRUCT_DIRENT64=0], + [ #ifndef _LARGEFILE64_SOURCE + # define _LARGEFILE64_SOURCE + #endif + + /* Per Autoconf manual. */ + #include + #ifdef HAVE_DIRENT_H + # include + #else + # define dirent direct + # ifdef HAVE_SYS_NDIR_H + # include + # endif + # ifdef HAVE_SYS_DIR_H + # include + # endif + # ifdef HAVE_NDIR_H + # include + # endif + #endif ]) +AC_SUBST([SCM_I_GSC_HAVE_STRUCT_DIRENT64]) # Reasons for testing: # complex.h - new in C99 @@ -683,13 +712,14 @@ AC_CHECK_HEADERS([assert.h crt_externs.h]) # pipe - not in mingw # _pipe - specific to mingw, taking 3 args # readdir_r - recent posix, not on old systems +# readdir64_r - not available on HP-UX 11.11 # stat64 - SuS largefile stuff, not on old systems # sysconf - not on old systems # truncate - not in mingw # isblank - available as a GNU extension or in C99 # _NSGetEnviron - Darwin specific # -AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe readdir_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strncasecmp]) +AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe readdir_r readdir64_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strncasecmp]) # Reasons for testing: # netdb.h - not in mingw diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 5c30574..2dc4f16 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,13 @@ +2008-07-16 Ludovic Courtès + + * gen-scmconfig.h.in (SCM_I_GSC_HAVE_STRUCT_DIRENT64): New. + * gen-scmconfig.c (main): Produce definitions of + `SCM_HAVE_STRUCT_DIRENT64' and `SCM_HAVE_READDIR64_R'. + * _scm.h (dirent_or_dirent64): Depend on + `SCM_HAVE_STRUCT_DIRENT64', for the sake of HP-UX 11.11. + (readdir_r_or_readdir64_r): Depend on `SCM_HAVE_READDIR64_R', + for HP-UX 11.11. + 2008-07-05 Ludovic Courtès * strings.c (scm_c_symbol_length): New function. diff --git a/libguile/_scm.h b/libguile/_scm.h index 4d6ded6..6b728be 100644 --- a/libguile/_scm.h +++ b/libguile/_scm.h @@ -113,7 +113,11 @@ #endif /* These names are a bit long, but they make it clear what they represent. */ -#define dirent_or_dirent64 CHOOSE_LARGEFILE(dirent,dirent64) +#if SCM_HAVE_STRUCT_DIRENT64 == 1 +# define dirent_or_dirent64 CHOOSE_LARGEFILE(dirent,dirent64) +#else +# define dirent_or_dirent64 dirent +#endif #define fstat_or_fstat64 CHOOSE_LARGEFILE(fstat,fstat64) #define ftruncate_or_ftruncate64 CHOOSE_LARGEFILE(ftruncate,ftruncate64) #define lseek_or_lseek64 CHOOSE_LARGEFILE(lseek,lseek64) @@ -121,7 +125,11 @@ #define off_t_or_off64_t CHOOSE_LARGEFILE(off_t,off64_t) #define open_or_open64 CHOOSE_LARGEFILE(open,open64) #define readdir_or_readdir64 CHOOSE_LARGEFILE(readdir,readdir64) -#define readdir_r_or_readdir64_r CHOOSE_LARGEFILE(readdir_r,readdir64_r) +#if SCM_HAVE_READDIR64_R == 1 +# define readdir_r_or_readdir64_r CHOOSE_LARGEFILE(readdir_r,readdir64_r) +#else +# define readdir_r_or_readdir64_r readdir_r +#endif #define stat_or_stat64 CHOOSE_LARGEFILE(stat,stat64) #define truncate_or_truncate64 CHOOSE_LARGEFILE(truncate,truncate64) #define scm_from_off_t_or_off64_t CHOOSE_LARGEFILE(scm_from_off_t,scm_from_int64) diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c index 788b451..6d3fea6 100644 --- a/libguile/gen-scmconfig.c +++ b/libguile/gen-scmconfig.c @@ -387,6 +387,19 @@ main (int argc, char *argv[]) pf ("#define SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER %d /* 0 or 1 */\n", SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER); + pf ("\n\n/*** File system access ***/\n"); + + pf ("/* Define to 1 if `struct dirent64' is available. */\n"); + pf ("#define SCM_HAVE_STRUCT_DIRENT64 %d /* 0 or 1 */\n", + SCM_I_GSC_HAVE_STRUCT_DIRENT64); + + pf ("/* Define to 1 if `readdir64_r ()' is available. */\n"); +#ifdef HAVE_READDIR64_R + pf ("#define SCM_HAVE_READDIR64_R 1 /* 0 or 1 */\n"); +#else + pf ("#define SCM_HAVE_READDIR64_R 0 /* 0 or 1 */\n"); +#endif + #if USE_DLL_IMPORT pf ("\n"); pf ("/* Define some additional CPP macros on Win32 platforms. */\n"); diff --git a/libguile/gen-scmconfig.h.in b/libguile/gen-scmconfig.h.in index cdc59b0..1be95af 100644 --- a/libguile/gen-scmconfig.h.in +++ b/libguile/gen-scmconfig.h.in @@ -30,6 +30,7 @@ #define SCM_I_GSC_USE_NULL_THREADS @SCM_I_GSC_USE_NULL_THREADS@ #define SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT @SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT@ #define SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER @SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER@ +#define SCM_I_GSC_HAVE_STRUCT_DIRENT64 @SCM_I_GSC_HAVE_STRUCT_DIRENT64@ /* Local Variables: -- 1.5.6.2 --=-=-=--