1# Local additions to Autoconf macros. 2# Copyright (C) 1992, 1994 Free Software Foundation, Inc. 3# Francois Pinard <pinard@iro.umontreal.ca>, 1992. 4# ( modified slightly for ATP by tgm 11/16/94 ) 5# @defmac AC_PROG_CC_STDC 6# @maindex PROG_CC_STDC 7# @ovindex CC 8# If the C compiler in not in ANSI C mode by default, try to add an option 9# to output variable @code{CC} to make it so. This macro tries various 10# options that select ANSI C on some system or another. It considers the 11# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and 12# handles function prototypes correctly. 13# 14# If you use this macro, you should check after calling it whether the C 15# compiler has been set to accept ANSI C; if not, the shell variable 16# @code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source 17# code in ANSI C, you can make an un-ANSIfied copy of it by using the 18# program @code{ansi2knr}, which comes with Ghostscript. 19# @end defmac 20 21define(fp_PROG_CC_STDC, 22[AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) 23AC_CACHE_VAL(ac_cv_prog_cc_stdc, 24[ac_cv_prog_cc_stdc=no 25ac_save_CFLAGS="$CFLAGS" 26# Don't try gcc -ansi; that turns off useful extensions and 27# breaks some systems' header files. 28# AIX -qlanglvl=ansi 29# Ultrix and OSF/1 -std1 30# HP-UX -Aa -D_HPUX_SOURCE 31# SVR4 -Xc 32for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc 33do 34 CFLAGS="$ac_save_CFLAGS $ac_arg" 35 AC_TRY_COMPILE( 36[#if !defined(__STDC__) || __STDC__ != 1 37choke me 38#endif 39], [int test (int i, double x); 40struct s1 {int (*f) (int a);}; 41struct s2 {int (*f) (double a);};], 42[ac_cv_prog_cc_stdc="$ac_arg"; break]) 43done 44CFLAGS="$ac_save_CFLAGS" 45]) 46AC_MSG_RESULT($ac_cv_prog_cc_stdc) 47case "x$ac_cv_prog_cc_stdc" in 48 x|xno) ;; 49 *) CC="$CC $ac_cv_prog_cc_stdc" ;; 50esac 51]) 52 53# Check for function prototypes. 54 55AC_DEFUN(atp_C_PROTOTYPES, 56[AC_REQUIRE([fp_PROG_CC_STDC]) 57AC_MSG_CHECKING([for working ansi prototypes]) 58if test "$ac_cv_prog_cc_stdc" != no; then 59 AC_MSG_RESULT(yes) 60 ATPCNVR= 61else 62 AC_MSG_RESULT(no) 63 ATPCNVR=convert 64 AC_DEFINE(no_proto) 65fi 66AC_SUBST(ATPCNVR) 67]) 68 69# Check if --with-dmalloc was given. 70 71AC_DEFUN(fp_WITH_DMALLOC, 72[AC_MSG_CHECKING(if malloc debugging is wanted) 73AC_ARG_WITH(dmalloc, 74[ --with-dmalloc use dmalloc, as in dmalloc.tar.gz from 75 @/ftp.antaire.com:antaire/src/dmalloc.], 76[if test "$withval" = yes; then 77 AC_MSG_RESULT(yes) 78 AC_DEFINE(WITH_DMALLOC) 79 LIBS="$LIBS -ldmalloc" 80 LDFLAGS="$LDFLAGS -g" 81else 82 AC_MSG_RESULT(no) 83fi], [AC_MSG_RESULT(no)])]) 84 85dnl ### Checks for operating system services 86 87 88AC_DEFUN(atp_SYS_INTERPRETER, 89[# Pull the hash mark out of the macro call to avoid m4 problems. 90AC_PATH_PROG(CATBPATH,cat,/bin/cat) 91ac_msg="whether #! works in shell scripts" 92AC_MSG_CHECKING($ac_msg) 93AC_CACHE_VAL(ac_cv_sys_interpreter, 94[echo "#!$CATBPATH 95exit 69 96" > conftest 97chmod u+x conftest 98(SHELL=/bin/sh; export SHELL; ./conftest >/dev/null 2>&1) 99if test $? -ne 69; then 100 ac_cv_sys_interpreter=yes 101else 102 ac_cv_sys_interpreter=no 103fi 104rm -f conftest])dnl 105AC_MSG_RESULT($ac_cv_sys_interpreter) 106]) 107 108 109# check for nroff program and proper output device for plain text 110# 111AC_DEFUN(atp_PROG_NROFF, 112[ 113# see which nroff program is available (gnu groff preferred of course). 114AC_CHECK_PROG(ROFF,groff,groff,nroff) 115 116# set output device for nroff command 117AC_CACHE_CHECK(for $ROFF output device,atp_cv_prog_nroff_device,[ 118cat>nroff.tst <<EOF 119hello 120EOF 121 122if test "$ROFF" = groff ; then 123 atp_cv_prog_nroff_device=-Tascii 124elif $ROFF -Tascii nroff.tst >/dev/null 2>&1 ; then 125 atp_cv_prog_nroff_device=-Tascii 126elif $ROFF -Tman nroff.tst >/dev/null 2>&1 ; then 127 atp_cv_prog_nroff_device=-Tman 128elif $ROFF -Tlpr nroff.tst >/dev/null 2>&1 ; then 129 atp_cv_prog_nroff_device=-Tlpr 130else 131 atp_cv_prog_nroff_device="" 132fi 133 134rm -f nroff.tst 135]) 136A_DEVRF=$atp_cv_prog_nroff_device 137AC_SUBST(A_DEVRF) 138]) 139 140 141# check if mkdir accepts the -p switch 142# 143AC_DEFUN(atp_PROG_MKDIR_P, 144[ 145AC_CACHE_CHECK(whether mkdir accepts -p,atp_cv_prog_mkdir_p,[ 146if mkdir -p ./sd9fdSf3/Td7sfvIl ; then 147 rmdir ./sd9fdSf3/Td7sfvIl 148 rmdir ./sd9fdSf3 149 atp_cv_prog_mkdir_p=yes 150else 151 atp_cv_prog_mkdir_p=no 152fi 153]) 154if test "$atp_cv_prog_mkdir_p" = yes ; then 155 MKDIR="mkdir -p" 156else 157 MKDIR=mkdir 158fi 159AC_SUBST(MKDIR) 160]) 161 162 163# check if col accepts the -x switch 164# 165AC_DEFUN(atp_PROG_COL_X, 166[ 167AC_CHECK_PROG(A_COL,col,UCOL,SCOL) 168A_UCOL="col -b" 169if test "$A_COL" = UCOL ; then 170AC_CACHE_CHECK(whether col accepts -x,atp_cv_prog_col_x,[ 171cat>col.tst <<EOF 172hello 173EOF 174 175 if col -x < col.tst >/dev/null 2>&1 ; then 176 atp_cv_prog_col_x=yes 177 else 178 atp_cv_prog_col_x=no 179 fi 180 rm -f col.tst 181]) 182 if test "$atp_cv_prog_col_x" = yes ; then 183 A_UCOL="col -bx" 184 fi 185fi 186AC_SUBST(A_UCOL) 187]) 188 189 190# Check for termcap global variables in libraries. 191# 192#AC_DEFUN(atp_VAR_TERMCAP, 193#[ 194#AC_MSG_CHECKING([for termcap global variables]) 195#AC_CACHE_VAL(atp_cv_var_termcap, 196#[ AC_TRY_LINK( [#define SYS_UNIX 1], 197#extern char *BC ; 198#extern char *UP ; 199#extern char PC ; 200#extern short ospeed ; 201#int atp_ospeed ; int atp_PC; char *atp_BC; char *atp_UP ; 202#atp_ospeed = ospeed ; atp_PC = PC ; atp_BC = BC ; atp_UP = UP ; , 203#atp_cv_var_termcap=yes, atp_cv_var_termcap=no)]) 204#if test "$atp_cv_var_termcap" = no; then 205#AC_DEFINE(NEED_TCVARS) 206#fi 207#AC_MSG_RESULT($atp_cv_var_termcap) 208#]) 209 210## check for man page owner and group 211 212# helper function 213AC_DEFUN(atp_GROUP_MAN_TPATH, 214[ 215AC_PROVIDE([$0]) 216atp_t_file=man/man1/ls.1 217 218if test -f /usr/$atp_t_file* ; then 219 atp_t_path=/usr/$atp_t_file 220elif test -f /usr/share/$atp_t_file* ; then 221 atp_t_path=/usr/share/$atp_t_file 222else 223 >t_tmp_t.test 224 atp_t_path=./t_tmp_t.test 225fi 226]) 227 228# get man owner 229AC_DEFUN(atp_GROUP_MAN_OWN, 230[ 231 AC_REQUIRE([atp_GROUP_MAN_TPATH]) 232 atp_cv_group_man_own=`ls -l $atp_t_path* | $ac_cv_prog_AWK '{ print [$[]3] }'` 233]) 234 235# get bin owner 236AC_DEFUN(atp_GROUP_BIN_OWN, 237[ 238 AC_REQUIRE([AC_PROG_AWK]) 239 >t_tmp_b.test 240 atp_b_path=./t_tmp_b.test 241 atp_cv_group_bin_own=`ls -l $atp_b_path* | $ac_cv_prog_AWK '{ print [$[]3] }'` 242 rm -f t_tmp_b.test 243]) 244 245dnl AC_DEFUN(atp_GROUP_MAN_GRP, 246dnl [ 247dnl dnl AC_REQUIRE([atp_GROUP_MAN_TPATH]) 248dnl 249dnl atp_t_grp=`ls -l $atp_t_path* | $ac_cv_prog_AWK '{ print [$[]4] }'` 250dnl 251dnl if echo $atp_t_grp | grep -e '[A-Za-z]' >/dev/null 2>&1 ; then 252dnl : 253dnl else 254dnl atp_t_grp=`ls -lg $atp_t_path* | $ac_cv_prog_AWK '{ print [$[]4] }'` 255dnl fi 256dnl 257dnl rm -f ./t_tmp_t.test 258dnl atp_cv_group_man_grp=$atp_t_grp 259dnl ]) 260 261dnl AC_DEFUN(atp_GROUP_MAN, 262dnl [ 263dnl AC_CACHE_CHECK(for man owner,atp_cv_group_man_own, 264dnl atp_GROUP_MAN_OWN 265dnl ) 266dnl AC_CACHE_CHECK(for man group,atp_cv_group_man_grp, 267dnl atp_GROUP_MAN_GRP 268dnl ) 269dnl rm -f ./t_tmp_t.test 270dnl man_own=$atp_cv_group_man_own 271dnl AC_SUBST(man_own) 272dnl man_grp=$atp_cv_group_man_grp 273dnl AC_SUBST(man_grp) 274dnl ]) 275 276AC_DEFUN(atp_C_VOLATILE, 277[ 278AC_CACHE_CHECK(for working volatile,atp_cv_c_volatile,[ 279AC_TRY_COMPILE( , 280static volatile int mcmahon ; , 281atp_cv_c_volatile=yes, 282atp_cv_c_volatile=no)]) 283# define volatile to empty string if test fails 284if test "$atp_cv_c_volatile" = no ; then 285 AC_DEFINE(volatile, ) 286fi 287]) 288