home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gettext-0.10.24-bin.lha / share / gettext / demo / aclocal.m4
Text File  |  1996-10-12  |  13KB  |  394 lines

  1. AC_PREREQ(2.5)
  2.  
  3. AC_DEFUN(md_TYPE_PTRDIFF_T,
  4.   [AC_CACHE_CHECK([for ptrdiff_t], ac_cv_type_ptrdiff_t,
  5.      [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
  6.              ac_cv_type_ptrdiff_t=yes, ac_cv_type_ptrdiff_t=no)])
  7.    if test $ac_cv_type_ptrdiff_t = yes; then
  8.      AC_DEFINE(HAVE_PTRDIFF_T)
  9.    fi
  10. ])
  11.  
  12. dnl ------------------------
  13. dnl Emacs LISP file handling
  14. dnl ------------------------
  15. AC_DEFUN(ud_PATH_LISPDIR,
  16.  [AC_PATH_PROG(EMACS, emacs, no)
  17.   if test $EMACS != "no"; then
  18.     AC_MSG_CHECKING([where .elc files should go])
  19.     dnl Set default value
  20.     LISPDIR="\$(datadir)/emacs/site-lisp"
  21.     if test "x$prefix" = "xNONE"; then
  22.       if test -d $ac_default_prefix/share/emacs/site-lisp; then
  23.     LISPDIR="\$(prefix)/share/emacs/site-lisp"
  24.       else
  25.     if test -d $ac_default_prefix/lib/emacs/site-lisp; then
  26.       LISPDIR="\$(prefix)/lib/emacs/site-lisp"
  27.     fi
  28.       fi
  29.     else
  30.       if test -d $prefix/share/emacs/site-lisp; then
  31.     LISPDIR="\$(prefix)/share/emacs/site-lisp"
  32.       else
  33.     if test -d $prefix/lib/emacs/site-lisp; then
  34.       LISPDIR="\$(prefix)/lib/emacs/site-lisp"
  35.     fi
  36.       fi
  37.     fi
  38.     AC_MSG_RESULT($LISPDIR)
  39.     ELCFILES="\$(ELCFILES)"
  40.   fi
  41.   AC_SUBST(LISPDIR)
  42.   AC_SUBST(ELCFILES)])
  43.  
  44. dnl --------------------------------------------------------- ##
  45. dnl Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
  46. dnl substitution.                                             ##
  47. dnl --------------------------------------------------------- ##
  48.  
  49. AC_DEFUN(AM_PROG_INSTALL,
  50. [AC_PROG_INSTALL
  51. test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755'
  52. AC_SUBST(INSTALL_SCRIPT)dnl
  53. ])
  54.  
  55. dnl --------------------------------------------------------- ##
  56. dnl The following definitions and this message have to go     ##
  57. dnl into the aclocal.m4 files of the packages to be           ##
  58. dnl internationalized.                                        ##
  59. dnl Last updated for gettext-0.10.24.                         ##
  60. dnl --------------------------------------------------------- ##
  61.  
  62. dnl ud_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
  63. dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  64. AC_DEFUN(ud_PATH_PROG_WITH_TEST,
  65. [# Extract the first word of "$2", so it can be a program name with args.
  66. set dummy $2; ac_word=[$]2
  67. AC_MSG_CHECKING([for $ac_word])
  68. AC_CACHE_VAL(ac_cv_path_$1,
  69. [case "[$]$1" in
  70.   /*)
  71.   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  72.   ;;
  73.   *)
  74.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  75.   for ac_dir in ifelse([$5], , $PATH, [$5]); do
  76.     test -z "$ac_dir" && ac_dir=.
  77.     if test -f $ac_dir/$ac_word; then
  78.       if [$3]; then
  79.     ac_cv_path_$1="$ac_dir/$ac_word"
  80.     break
  81.       fi
  82.     fi
  83.   done
  84.   IFS="$ac_save_ifs"
  85. dnl If no 4th arg is given, leave the cache variable unset,
  86. dnl so AC_PATH_PROGS will keep looking.
  87. ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  88. ])dnl
  89.   ;;
  90. esac])dnl
  91. $1="$ac_cv_path_$1"
  92. if test -n "[$]$1"; then
  93.   AC_MSG_RESULT([$]$1)
  94. else
  95.   AC_MSG_RESULT(no)
  96. fi
  97. AC_SUBST($1)dnl
  98. ])
  99.  
  100. dnl Check NLS options
  101.  
  102. AC_DEFUN(ud_LC_MESSAGES,
  103.   [if test $ac_cv_header_locale_h = yes; then
  104.     AC_CACHE_CHECK([for LC_MESSAGES], ud_cv_val_LC_MESSAGES,
  105.       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  106.        ud_cv_val_LC_MESSAGES=yes, ud_cv_val_LC_MESSAGES=no)])
  107.     if test $ud_cv_val_LC_MESSAGES = yes; then
  108.       AC_DEFINE(HAVE_LC_MESSAGES)
  109.     fi
  110.   fi])
  111.  
  112. AC_DEFUN(ud_WITH_NLS,
  113.   [AC_MSG_CHECKING([whether NLS is requested])
  114.     dnl Default is enabled NLS
  115.     AC_ARG_ENABLE(nls,
  116.       [  --disable-nls           do not use Native Language Support],
  117.       USE_NLS=$enableval, USE_NLS=yes)
  118.     AC_MSG_RESULT($USE_NLS)
  119.     AC_SUBST(USE_NLS)
  120.  
  121.     USE_INCLUDED_LIBINTL=no
  122.  
  123.     dnl If we use NLS figure out what method
  124.     if test "$USE_NLS" = "yes"; then
  125.       AC_DEFINE(ENABLE_NLS)
  126.       AC_MSG_CHECKING([whether included gettext is requested])
  127.       AC_ARG_WITH(included-gettext,
  128.         [  --with-included-gettext use the GNU gettext library included here],
  129.         nls_cv_force_use_gnu_gettext=$withval,
  130.         nls_cv_force_use_gnu_gettext=no)
  131.       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
  132.  
  133.       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
  134.       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
  135.         dnl User does not insist on using GNU NLS library.  Figure out what
  136.         dnl to use.  If gettext or catgets are available (in this order) we
  137.         dnl use this.  Else we have to fall back to GNU NLS library.
  138.     dnl catgets is only used if permitted by option --with-catgets.
  139.     nls_cv_header_intl=
  140.     nls_cv_header_libgt=
  141.     CATOBJEXT=NONE
  142.  
  143.     AC_CHECK_HEADER(libintl.h,
  144.       [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
  145.         [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
  146.            gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
  147.  
  148.        if test "$gt_cv_func_gettext_libc" != "yes"; then
  149.          AC_CHECK_LIB(intl, bindtextdomain,
  150.            [AC_CACHE_CHECK([for gettext in libintl],
  151.          gt_cv_func_gettext_libintl,
  152.          [AC_TRY_LINK([], [return (int) gettext ("")],
  153.          gt_cv_func_gettext_libintl=yes,
  154.          gt_cv_func_gettext_libintl=no)])])
  155.        fi
  156.  
  157.        if test "$gt_cv_func_gettext_libc" = "yes" \
  158.           || test "$gt_cv_func_gettext_libintl" = "yes"; then
  159.           AC_DEFINE(HAVE_GETTEXT)
  160.           ud_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  161.         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
  162.           if test "$MSGFMT" != "no"; then
  163.         AC_CHECK_FUNCS(dcgettext)
  164.         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  165.         ud_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  166.           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  167.         AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
  168.                    return _nl_msg_cat_cntr],
  169.           [CATOBJEXT=.gmo
  170.            DATADIRNAME=share],
  171.           [CATOBJEXT=.mo
  172.            DATADIRNAME=lib])
  173.         INSTOBJEXT=.mo
  174.           fi
  175.         fi
  176.     ])
  177.  
  178.         if test "$CATOBJEXT" = "NONE"; then
  179.       AC_MSG_CHECKING([whether catgets can be used])
  180.       AC_ARG_WITH(catgets,
  181.         [  --with-catgets          use catgets functions if available],
  182.         nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
  183.       AC_MSG_RESULT($nls_cv_use_catgets)
  184.  
  185.       if test "$nls_cv_use_catgets" = "yes"; then
  186.         dnl No gettext in C library.  Try catgets next.
  187.         AC_CHECK_LIB(i, main)
  188.         AC_CHECK_FUNC(catgets,
  189.           [AC_DEFINE(HAVE_CATGETS)
  190.            INTLOBJS="\$(CATOBJS)"
  191.            AC_PATH_PROG(GENCAT, gencat, no)dnl
  192.            if test "$GENCAT" != "no"; then
  193.          AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
  194.          if test "$GMSGFMT" = "no"; then
  195.            ud_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
  196.             [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
  197.          fi
  198.          ud_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  199.            [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  200.          USE_INCLUDED_LIBINTL=yes
  201.          CATOBJEXT=.cat
  202.          INSTOBJEXT=.cat
  203.          DATADIRNAME=lib
  204.          INTLDEPS="../intl/libintl.a"
  205.          INTLLIBS=$INTLDEPS
  206.          LIBS=`echo $LIBS | sed -e 's/-lintl//'`
  207.          nls_cv_header_intl=intl/libintl.h
  208.          nls_cv_header_libgt=intl/libgettext.h
  209.            fi])
  210.       fi
  211.         fi
  212.  
  213.         if test "$CATOBJEXT" = "NONE"; then
  214.       dnl Neither gettext nor catgets in included in the C library.
  215.       dnl Fall back on GNU gettext library.
  216.       nls_cv_use_gnu_gettext=yes
  217.         fi
  218.       fi
  219.  
  220.       if test "$nls_cv_use_gnu_gettext" = "yes"; then
  221.         dnl Mark actions used to generate GNU NLS library.
  222.         INTLOBJS="\$(GETTOBJS)"
  223.         ud_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  224.       [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
  225.         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  226.         ud_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  227.       [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  228.         AC_SUBST(MSGFMT)
  229.     USE_INCLUDED_LIBINTL=yes
  230.         CATOBJEXT=.gmo
  231.         INSTOBJEXT=.mo
  232.         DATADIRNAME=share
  233.     INTLDEPS="../intl/libintl.a"
  234.     INTLLIBS=$INTLDEPS
  235.     LIBS=`echo $LIBS | sed -e 's/-lintl//'`
  236.         nls_cv_header_intl=intl/libintl.h
  237.         nls_cv_header_libgt=intl/libgettext.h
  238.       fi
  239.  
  240.       dnl Test whether we really found GNU xgettext.
  241.       if test "$XGETTEXT" != ":"; then
  242.     dnl If it is no GNU xgettext we define it as : so that the
  243.     dnl Makefiles still can work.
  244.     if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  245.       : ;
  246.     else
  247.       AC_MSG_RESULT(
  248.         [found xgettext programs is not GNU xgettext; ignore it])
  249.       XGETTEXT=":"
  250.     fi
  251.       fi
  252.  
  253.       # We need to process the po/ directory.
  254.       POSUB=po
  255.     else
  256.       DATADIRNAME=share
  257.       nls_cv_header_intl=intl/libintl.h
  258.       nls_cv_header_libgt=intl/libgettext.h
  259.     fi
  260.  
  261.     # If this is used in GNU gettext we have to set USE_NLS to `yes'
  262.     # because some of the sources are only built for this goal.
  263.     if test "$PACKAGE" = gettext; then
  264.       USE_NLS=yes
  265.       USE_INCLUDED_LIBINTL=yes
  266.     fi
  267.  
  268.     dnl These rules are solely for the distribution goal.  While doing this
  269.     dnl we only have to keep exactly one list of the available catalogs
  270.     dnl in configure.in.
  271.     for lang in $ALL_LINGUAS; do
  272.       GMOFILES="$GMOFILES $lang.gmo"
  273.       POFILES="$POFILES $lang.po"
  274.     done
  275.  
  276.     dnl Make all variables we use known to autoconf.
  277.     AC_SUBST(USE_INCLUDED_LIBINTL)
  278.     AC_SUBST(CATALOGS)
  279.     AC_SUBST(CATOBJEXT)
  280.     AC_SUBST(DATADIRNAME)
  281.     AC_SUBST(GMOFILES)
  282.     AC_SUBST(INSTOBJEXT)
  283.     AC_SUBST(INTLDEPS)
  284.     AC_SUBST(INTLLIBS)
  285.     AC_SUBST(INTLOBJS)
  286.     AC_SUBST(POFILES)
  287.     AC_SUBST(POSUB)
  288.   ])
  289.  
  290. AC_DEFUN(ud_GNU_GETTEXT,
  291.   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  292.    AC_REQUIRE([AC_PROG_CC])dnl
  293.    AC_REQUIRE([AC_ISC_POSIX])dnl
  294.    AC_REQUIRE([AC_PROG_RANLIB])dnl
  295.    AC_REQUIRE([AC_HEADER_STDC])dnl
  296.    AC_REQUIRE([AC_C_CONST])dnl
  297.    AC_REQUIRE([AC_C_INLINE])dnl
  298.    AC_REQUIRE([AC_TYPE_OFF_T])dnl
  299.    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  300.    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  301.    AC_REQUIRE([AC_FUNC_MMAP])dnl
  302.  
  303.    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
  304. unistd.h values.h])
  305.    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
  306. __argz_count __argz_stringify __argz_next])
  307.  
  308.    if test "${ac_cv_func_stpcpy+set}" != "set"; then
  309.      AC_CHECK_FUNCS(stpcpy)
  310.    fi
  311.    if test "${ac_cv_func_stpcpy}" = "yes"; then
  312.      AC_DEFINE(HAVE_STPCPY)
  313.    fi
  314.  
  315.    ud_LC_MESSAGES
  316.    ud_WITH_NLS
  317.  
  318.    if test "x$CATOBJEXT" != "x"; then
  319.      if test "x$ALL_LINGUAS" = "x"; then
  320.        LINGUAS=
  321.      else
  322.        AC_MSG_CHECKING(for catalogs to be installed)
  323.        NEW_LINGUAS=
  324.        for lang in ${LINGUAS=$ALL_LINGUAS}; do
  325.          case "$ALL_LINGUAS" in
  326.           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  327.          esac
  328.        done
  329.        LINGUAS=$NEW_LINGUAS
  330.        AC_MSG_RESULT($LINGUAS)
  331.      fi
  332.  
  333.      dnl Construct list of names of catalog files to be constructed.
  334.      if test -n "$LINGUAS"; then
  335.        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  336.      fi
  337.    fi
  338.  
  339.    dnl Determine which catalog format we have (if any is needed)
  340.    dnl For now we know about two different formats:
  341.    dnl   Linux and the normal X/Open format
  342.    test -d intl || mkdir intl
  343.    if test "$CATOBJEXT" = ".cat"; then
  344.      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
  345.  
  346.      dnl Transform the SED scripts while copying because some dumb SEDs
  347.      dnl cannot handle comments.
  348.      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
  349.    fi
  350.    dnl po2tbl.sed is always needed.
  351.    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
  352.      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
  353.  
  354.    dnl In the intl/Makefile.in we have a special dependency which makes
  355.    dnl only sense for gettext.  We comment this out for non-gettext
  356.    dnl packages.
  357.    if test "$PACKAGE" = "gettext"; then
  358.      GT_NO="#NO#"
  359.      GT_YES=
  360.    else
  361.      GT_NO=
  362.      GT_YES="#YES#"
  363.    fi
  364.    AC_SUBST(GT_NO)
  365.    AC_SUBST(GT_YES)
  366.  
  367.    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
  368.    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
  369.    dnl Try to locate is.
  370.    MKINSTALLDIRS=
  371.    if test $ac_aux_dir; then
  372.      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
  373.    fi
  374.    if test -z $MKINSTALLDIRS; then
  375.      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
  376.    fi
  377.    AC_SUBST(MKINSTALLDIRS)
  378.  
  379.    dnl Generate list of files to be processed by xgettext which will
  380.    dnl be included in po/Makefile.
  381.    test -d po || mkdir po
  382.    if test "x$srcdir" != "x."; then
  383.      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
  384.        posrcprefix="$srcdir/"
  385.      else
  386.        posrcprefix="../$srcdir/"
  387.      fi
  388.    else
  389.      posrcprefix="../"
  390.    fi
  391.    sed -e "/^#/d" -e "/^\$/d" -e "s,.*,    $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
  392.     < $srcdir/po/POTFILES.in > po/POTFILES
  393.   ])
  394.