home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-src.tgz / tar.out / contrib / unixtex / aclocal.m4 next >
M4 Source File  |  1996-09-28  |  12KB  |  350 lines

  1. dnl Modifications for the latest version of Autoconf for kpathsea.
  2. dnl These changes have all been sent back to the Autoconf maintainer.
  3.  
  4. dnl This is a subroutine of AC_OUTPUT.  It is called inside an unquoted
  5. dnl here document whose contents are going into config.status.
  6. dnl AC_OUTPUT_FILES(FILE...)
  7. dnl I've added ac_include support --karl@cs.umb.edu.
  8. undefine([AC_OUTPUT_FILES])
  9. define(AC_OUTPUT_FILES,
  10. [# Protect against being on the right side of a sed subst in config.status. 
  11. changequote(, )dnl
  12. sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
  13.  s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
  14. changequote([, ])dnl
  15. dnl These here document variables are unquoted when configure runs
  16. dnl but quoted when config.status runs, so variables are expanded once.
  17. $ac_vpsub
  18. dnl Shell code in configure.in might set extrasub.
  19. $extrasub
  20. dnl Insert the sed substitutions of variables.
  21. undivert(AC_DIVERSION_SED)
  22. CEOF
  23. EOF
  24. cat >> $CONFIG_STATUS <<EOF
  25.  
  26. CONFIG_FILES=\${CONFIG_FILES-"$1"}
  27. EOF
  28. cat >> $CONFIG_STATUS <<\EOF
  29. for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
  30. dnl Specifying an input file breaks the trap to clean up on interrupt,
  31. dnl but that's not a huge problem.
  32.   # Support "outfile[:infile]", defaulting infile="outfile.in".
  33.   case "$ac_file" in
  34.   *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
  35.        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  36.   *) ac_file_in="${ac_file}.in" ;;
  37.   esac
  38.  
  39.   # Adjust relative srcdir, etc. for subdirectories.
  40.  
  41.   # Remove last slash and all that follows it.  Not all systems have dirname.
  42. changequote(, )dnl
  43.   ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
  44. changequote([, ])dnl
  45.   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
  46.     # The file is in a subdirectory.
  47.     test ! -d "$ac_dir" && mkdir "$ac_dir"
  48.     ac_dir_suffix="/$ac_dir"
  49.     # A "../" for each directory in $ac_dir_suffix.
  50. changequote(, )dnl
  51.     ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
  52. changequote([, ])dnl
  53.   else
  54.     ac_dir_suffix= ac_dots=
  55.   fi
  56.  
  57.   case "$ac_given_srcdir" in
  58.   .)  srcdir=.
  59.       if test -z "$ac_dots"; then top_srcdir=.
  60.       else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
  61.   /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
  62.   *) # Relative path.
  63.     srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
  64.     top_srcdir="$ac_dots$ac_given_srcdir" ;;
  65.   esac
  66.  
  67. ifdef([AC_PROVIDE_AC_PROG_INSTALL],
  68. [  case "$ac_given_INSTALL" in
  69. changequote(, )dnl
  70.   [/$]*) INSTALL="$ac_given_INSTALL" ;;
  71. changequote([, ])dnl
  72.   *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
  73.   esac
  74. ])dnl
  75.   echo creating "$ac_file"
  76.   rm -f "$ac_file"
  77.   configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
  78.   case "$ac_file" in
  79.   *Makefile*) ac_comsub="1i\\
  80. # $configure_input" ;;
  81.   *) ac_comsub= ;;
  82.   esac
  83.   # Replace lines of the form ac_include foo with the contents of foo:
  84.   # first, from the ac_include lines construct a list of sed
  85.   # commands to remove them, and include the files; then run sed.
  86.   # Have to use sed because old (Ultrix, SunOS) awk does not support
  87.   # getline or system. (Anyway, configure scripts aren't supposed to use awk.)
  88.   # Use \@...@<cmd> form of sed address because the filename may contain /.
  89.   # Can't use only one -e and commands {dr foo} because foo has to be last.
  90.   # Use @e initially instead of -e because GNU echo has a -e option.
  91.   # USe `X' to mean a bunch of backslashes; this is for FreeBSD.
  92.   file_substs=`sed -n \
  93. changequote(,)dnl
  94. "/^ac_include/s%ac_include[     ]*\(.*\)%@e 'X@^&@r \1' -e 'X@^&@d'%p" \
  95. changequote([,])dnl
  96.                $ac_given_srcdir/${ac_file}.in`
  97.   if test -n "$file_substs"; then
  98.     # Change @e back to -e and X@^ to \@^.
  99.     file_subst_cmd="sed `echo $file_substs \
  100.                          | sed -e 's/@e/-e/g' -e 's/X@^/\\\\\@^/g'`"
  101.   else
  102.     # If no substitutions and hence no sed commands, don't choke.
  103.     file_subst_cmd=cat
  104.   fi
  105.   # cd into the srcdir because the files being included more or less
  106.   # must be part of the distribution. I can't find any way to do
  107.   # variable substitution in the sed commands (so the user could have,
  108.   # e.g., $top_srcdir in their ac_include line).
  109.   (cd $ac_given_srcdir && eval $file_subst_cmd ${ac_file}.in) \
  110.   | sed -e "$ac_comsub
  111. s%@configure_input@%$configure_input%g
  112. s%@srcdir@%$srcdir%g
  113. s%@top_srcdir@%$top_srcdir%g
  114. ifdef([AC_PROVIDE_AC_PROG_INSTALL], [s%@INSTALL@%$INSTALL%g
  115. ])dnl
  116. " -f conftest.subs > $ac_file
  117. fi; done
  118. rm -f conftest.subs
  119. ])
  120.  
  121.  
  122. dnl 
  123. dnl Only change from Autoconf 2.1 is to check IceConnectionNumber, not
  124. dnl ...Numbers.
  125. dnl
  126. dnl Find additional X libraries, magic flags, etc.
  127. undefine([AC_PATH_XTRA])
  128. AC_DEFUN(AC_PATH_XTRA,
  129. [AC_REQUIRE([AC_ISC_POSIX])dnl
  130. AC_REQUIRE([AC_PATH_X])dnl
  131. if test "$no_x" = yes; then 
  132.   # Not all programs may use this symbol, but it does not hurt to define it.
  133.   X_CFLAGS="$X_CFLAGS -DX_DISPLAY_MISSING"
  134. else
  135.   if test -n "$x_includes"; then
  136.     X_CFLAGS="$X_CFLAGS -I$x_includes"
  137.   fi
  138.  
  139.   # It would be nice to have a more robust check for the -R ld option than
  140.   # just checking for Solaris.
  141.   # It would also be nice to do this for all -L options, not just this one.
  142.   if test -n "$x_libraries"; then
  143.     X_LIBS="$X_LIBS -L$x_libraries"
  144.     if test "`(uname) 2>/dev/null`" = SunOS &&
  145.       uname -r | grep '^5' >/dev/null; then
  146.       X_LIBS="$X_LIBS -R$x_libraries"
  147.     fi
  148.   fi
  149.  
  150.   # Check for libraries that X11R6 Xt/Xaw programs need.
  151.  
  152.   ac_save_LDFLAGS="$LDFLAGS"
  153.   LDFLAGS="$LDFLAGS -L$x_libraries"
  154.   # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
  155.   # check for ICE first), but we must link in the order -lSM -lICE or
  156.   # we get undefined symbols.  So assume we have SM if we have ICE.
  157.   # These have to be linked with before -lX11, unlike the other
  158.   # libraries we check for below, so use a different variable.
  159.   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
  160.   AC_CHECK_LIB(ICE, IceConnectionNumber,
  161.     [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"])
  162.   LDFLAGS="$ac_save_LDFLAGS"
  163.  
  164.   # Check for system-dependent libraries X programs must link with.
  165.  
  166.   if test "$ISC" = yes; then
  167.     X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
  168.   else
  169.     # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
  170.     # libraries were built with DECnet support.  And karl@cs.umb.edu says
  171.     # the Alpha needs dnet_stub (dnet does not exist).
  172.     AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
  173.     if test $ac_cv_lib_dnet = no; then
  174.       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
  175.         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
  176.     fi
  177.  
  178.     # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
  179.     # to get the SysV transport functions.
  180.     # Not sure which flavor of 386 UNIX this is, but it seems harmless to
  181.     # check for it.
  182.     AC_CHECK_LIB(nsl, t_accept, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"])
  183.  
  184.     # lieder@skyler.mavd.honeywell.com says without -lsocket,
  185.     # socket/setsockopt and other routines are undefined under SCO ODT 2.0.
  186.     # But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
  187.     if test "`(uname) 2>/dev/null`" != IRIX; then
  188.       AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
  189.     fi
  190.   fi
  191. fi
  192. AC_SUBST(X_CFLAGS)dnl
  193. AC_SUBST(X_PRE_LIBS)dnl
  194. AC_SUBST(X_LIBS)dnl
  195. AC_SUBST(X_EXTRA_LIBS)dnl
  196. ])
  197.  
  198.  
  199. dnl 
  200. dnl Definition was buggy in Autoconf 2.1; parameters were incorrectly
  201. dnl passed to AC_MSG_ERROR and AC_TRY_LINK.
  202. dnl
  203. dnl Check if lex declares yytext as a char * by default, not a char[].
  204. undefine([AC_DECL_YYTEXT])
  205. AC_DEFUN(AC_DECL_YYTEXT,
  206. [AC_REQUIRE_CPP()dnl
  207. AC_REQUIRE([AC_PROG_LEX])dnl
  208. AC_CACHE_VAL(ac_cv_prog_lex_output_root,
  209. [# The minimal lex program is just a single line: %%.  But some broken lexes
  210. # (Solaris, I think it was) want two %% lines, so accommodate them.
  211. echo '%%
  212. %%' | $LEX
  213. if test -f lex.yy.c; then
  214.   ac_cv_prog_lex_output_root=lex.yy
  215. elif test -f lexyy.c; then
  216.   ac_cv_prog_lex_output_root=lexyy
  217. else
  218.   AC_MSG_ERROR([cannot find output from $LEX, giving up])
  219. fi])dnl
  220. LEX_OUTPUT_ROOT=$ac_cv_prog_lex_output_root
  221. AC_SUBST(LEX_OUTPUT_ROOT)dnl
  222. AC_MSG_CHECKING(for yytext declaration)
  223. AC_CACHE_VAL(ac_cv_prog_lex_yytext_pointer,
  224. [# POSIX says lex can declare yytext either as a pointer or an array; the
  225. # default is implementation-dependent. Figure out which it is, since
  226. # not all implementations provide the %pointer and %array declarations.
  227. ac_cv_prog_lex_yytext_pointer=no
  228. echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
  229. ac_save_LIBS="$LIBS"
  230. LIBS="$LIBS $LEXLIB"
  231. AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`,, ac_cv_prog_lex_yytext_pointer=yes)
  232. LIBS="$ac_save_LIBS"
  233. rm -f "${LEX_OUTPUT_ROOT}.c"])dnl
  234. AC_MSG_RESULT($ac_cv_prog_lex_yytext_pointer)
  235. if test $ac_cv_prog_lex_yytext_pointer = yes; then
  236.   AC_DEFINE(YYTEXT_POINTER)
  237. fi
  238. ])
  239.  
  240. dnl 
  241. dnl install-sh needs .. magic.
  242. dnl
  243. dnl AC_OUTPUT_SUBDIRS(DIRECTORY...)
  244. undefine([AC_OUTPUT_SUBDIRS])
  245. define(AC_OUTPUT_SUBDIRS,
  246. [
  247. if test "$no_recursion" != yes; then
  248.  
  249.   # Remove --cache-file and --srcdir arguments so they do not pile up.
  250.   ac_sub_configure_args=
  251.   ac_prev=
  252.   for ac_arg in $ac_configure_args; do
  253.     if test -n "$ac_prev"; then
  254.       ac_prev=
  255.       continue
  256.     fi
  257.     case "$ac_arg" in
  258.     -cache-file | --cache-file | --cache-fil | --cache-fi \
  259.     | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
  260.       ac_prev=cache_file ;;
  261.     -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
  262.     | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
  263.       ;;
  264.     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  265.       ac_prev=srcdir ;;
  266.     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  267.       ;;
  268.     *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
  269.     esac
  270.   done
  271.  
  272.   for ac_config_dir in $1; do
  273.  
  274.     # Do not complain, so a configure script can configure whichever
  275.     # parts of a large source tree are present.
  276.     if test ! -d $srcdir/$ac_config_dir; then
  277.       continue
  278.     fi
  279.  
  280.     echo configuring in $ac_config_dir
  281.  
  282.     case "$srcdir" in
  283.     .) ;;
  284.     *)
  285.       if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
  286.       else
  287.         AC_MSG_ERROR(can not create `pwd`/$ac_config_dir)
  288.       fi
  289.       ;;
  290.     esac
  291.  
  292.     ac_popdir=`pwd`
  293.     cd $ac_config_dir
  294.  
  295.     case "$srcdir" in
  296.     .) # No --srcdir option.  We are building in place.
  297.       ac_sub_srcdir=$srcdir ;;
  298.     /*) # Absolute path.
  299.       ac_sub_srcdir=$srcdir/$ac_config_dir ;;
  300.     *) # Relative path.
  301.       ac_sub_srcdir=../$srcdir/$ac_config_dir ;;
  302.     esac
  303.  
  304.     # Check for guested configure; otherwise get Cygnus style configure.
  305.     if test -f $ac_sub_srcdir/configure; then
  306.       ac_sub_configure=$ac_sub_srcdir/configure
  307.     elif test -f $ac_sub_srcdir/configure.in; then
  308.       ac_sub_configure=$ac_configure
  309.     else
  310.       AC_MSG_WARN(no configuration information is in $ac_config_dir)
  311.       ac_sub_configure=
  312.     fi
  313.  
  314.     # The recursion is here.
  315.     if test -n "$ac_sub_configure"; then
  316.  
  317.       # Make the cache file name correct relative to the subdirectory.
  318. changequote(, )dnl
  319.       # A "../" for each directory in /$ac_config_dir.
  320.       ac_dots=`echo /$ac_config_dir|sed 's%/[^/]*%../%g'`
  321. changequote([, ])dnl
  322.       case "$cache_file" in
  323.       /*) ac_sub_cache_file=$cache_file ;;
  324.       *) # Relative path.
  325.         ac_sub_cache_file="$ac_dots$cache_file" ;;
  326.       esac
  327.  
  328. ifdef([AC_PROVIDE_AC_PROG_INSTALL],
  329.       [  case "$ac_given_INSTALL" in
  330. changequote(, )dnl
  331.         [/$]*) INSTALL="$ac_given_INSTALL" ;;
  332. changequote([, ])dnl
  333.         *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
  334.         esac
  335. ])dnl
  336.  
  337.       echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir"
  338.       # The eval makes quoting arguments work.
  339.       if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
  340.       then :
  341.       else
  342.         AC_MSG_ERROR($ac_sub_configure failed for $ac_config_dir)
  343.       fi
  344.     fi
  345.  
  346.     cd $ac_popdir
  347.   done
  348. fi
  349. ])
  350.