home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / tar-1.11.8-src.tgz / tar.out / fsf / tar / aclocal.m4 < prev    next >
Text File  |  1996-09-28  |  8KB  |  252 lines

  1. # Local additions to Autoconf macros.
  2. # Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
  3. # François Pinard <pinard@iro.umontreal.ca>, 1992.
  4.  
  5. ## ------------------------------- ##
  6. ## Check for function prototypes.  ##
  7. ## ------------------------------- ##
  8.  
  9. AC_DEFUN(fp_C_PROTOTYPES,
  10. [AC_REQUIRE([fp_PROG_CC_STDC])
  11. AC_MSG_CHECKING([for function prototypes])
  12. if test "$ac_cv_prog_cc_stdc" != no; then
  13.   AC_MSG_RESULT(yes)
  14.   AC_DEFINE(PROTOTYPES)
  15.   U= ANSI2KNR=
  16. else
  17.   AC_MSG_RESULT(no)
  18.   U=_ ANSI2KNR=ansi2knr
  19. fi
  20. AC_SUBST(U)dnl
  21. AC_SUBST(ANSI2KNR)dnl
  22. ])
  23.  
  24. ## ----------------------------------------- ##
  25. ## ANSIfy the C compiler whenever possible.  ##
  26. ## ----------------------------------------- ##
  27.  
  28. # @defmac AC_PROG_CC_STDC
  29. # @maindex PROG_CC_STDC
  30. # @ovindex CC
  31. # If the C compiler in not in ANSI C mode by default, try to add an option
  32. # to output variable @code{CC} to make it so.  This macro tries various
  33. # options that select ANSI C on some system or another.  It considers the
  34. # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
  35. # handles function prototypes correctly.
  36. #
  37. # If you use this macro, you should check after calling it whether the C
  38. # compiler has been set to accept ANSI C; if not, the shell variable
  39. # @code{ac_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
  40. # code in ANSI C, you can make an un-ANSIfied copy of it by using the
  41. # program @code{ansi2knr}, which comes with Ghostscript.
  42. # @end defmac
  43.  
  44. AC_DEFUN(fp_PROG_CC_STDC,
  45. [AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
  46. AC_CACHE_VAL(ac_cv_prog_cc_stdc,
  47. [ac_cv_prog_cc_stdc=no
  48. ac_save_CFLAGS="$CFLAGS"
  49. # Don't try gcc -ansi; that turns off useful extensions and
  50. # breaks some systems' header files.
  51. # AIX            -qlanglvl=ansi
  52. # Ultrix and OSF/1    -std1
  53. # HP-UX            -Aa -D_HPUX_SOURCE
  54. # SVR4            -Xc
  55. for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
  56. do
  57.   CFLAGS="$ac_save_CFLAGS $ac_arg"
  58.   AC_TRY_COMPILE(
  59. [#if !defined(__STDC__) || __STDC__ != 1
  60. choke me
  61. #endif    
  62. ], [int test (int i, double x);
  63. struct s1 {int (*f) (int a);};
  64. struct s2 {int (*f) (double a);};],
  65. [ac_cv_prog_cc_stdc="$ac_arg"; break])
  66. done
  67. CFLAGS="$ac_save_CFLAGS"
  68. ])
  69. AC_MSG_RESULT($ac_cv_prog_cc_stdc)
  70. case "x$ac_cv_prog_cc_stdc" in
  71.   x|xno) ;;
  72.   *) CC="$CC $ac_cv_prog_cc_stdc" ;;
  73. esac
  74. ])
  75.  
  76. ## --------------------------------------------------------- ##
  77. ## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
  78. ## substitution.                         ##
  79. ## --------------------------------------------------------- ##
  80.  
  81. AC_DEFUN(fp_PROG_INSTALL,
  82. [AC_PROG_INSTALL
  83. test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755'
  84. AC_SUBST(INSTALL_SCRIPT)dnl
  85. ])
  86.  
  87. ## ----------------------------------- ##
  88. ## Check if --with-dmalloc was given.  ##
  89. ## ----------------------------------- ##
  90.  
  91. # I just checked, and GNU rx seems to work fine with a slightly
  92. # modified GNU m4.  So, I put out the test below in my aclocal.m4,
  93. # and will try to use it in my things.  The idea is to distribute
  94. # rx.[hc] and regex.[hc] together, for a while.  The WITH_REGEX symbol
  95. # (which should also be documented in acconfig.h) is used to decide
  96. # which of regex.h or rx.h should be included in the application.
  97. #
  98. # If `./configure --with-regex' is given, the package will use
  99. # the older regex.  Else, a check is made to see if rx is already
  100. # installed, as with newer Linux'es.  If not found, the package will
  101. # use the rx from the distribution.  If found, the package will use
  102. # the system's rx which, on Linux at least, will result in a smaller
  103. # executable file.
  104.  
  105. AC_DEFUN(fp_WITH_DMALLOC,
  106. [AC_MSG_CHECKING(if malloc debugging is wanted)
  107. AC_ARG_WITH(dmalloc,
  108. [  --with-dmalloc          use dmalloc, as in
  109.                           ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
  110. [if test "$withval" = yes; then
  111.   AC_MSG_RESULT(yes)
  112.   AC_DEFINE(WITH_DMALLOC)
  113.   LIBS="$LIBS -ldmalloc"
  114.   LDFLAGS="$LDFLAGS -g"
  115. else
  116.   AC_MSG_RESULT(no)
  117. fi], [AC_MSG_RESULT(no)])
  118. ])
  119.  
  120. ## --------------------------------- ##
  121. ## Check if --with-regex was given.  ##
  122. ## --------------------------------- ##
  123.  
  124. AC_DEFUN(fp_WITH_REGEX,
  125. [AC_MSG_CHECKING(which of rx or regex is wanted)
  126. AC_ARG_WITH(regex,
  127. [  --with-regex            use older regex in lieu of GNU rx for matching],
  128. [if test "$withval" = yes; then
  129.   ac_with_regex=1
  130.   AC_MSG_RESULT(regex)
  131.   AC_DEFINE(WITH_REGEX)
  132.   LIBOBJS="$LIBOBJS regex.o"
  133. fi])
  134. if test -z "$ac_with_regex"; then
  135.   AC_MSG_RESULT(rx)
  136.   AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
  137. fi
  138. AC_SUBST(LIBOBJS)dnl
  139. ])
  140.  
  141. ## ------------------- ##
  142. ## Check NLS options.  ##
  143. ## ------------------- ##
  144.  
  145. AC_DEFUN(ud_LC_MESSAGES,
  146. [if test $ac_cv_header_locale_h = yes; then
  147.   AC_MSG_CHECKING([for LC_MESSAGES])
  148.   AC_CACHE_VAL(ud_cv_val_LC_MESSAGES,
  149.     [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  150.      ud_cv_val_LC_MESSAGES=yes, ud_cv_val_LC_MESSAGES=no)])
  151.   AC_MSG_RESULT($ud_cv_val_LC_MESSAGES)
  152.   if test $ud_cv_val_LC_MESSAGES = yes; then
  153.     AC_DEFINE(HAVE_LC_MESSAGES)
  154.   fi
  155. fi
  156. ])
  157.  
  158. define(ud_WITH_NLS,
  159. [AC_MSG_CHECKING([whether NLS is requested])
  160.   dnl Default is enabled NLS
  161.   AC_ARG_ENABLE(nls,
  162.     [  --disable-nls           do not use Native Language Support],
  163.     [nls_cv_use_nls=$enableval], [nls_cv_use_nls=yes])
  164.   AC_MSG_RESULT($nls_cv_use_nls)
  165.  
  166.   dnl If we use NLS figure out what method
  167.   if test "$nls_cv_use_nls" = "yes"; then
  168.     AC_DEFINE(ENABLE_NLS)
  169.     AC_MSG_CHECKING([for explicitly using GNU gettext])
  170.     AC_ARG_WITH(gnu-nls,
  171.       [  --with-gnu-nls          use the GNU NLS library],
  172.       [nls_cv_force_use_gnu_nls=$withval], [nls_cv_force_use_gnu_nls=no])
  173.     AC_MSG_RESULT($nls_cv_force_use_gnu_nls)
  174.  
  175.     if test "$nls_cv_force_use_gnu_nls" = "yes"; then
  176.       nls_cv_use_gnu_nls=yes
  177.     else
  178.       dnl User does not insist on using GNU NLS library.  Figure out what
  179.       dnl to use.  If gettext or catgets are available (in this order) we
  180.       dnl use this.  Else we have to fall back to GNU NLS library.
  181.       AC_CHECK_LIB(intl, main)
  182.       AC_CHECK_LIB(i, main)
  183.       AC_FUNC_CHECK(gettext,
  184.         [AC_DEFINE(HAVE_GETTEXT)
  185.          AC_PATH_PROG(MSGFMT, msgfmt, msgfmt)dnl
  186.      AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)dnl
  187.      AC_PATH_PROG(XGETTEXT, xgettext, xgettext)dnl
  188.          INTLOBJS="\$(GETTOBJS)"
  189.          CATOBJEXT=.mo
  190.      DATADIRNAME=lib],
  191.  
  192.         dnl No gettext in C library.  Try catgets next.
  193.         [AC_FUNC_CHECK(catgets,
  194.           [AC_DEFINE(HAVE_CATGETS)
  195.            INTLOBJS="\$(CATOBJS)"
  196.            AC_PATH_PROG(GENCAT, gencat, [echo gencat])dnl
  197.        AC_PATH_PROGS(GMSGFMT, [gmsgfmt msgfmt], msgfmt)dnl
  198.        AC_PATH_PROG(XGETTEXT, xgettext, xgettext)dnl
  199.            CATOBJEXT=.cat
  200.        DATADIRNAME=lib
  201.        INTLDEPS="../intl/libintl.a"
  202.        INTLLIBS=$INTLDEPS
  203.        nls_cv_header_intl=intl/libintl.h
  204.        nls_cv_header_libgt=intl/libgettext.h],
  205.  
  206.           dnl Even catgets is not included.  Fall back on GNU NLS library.
  207.           [AC_MSG_RESULT([using GNU gettext])
  208.        nls_cv_use_gnu_nls=yes])])
  209.     fi
  210.     if test "$nls_cv_use_gnu_nls" = "yes"; then
  211.       dnl Mark actions used to generate GNU NLS library.
  212.       INTLOBJS="\$(GETTOBJS)"
  213.       AC_PATH_PROG(MSGFMT, msgfmt, msgfmt)dnl
  214.       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)dnl
  215.       AC_PATH_PROG(XGETTEXT, xgettext, xgettext)dnl
  216.       AC_SUBST(MSGFMT)
  217.       CATOBJEXT=.gmo
  218.       DATADIRNAME=share
  219.       INTLDEPS="../intl/libintl.a"
  220.       INTLLIBS=$INTLDEPS
  221.       nls_cv_header_intl=intl/libintl.h
  222.       nls_cv_header_libgt=intl/libgettext.h
  223.     fi
  224.     # We need to process the intl/ directory
  225.     INTLSUB=intl
  226.   fi
  227.   AC_SUBST(INTLOBJS)
  228.   if test -n "$CATOBJEXT"; then
  229.     for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  230.   fi
  231.   AC_SUBST(CATALOGS)
  232.   AC_SUBST(CATOBJEXT)
  233.   AC_SUBST(DATADIRNAME)
  234.   AC_SUBST(INTLDEPS)
  235.   AC_SUBST(INTLLIBS)
  236.   AC_SUBST(INTLSUB)
  237. ])
  238.  
  239. AC_DEFUN(ud_GNU_GETTEXT,
  240. [AC_CHECK_HEADERS(locale.h nl_types.h)
  241. AC_CHECK_FUNCS(setlocale)
  242.  
  243. ud_LC_MESSAGES
  244. ud_WITH_NLS
  245.  
  246. if test "x$prefix" = xNONE; then
  247.   AC_DEFINE_UNQUOTED(STD_INC_PATH, "$ac_default_prefix/share/nls/src")
  248. else
  249.   AC_DEFINE_UNQUOTED(STD_INC_PATH, "$prefix/share/nls/src")
  250. fi
  251. ])
  252.