freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] building freetype on z/OS


From: mpsuzuki
Subject: Re: [ft-devel] building freetype on z/OS
Date: Fri, 19 Sep 2008 01:53:20 +0900

Dear Antoine Leca,

Following is a patch to check off_t from sys/types.h and unistd.h,
and reflect autoconf result in zconf.h. It's ugly than most sources
using autoconf to detect off_t, because the patch is designed not
to disturb non-autoconf building system.

AC_HEADER_STDC collects most standard headers (sys/types.h, unistd.h
etc) and setup them as default include files, so I put the macros
to search off_t in specified header file before AC_HEADER_STDC. 
The check is following.

1. check if sys/types.h provides typedef for off_t.
   if provided, define HAVE_OFF_T = 1 and define
   HAVE_OFF_T_IN_SYS_TYPES_H.
   if not provided, proceed to 2.

2. check if unistd.h provides typedef for off_t.
   if provided, define HAVE_OFF_T = 1 and define
   HAVE_OFF_T_IN_UNISTD_H.
   if not provided, proceed to 3.

3. define HAVE_OFF_T = 0 explicitly.

The standard use of AC_CHECK_TYPE(xxx) defines HAVE_xxx only
when typedef for xxx is found. If not found, HAVE_xxx is left
as undefined. zconf.h is not only for autoconf building system,
so we have to distinguish 2 cases:
"autoconf could not find off_t, maybe the system doesn't have off_t"
versus "building without autoconf, so the exist of off_t is not clear".
Therefore, it is not good idea to leave HAVE_OFF_T as undefined
when autoconf could not find the typedef for off_t. So,
I put AC_DEFINE([OFF_T], [0]) explicitly, it makes configure
to write HAVE_OFF_T explicitly in the conversion from ftconfig.in
to ftconfig.h. As a result, the cpp conditional
        #if defined( OFF_T ) && ( 0 == OFF_T )
can point the case "autoconf could not find the typedef for
off_t" exactly.

By this patch, I expect, if a developer run ./configure on z/OS,
zconf.h would include appropriate header files. If he builds
without running ./configure, the result is exactly same with
the result without my patch.

Please give me your comment.

Regards,
mpsuzuki




Index: builds/unix/configure.raw
===================================================================
RCS file: /sources/freetype/freetype2/builds/unix/configure.raw,v
retrieving revision 1.35
diff -u -r1.35 configure.raw
--- builds/unix/configure.raw   12 Sep 2008 16:27:45 -0000      1.35
+++ builds/unix/configure.raw   18 Sep 2008 16:27:27 -0000
@@ -115,9 +115,25 @@
 
 # checks for header files
 
+AC_CHECK_TYPE([off_t],
+  [
+    AC_DEFINE([HAVE_OFF_T_IN_SYS_TYPES_H])
+    AC_DEFINE([HAVE_OFF_T], [1])
+  ],[
+    AC_CHECK_TYPE([off_t],
+      [
+        AC_DEFINE([HAVE_OFF_T_IN_UNISTD_H])
+        AC_DEFINE([HAVE_OFF_T], [1])
+      ],[
+        AC_DEFINE([HAVE_OFF_T], [0])
+      ],[
+        #include <unistd.h>
+      ])
+  ],[
+    #include <sys/types.h>
+  ])
 AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h unistd.h])
-
+AC_CHECK_HEADERS([fcntl.h])
 
 # checks for typedefs, structures, and compiler characteristics
 
Index: builds/unix/ftconfig.in
===================================================================
RCS file: /sources/freetype/freetype2/builds/unix/ftconfig.in,v
retrieving revision 1.25
diff -u -r1.25 ftconfig.in
--- builds/unix/ftconfig.in     12 Sep 2008 16:27:45 -0000      1.25
+++ builds/unix/ftconfig.in     18 Sep 2008 16:27:28 -0000
@@ -60,6 +60,9 @@
 #undef HAVE_UNISTD_H
 #undef HAVE_FCNTL_H
 #undef HAVE_STDINT_H
+#undef HAVE_OFF_T
+#undef HAVE_OFF_T_IN_SYS_TYPES_H
+#undef HAVE_OFF_T_IN_UNISTD_H
 
 
   /* There are systems (like the Texas Instruments 'C54x) where a `char' */
Index: src/gzip/zconf.h
===================================================================
RCS file: /sources/freetype/freetype2/src/gzip/zconf.h,v
retrieving revision 1.4
diff -u -r1.4 zconf.h
--- src/gzip/zconf.h    1 Jun 2007 06:56:17 -0000       1.4
+++ src/gzip/zconf.h    18 Sep 2008 16:27:56 -0000
@@ -234,7 +234,15 @@
    typedef Byte     *voidp;
 #endif
 
-#ifdef HAVE_UNISTD_H
+#if defined( HAVE_OFF_T ) && defined( HAVE_OFF_T == 0 )
+#  define  z_off_t long
+#elif defined( HAVE_OFF_T_IN_SYS_TYPES_H )
+#  include <sys/types.h>
+#  define z_off_t  off_t
+#elif defined( HAVE_OFF_T_IN_UNISTD_H )
+#  include <unistd.h>
+#  define z_off_t  off_t
+#elif defined( HAVE_UNISTD_H )
 #  include <sys/types.h> /* for off_t */
 #  include <unistd.h>    /* for SEEK_* and off_t */
 #  define z_off_t  off_t








On Thu, 18 Sep 2008 16:44:23 +0900
address@hidden wrote:

>Hi,
>
>On Fri, 5 Sep 2008 15:46:16 +0200
>"Antoine Leca" <address@hidden> wrote:
>>The idea would then be to test about HAVE_SYS_TYPES_H rather than
>>HAVE_UNISTD_H, or perhaps even directly aiming at finding off_t
>>typedef (can we?); so it requires high surgery in the autoconfigure
>>stuff, something I am not able to do in a ten-minute post like this
>>one :-) If someone (Werner ?) has the free time to test it over the
>>week end, please do, it'll provide Annubius a speedier solution.
>
>I have no access to z/OS, so I cannot guarantee the fix to
>enable FreeType2 in the system, but I will try to insert
>something to do such in configure.raw. BTW, using configure
>script is popular building process in the development on z/OS?
>
>Regards,
>mpsuzuki
>
>
>_______________________________________________
>Freetype-devel mailing list
>address@hidden
>http://lists.nongnu.org/mailman/listinfo/freetype-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]