1dnl Process this file with autoconf to produce a configure script. 2AC_INIT([bibclean],[3.06],[Nelson H. F. Beebe <beebe@math.utah.edu>]) 3PACKAGE_DATE="06-Mar-2021" 4 5AC_CONFIG_SRCDIR(bibclean.c) 6 7AH_TEMPLATE(PACKAGE_BUGREPORT, [Package bug-reporting address]) 8AH_TEMPLATE(PACKAGE_DATE, [Package date]) 9AH_TEMPLATE(PACKAGE_NAME, [Package name]) 10AH_TEMPLATE(PACKAGE_STRING, [Package string]) 11AH_TEMPLATE(PACKAGE_TARNAME, [Package tarname]) 12AH_TEMPLATE(PACKAGE_VERSION, [Package version]) 13AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT") 14AC_DEFINE_UNQUOTED(PACKAGE_DATE, "$PACKAGE_DATE") 15AC_DEFINE_UNQUOTED(PACKAGE_NAME, "$PACKAGE_NAME") 16AC_DEFINE_UNQUOTED(PACKAGE_STRING, "$PACKAGE_STRING") 17AC_DEFINE_UNQUOTED(PACKAGE_TARNAME, "$PACKAGE_TARNAME") 18AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "$PACKAGE_VERSION") 19 20AC_CONFIG_HEADERS([config.h:config.hin]) 21 22dnl Checks for support programs 23 24AC_CHECK_PROGS(ANTIC, antic) 25AC_CHECK_PROGS(AUTOCONF, autoconf) 26AC_CHECK_PROGS(AUTOHEADER, autoheader) 27AC_CHECK_PROGS(AWK, mawk nawk gawk bawk awk) 28AC_CHECK_PROGS(BIBTEX, bibtex) 29AC_CHECK_PROGS(CAT, cat) 30AC_CHECK_PROGS(CHECKSUM, checksum) 31AC_CHECK_PROGS(CHMOD, chmod) 32AC_CHECK_PROGS(CMP, cmp) 33 34dnl We want a copy command that has the -p (preserve time stamp) flag, 35dnl but older cp implementations lack it. scp and rcp always have it, 36dnl but some sites disable rcp when scp is installed, so we must use 37dnl scp if it is available. 38AC_CHECK_PROG(CP, scp,scp -p) 39AC_CHECK_PROG(CP, rcp,rcp -p) 40AC_CHECK_PROG(CP, cp,cp) 41 42AC_CHECK_PROGS(CPPCHECK, cppcheck) 43AC_CHECK_PROGS(CUT, cut) 44AC_CHECK_PROGS(DATE, date) 45AC_CHECK_PROGS(DIFF, diff) 46AC_CHECK_PROGS(DISTILL, distill ps2pdf) 47AC_CHECK_PROGS(DITROFF, ditroff groff) 48AC_CHECK_PROGS(ETAGS, etags) 49AC_CHECK_PROGS(EXPR, expr) 50AC_CHECK_PROGS(FLAWFINDER, flawfinder) 51AC_CHECK_PROGS(GREP, egrep grep) 52AC_CHECK_PROGS(GZIP, gzip compress) 53AC_CHECK_PROGS(HTMLNCHECK, [html-ncheck echo]) 54AC_CHECK_PROGS(HTMLPRETTY, [html-pretty echo]) 55AC_CHECK_PROGS(ITS4, its4) 56AC_CHECK_PROGS(JAR, jar tar) 57AC_CHECK_PROGS(LATEX, latex2e latex) 58AC_CHECK_PROGS(LINT, lint) 59AC_CHECK_PROGS(LN, ln) 60AC_CHECK_PROGS(LS, ls) 61AC_CHECK_PROGS(MAN2HTML, man2html) 62AC_CHECK_PROGS(MKDIR, mkdir) 63AC_CHECK_PROGS(MV, mv) 64AC_CHECK_PROGS(NROFF, nroff) 65AC_CHECK_PROGS(RATS, rats) 66AC_CHECK_PROGS(RM, rm) 67AC_CHECK_PROGS(SED, sed) 68AC_CHECK_PROGS(SPLINT, [splint lclint]) 69AC_PATH_PROG(SHELL, sh) 70AC_CHECK_PROGS(STRIP, strip) 71AC_CHECK_PROGS(TAR, gtar gnutar tar) 72AC_CHECK_PROGS(TEST, test) 73AC_CHECK_PROGS(TOUCH, touch) 74AC_CHECK_PROGS(TR, tr) 75AC_CHECK_PROGS(UNO, uno) 76AC_CHECK_PROGS(UNZIP, unzip) 77AC_CHECK_PROGS(WINE, wine) 78AC_CHECK_PROGS(ZIP, zip false) 79AC_CHECK_PROGS(ZOO, zoo false) 80 81dnl Checks for NeXT -posix 82AC_MSG_CHECKING(whether we have NeXT system, and so need -posix) 83if test -d /NextAdmin 84then CFLAGS=-posix 85AC_MSG_RESULT(yes) 86else 87AC_MSG_RESULT(no) 88fi 89 90dnl Checks for compiler 91AC_PROG_CC 92 93dnl Checks for ALL (IBM RS/6000 c89 needs _ALL_SOURCE when ioctl.h is 94dnl used with winsize) 95AC_MSG_CHECKING(whether we need _ALL_SOURCE) 96all=no 97AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 98#include <sys/types.h> 99#include <sys/ioctl.h> 100struct winsize w; 101]], [[]])],[],[all=maybe]) 102if test $all = maybe ; then 103AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 104#define _ALL_SOURCE 105#include <sys/types.h> 106#include <sys/ioctl.h> 107struct winsize w; 108]], [[]])],[AC_DEFINE(_ALL_SOURCE) all=yes],[]) 109fi 110if test $all = maybe ; then all=no ; fi 111AC_MSG_RESULT($all) 112 113dnl Checks for POSIX (HP-UX c89 needs _POSIX_SOURCE when stat.h is used) 114AC_MSG_CHECKING(whether we need _POSIX_SOURCE) 115posix=no 116AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 117#include <sys/types.h> 118#include <sys/stat.h> 119struct stat buffer; 120]], [[]])],[],[posix=maybe]) 121if test $posix = maybe ; then 122AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 123#define _POSIX_SOURCE 124#include <sys/types.h> 125#include <sys/stat.h> 126struct stat buffer; 127]], [[]])],[AC_DEFINE(_POSIX_SOURCE) posix=yes],[]) 128fi 129if test $posix = maybe ; then posix=no ; fi 130AC_MSG_RESULT($posix) 131 132dnl Checks for Standard C and C++ function declarations. 133AC_MSG_CHECKING(for Standard C and C++ function declarations) 134AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void foo(void){} 135int bar(int x, float y, char z){return 1;}]], [[]])],[AC_MSG_RESULT(yes) 136 AC_DEFINE(HAVE_STDC)],[AC_MSG_RESULT(no)]) 137 138dnl Checks for SunOS C++ free() argument type bug 139AC_MSG_CHECKING(for SunOS C++ free() argument type bug) 140freebug=no 141AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], [[void *p; p = (void*)0; free(p)]])],[],[freebug=maybe]) 142 143if test $freebug = maybe ; then 144AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], [[void *p; p = (void*)0; free((char*)p)]])],[AC_DEFINE(FREE_CAST_IS_CHAR_STAR) freebug=yes],[]) 145fi 146if test $freebug = maybe ; then freebug=no ; fi 147AC_MSG_RESULT($freebug) 148 149dnl Checks for Standard C alert character 150AC_MSG_CHECKING(for Standard C alert character) 151havealert=yes 152AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return((int)'\a'-007);}]])],[havealert=yes 153 AC_DEFINE(HAVE_ALERT_CHAR)],[havealert=no],[havealert=no]) 154AC_MSG_RESULT($havealert) 155 156dnl Checks for programs. 157 158dnl Checks for libraries. 159 160dnl Checks for header file conflicts. For the lcc compiler on at 161dnl least Compaq/DEC Alpha OSF/1 4.0, <sys/param.h> conflicts with 162dnl <limits.h>, sigh... NB: This test must come BEFORE the 163dnl AC_CHECK_HEADERS() test below! 164AC_MSG_CHECKING(for <limits.h> <sys/param.h> compatibility) 165AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/param.h> 166 #include <limits.h>]], [[]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no) 167 ac_cv_header_sys_param_h=no}]) 168 169 170dnl Checks for header files. 171dnl m4_warn([obsolete], 172dnl [The preprocessor macro `STDC_HEADERS' is obsolete. 173dnl Except in unusual embedded environments, you can safely include all 174dnl ISO C90 headers unconditionally.])dnl 175# Autoupdate added the next two lines to ensure that your configure 176# script's behavior did not change. They are probably safe to remove. 177AC_CHECK_INCLUDES_DEFAULT 178AC_PROG_EGREP 179 180AC_CHECK_HEADERS(conio.h ctype.h descrip.h errno.h fcntl.h io.h \ 181iodef.h jpidef.h libc.h limits.h osfcn.h pwd.h regex.h regexp.h \ 182rms.h sgtty.h ssdef.h stat.h stdbool.h stdio.h stdlib.h string.h sys/ioctl.h \ 183sys/param.h sys/stat.h sys/types.h termio.h termios.h time.h \ 184tt2def.h ttdef.h types.h unistd.h unixio.h ) 185 186dnl Checks for typedefs, structures, and compiler characteristics. 187AC_C_CONST 188AC_TYPE_MODE_T 189AC_TYPE_SIZE_T 190AC_STRUCT_TM 191 192dnl Checks for bool and/or _Bool 193AC_CHECK_TYPES(_Bool,,,[#include <stdbool.h>]) 194 195dnl Checks for library functions. 196AC_PROG_GCC_TRADITIONAL 197AC_FUNC_UTIME_NULL 198AC_REPLACE_FUNCS(strtol) 199AC_CHECK_FUNCS(getcwd getpwnam getwd re_comp strcspn strdup strspn strstr strtod strtol) 200AC_CHECK_DECLS([fileno]) 201 202dnl This does not work properly for C++: 203dnl AC_CHECK_FUNCS(isatty) 204 205AC_MSG_CHECKING(for isatty) 206AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 207#if defined(HAVE_STDIO_H) 208#include <stdio.h> 209#endif 210#if defined(HAVE_STDLIB_H) 211#include <stdlib.h> 212#endif 213#if defined(HAVE_UNISTD_H) 214#include <unistd.h> 215#endif 216 ]], [[(void)isatty(1)]])],[AC_MSG_RESULT(yes) 217 AC_DEFINE(HAVE_ISATTY)],[AC_MSG_RESULT(no)]) 218 219AC_MSG_CHECKING(for ioctl prototype) 220AC_EGREP_CPP([ioctl[ ]*[(]], 221[ 222#include <sys/ioctl.h> 223#include <unistd.h> 224], 225[ 226AC_DEFINE(HAVE_IOCTL_PROTOTYPE) 227AC_MSG_RESULT(yes) 228], 229[ 230AC_MSG_RESULT(no) 231]) 232 233dnl Remove -g from CFLAGS if we are compiling with lcc because it 234dnl produces bad debug symbol tables on Sun Solaris 2.x. 235if test "$CC" = "lcc" 236then 237 CFLAGS="`echo $CFLAGS | sed -e 's/-g //g' -e 's/ -g$//g' -e 's/^-g$//'`" 238fi 239 240AC_SUBST(VM) 241 242dnl Support for OpenBSD 5.9 and later pledge() call to guarantee 243dnl minimal privileges needed to run a program 244AC_CHECK_HEADERS(sys/pledge.h) 245 246test "x$ac_cv_exeext" = "x.exe" && VM='$(WINE)' 247 248AH_TEMPLATE(FREE_CAST_IS_CHAR_STAR,[Define if free() is of type char*.]) 249AH_TEMPLATE(HAVE_ALERT_CHAR,[Define if \a is recognized in C strings.]) 250AH_TEMPLATE(HAVE_IOCTL_PROTOTYPE,[Define if the compiler can see an ioctl() prototype.]) 251AH_TEMPLATE(HAVE_ISATTY,[Define if isatty() is available.]) 252AH_TEMPLATE(HAVE_STDC,[Define if Standard C and C++ function declarations are supported.]) 253AH_TEMPLATE(_ALL_SOURCE,[Define if needed to expose winsize in ioctl.h.]) 254AH_TEMPLATE(_POSIX_SOURCE,[Define if needed with stat.h.]) 255AH_BOTTOM([ 256#define SCREEN_LINES 24 257#include <custom.h>]) 258# Old autoconf style: AC_CONFIG_FILES([Makefile]) 259AC_OUTPUT 260# New autoconf style: 261AC_CONFIG_FILES(Makefile) 262AC_OUTPUT 263