home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / aclocal / xorg-macros.m4 < prev    next >
Encoding:
M4 Source File  |  2006-07-10  |  8.2 KB  |  273 lines

  1. dnl $Id: xorg-macros.m4,v 1.8 2005/12/09 15:28:41 kem Exp $
  2. dnl
  3. dnl Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  4. dnl 
  5. dnl Permission to use, copy, modify, distribute, and sell this software and its
  6. dnl documentation for any purpose is hereby granted without fee, provided that
  7. dnl the above copyright notice appear in all copies and that both that
  8. dnl copyright notice and this permission notice appear in supporting
  9. dnl documentation.
  10. dnl 
  11. dnl The above copyright notice and this permission notice shall be included
  12. dnl in all copies or substantial portions of the Software.
  13. dnl 
  14. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15. dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  17. dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. dnl OTHER DEALINGS IN THE SOFTWARE.
  21. dnl 
  22. dnl Except as contained in this notice, the name of the copyright holders shall
  23. dnl not be used in advertising or otherwise to promote the sale, use or
  24. dnl other dealings in this Software without prior written authorization
  25. dnl from the copyright holders.
  26. dnl 
  27.  
  28. # XORG_PROG_RAWCPP()
  29. # ------------------
  30. # Find cpp program and necessary flags for use in pre-processing text files
  31. # such as man pages and config files
  32. AC_DEFUN([XORG_PROG_RAWCPP],[
  33. AC_REQUIRE([AC_PROG_CPP])
  34. AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
  35.    [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
  36.  
  37. # Check for flag to avoid builtin definitions - assumes unix is predefined,
  38. # which is not the best choice for supporting other OS'es, but covers most
  39. # of the ones we need for now.
  40. AC_MSG_CHECKING([if $RAWCPP requires -undef])
  41. AC_LANG_CONFTEST([Does cpp redefine unix ?])
  42. if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
  43.     AC_MSG_RESULT([no])
  44. else
  45.     if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
  46.         RAWCPPFLAGS=-undef
  47.         AC_MSG_RESULT([yes])
  48.     else
  49.         AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
  50.     fi
  51. fi
  52. rm -f conftest.$ac_ext
  53.  
  54. AC_MSG_CHECKING([if $RAWCPP requires -traditional])
  55. AC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
  56. if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
  57.     AC_MSG_RESULT([no])
  58. else
  59.     if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
  60.         RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
  61.         AC_MSG_RESULT([yes])
  62.     else
  63.         AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
  64.     fi
  65. fi
  66. rm -f conftest.$ac_ext
  67. AC_SUBST(RAWCPPFLAGS)
  68. ]) # XORG_PROG_RAWCPP
  69.  
  70. # XORG_MANPAGE_SECTIONS()
  71. # -----------------------
  72. # Determine which sections man pages go in for the different man page types
  73. # on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
  74. # Not sure if there's any better way than just hardcoding by OS name.
  75. # Override default settings by setting environment variables
  76.  
  77. AC_DEFUN([XORG_MANPAGE_SECTIONS],[
  78. AC_REQUIRE([AC_CANONICAL_HOST])
  79.  
  80. if test x$APP_MAN_SUFFIX = x    ; then
  81.     case $host_os in
  82.     linux*)    APP_MAN_SUFFIX=1x ;;
  83.     *)    APP_MAN_SUFFIX=1  ;;
  84.     esac
  85. fi
  86. if test x$APP_MAN_DIR = x    ; then
  87.     case $host_os in
  88.     linux*)    APP_MAN_DIR='$(mandir)/man1' ;;
  89.     *)    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)' ;;
  90.     esac
  91. fi
  92.  
  93. if test x$LIB_MAN_SUFFIX = x    ; then
  94.     case $host_os in
  95.     linux*)    LIB_MAN_SUFFIX=3x ;;
  96.     *)    LIB_MAN_SUFFIX=3  ;;
  97.     esac
  98. fi
  99. if test x$LIB_MAN_DIR = x    ; then
  100.     case $host_os in
  101.     linux*)    LIB_MAN_DIR='$(mandir)/man3' ;;
  102.     *)    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)' ;;
  103.     esac
  104. fi
  105.  
  106. if test x$FILE_MAN_SUFFIX = x    ; then
  107.     case $host_os in
  108.     linux*)        FILE_MAN_SUFFIX=5x ;;
  109.     solaris*)    FILE_MAN_SUFFIX=4  ;;
  110.     *)        FILE_MAN_SUFFIX=5  ;;
  111.     esac
  112. fi
  113. if test x$FILE_MAN_DIR = x    ; then
  114.     case $host_os in
  115.     linux*)    FILE_MAN_DIR='$(mandir)/man5' ;;
  116.     *)    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)' ;;
  117.     esac
  118. fi
  119.  
  120. # In Imake's linux.cf, the misc man suffix & dir was only changed for 
  121. # LinuxDebian, not other Linuxes, so we leave it unchanged here
  122. if test x$MISC_MAN_SUFFIX = x    ; then
  123.     case $host_os in
  124. #    linux*)        MISC_MAN_SUFFIX=7x ;;
  125.     solaris*)    MISC_MAN_SUFFIX=5  ;;
  126.     *)        MISC_MAN_SUFFIX=7  ;;
  127.     esac
  128. fi
  129. if test x$MISC_MAN_DIR = x    ; then
  130.     case $host_os in
  131. #    linux*)    MISC_MAN_DIR='$(mandir)/man7' ;;
  132.     *)    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)' ;;
  133.     esac
  134. fi
  135.  
  136. # In Imake's linux.cf, the driver man suffix & dir was only changed for 
  137. # LinuxDebian, not other Linuxes, so we leave it unchanged here
  138. if test x$DRIVER_MAN_SUFFIX = x    ; then
  139.     case $host_os in
  140. #    linux*)        DRIVER_MAN_SUFFIX=4x ;;
  141.     solaris*)    DRIVER_MAN_SUFFIX=7  ;;
  142.     *)        DRIVER_MAN_SUFFIX=4  ;;
  143.     esac
  144. fi
  145. if test x$DRIVER_MAN_DIR = x    ; then
  146.     case $host_os in
  147. #    linux*)    DRIVER_MAN_DIR='$(mandir)/man4' ;;
  148.     *)    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)' ;;
  149.     esac
  150. fi
  151.  
  152. if test x$ADMIN_MAN_SUFFIX = x    ; then
  153.     case $host_os in
  154.     solaris*)    ADMIN_MAN_SUFFIX=1m ;;
  155.     *)        ADMIN_MAN_SUFFIX=8  ;;
  156.     esac
  157. fi
  158. if test x$ADMIN_MAN_DIR = x    ; then
  159.     ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
  160. fi
  161.  
  162.  
  163. AC_SUBST([APP_MAN_SUFFIX])
  164. AC_SUBST([LIB_MAN_SUFFIX])
  165. AC_SUBST([FILE_MAN_SUFFIX])
  166. AC_SUBST([MISC_MAN_SUFFIX])
  167. AC_SUBST([DRIVER_MAN_SUFFIX])
  168. AC_SUBST([ADMIN_MAN_SUFFIX])
  169. AC_SUBST([APP_MAN_DIR])
  170. AC_SUBST([LIB_MAN_DIR])
  171. AC_SUBST([FILE_MAN_DIR])
  172. AC_SUBST([MISC_MAN_DIR])
  173. AC_SUBST([DRIVER_MAN_DIR])
  174. AC_SUBST([ADMIN_MAN_DIR])
  175. ]) # XORG_MANPAGE_SECTIONS
  176.  
  177. # XORG_CHECK_LINUXDOC
  178. # -------------------
  179. # Defines the variable MAKE_TEXT if the necessary tools and
  180. # files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
  181. # Whether or not the necessary tools and files are found can be checked
  182. # with the AM_CONDITIONAL "BUILD_LINUXDOC"
  183. AC_DEFUN([XORG_CHECK_LINUXDOC],[
  184. AC_CHECK_FILE(
  185.     [$prefix/share/X11/sgml/defs.ent], 
  186.     [DEFS_ENT_PATH=$prefix/share/X11/sgml],
  187.     [DEFS_ENT_PATH=]
  188. )
  189.  
  190. AC_PATH_PROG(LINUXDOC, linuxdoc)
  191. AC_PATH_PROG(PS2PDF, ps2pdf)
  192.  
  193. AC_MSG_CHECKING([Whether to build documentation])
  194.  
  195. if test x$DEFS_ENT_PATH != x && test x$LINUXDOC != x ; then
  196.    BUILDDOC=yes
  197. else
  198.    BUILDDOC=no
  199. fi
  200.  
  201. AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
  202.  
  203. AC_MSG_RESULT([$BUILDDOC])
  204.  
  205. AC_MSG_CHECKING([Whether to build pdf documentation])
  206.  
  207. if test x$PS2PDF != x ; then
  208.    BUILDPDFDOC=yes
  209. else
  210.    BUILDPDFDOC=no
  211. fi
  212.  
  213. AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
  214.  
  215. AC_MSG_RESULT([$BUILDPDFDOC])
  216.  
  217. MAKE_TEXT="SGML_SEARCH_PATH=$DEFS_ENT_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
  218. MAKE_PS="SGML_SEARCH_PATH=$DEFS_ENT_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
  219. MAKE_PDF="$PS2PDF"
  220. MAKE_HTML="SGML_SEARCH_PATH=$DEFS_ENT_PATH $LINUXDOC  -B html --split=0"
  221.  
  222. AC_SUBST(MAKE_TEXT)
  223. AC_SUBST(MAKE_PS)
  224. AC_SUBST(MAKE_PDF)
  225. AC_SUBST(MAKE_HTML)
  226. ]) # XORG_CHECK_LINUXDOC
  227.  
  228. # XORG_CHECK_MALLOC_ZERO
  229. # ----------------------
  230. # Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
  231. # malloc(0) returns NULL.  Packages should add one of these cflags to
  232. # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
  233. AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
  234. AC_ARG_ENABLE(malloc0returnsnull,
  235.     AC_HELP_STRING([--enable-malloc0returnsnull],
  236.                [malloc(0) returns NULL (default: auto)]),
  237.     [MALLOC_ZERO_RETURNS_NULL=$enableval],
  238.     [MALLOC_ZERO_RETURNS_NULL=auto])
  239.  
  240. AC_MSG_CHECKING([whether malloc(0) returns NULL])
  241. if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
  242.     AC_RUN_IFELSE([
  243. char *malloc();
  244. char *realloc();
  245. char *calloc();
  246. main() {
  247.     char *m0, *r0, *c0, *p;
  248.     m0 = malloc(0);
  249.     p = malloc(10);
  250.     r0 = realloc(p,0);
  251.     c0 = calloc(0);
  252.     exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
  253. }],
  254.         [MALLOC_ZERO_RETURNS_NULL=yes],
  255.         [MALLOC_ZERO_RETURNS_NULL=no])
  256. fi
  257. AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
  258.  
  259. if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
  260.     MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
  261.     XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
  262.     XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
  263. else
  264.     MALLOC_ZERO_CFLAGS=""
  265.     XMALLOC_ZERO_CFLAGS=""
  266.     XTMALLOC_ZERO_CFLAGS=""
  267. fi
  268.  
  269. AC_SUBST([MALLOC_ZERO_CFLAGS])
  270. AC_SUBST([XMALLOC_ZERO_CFLAGS])
  271. AC_SUBST([XTMALLOC_ZERO_CFLAGS])
  272. ]) # XORG_CHECK_MALLOC_ZERO
  273.