cproto-4.7t/0000755000175100001440000000000014150246412011574 5ustar tomuserscproto-4.7t/trace.h0000644000175100001440000000104211510145371013037 0ustar tomusers/* $Id: trace.h,v 4.4 2011/01/02 18:59:05 tom Exp $ */ #ifndef TRACE_H #define TRACE_H #include extern void Where(char *f, int n); extern void Trace(char *f, ...) GCC_PRINTFLIKE(1,2); extern void show_alloc(void); extern void Elapsed(char *msg); extern void WalkBack(void); extern void fail_alloc(char *msg, char *ptr); #ifdef DOALLOC extern void *doalloc(void *,unsigned); extern void dofree(void *); #define malloc(n) doalloc(0,n) #define realloc(p,n) doalloc(p,n) #define free(n) dofree(n) #endif #endif /* TRACE_H */ cproto-4.7t/system.h0000644000175100001440000001037111510150272013266 0ustar tomusers/* $Id: system.h,v 4.13 2011/01/02 19:23:38 tom Exp $ * * cproto configuration and system dependencies */ #ifndef SYSTEM_H #define SYSTEM_H #include #include #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif /* Watcom C++ predefines __DOS__ when the target platform is MS-DOS */ /* Borland C++ for MS-DOS predefines __MSDOS__ */ #if defined(__DOS__) || defined(__MSDOS__) #ifndef MSDOS #define MSDOS #endif #endif /* Watcom C++ predefines __OS2__ when the target platform is OS/2 */ #ifdef __OS2__ #ifndef OS2 #define OS2 #endif #endif /* Watcom C++ predefines __NT__ when the target platform is Windows NT */ #ifdef __NT__ #ifndef WIN32 #define WIN32 #endif #endif /* Turbo C preprocessor */ #ifdef __TURBOC__ #define YY_READ_BUF_SIZE 256 /* patch */ #define HAVE_TMPFILE 1 #define HAVE_GETOPT_H 1 /* use the one from porting-directory */ #include /* declares 'read()' for flex */ #endif #ifdef TURBO_CPP #define CPP "cpp -P-" #endif /* EMX C preprocessor */ #ifdef __EMX__ #ifndef CPP #define CPP "cpp" #endif #endif /* Watcom C preprocessor */ #ifdef __WATCOMC__ #ifndef CPP #define CPP "wcl386 /p" #endif #define HAVE_POPEN_PROTOTYPE 1 #define popen _popen #define pclose _pclose #define HAVE_TMPFILE 1 #endif /* Microsoft C preprocessor */ #ifdef M_I86 #ifndef CPP #define CPP "cl /E /nologo" #endif #define HAVE_TMPFILE 1 #endif /* Vax C */ #ifdef vms #ifndef CPP #define CPP "cc /preprocess_only=%s" #endif #define unlink remove #define HAVE_TMPFILE 1 #define HAVE_GETOPT_H 1 #define USE_flex 1 #define CURRENT_DIR "[]" #endif /* Set configuration parameters for systems on which we cannot run autoconf. * (Assumes Posix unless overridden). */ #ifndef HAVE_GETOPT_H #define HAVE_GETOPT_H 0 #endif #ifndef HAVE_LIBDBMALLOC #define HAVE_LIBDBMALLOC 0 #endif #ifndef HAVE_LIBDMALLOC #define HAVE_LIBDMALLOC 0 #endif #ifndef HAVE_STDLIB_H #define HAVE_STDLIB_H 1 #endif #ifndef HAVE_STRING_H #define HAVE_STRING_H 1 #endif #ifndef HAVE_STRSTR #define HAVE_STRSTR 1 #endif #ifndef HAVE_UNISTD_H #define HAVE_UNISTD_H 0 #endif #ifndef STDC_HEADERS #define STDC_HEADERS 1 #endif /* Default C preprocessor on UNIX systems */ #ifndef MSDOS #ifndef CPP #define CPP "/lib/cpp" #endif #endif /* maximum include file nesting (for parsing externs) */ #ifndef MAX_INC_DEPTH #define MAX_INC_DEPTH 999999 #endif /* string denoting current-directory, for includes */ #ifndef CURRENT_DIR #define CURRENT_DIR "." #endif /* maximum text buffer size (for tokens) */ #ifndef MAX_TEXT_SIZE #define MAX_TEXT_SIZE 4096 #endif #if HAVE_STDLIB_H #include #else extern char *malloc (size_t n); extern char *realloc (char *p, size_t n); extern char *getenv (const char *v); #endif /* Declare argument for exit() function */ #ifdef vms #include #define EXIT_SUCCESS (STS$M_INHIB_MSG | STS$K_SUCCESS) #define EXIT_FAILURE (STS$M_INHIB_MSG | STS$K_ERROR) #else #ifndef EXIT_SUCCESS #define EXIT_SUCCESS (0) #endif #ifndef EXIT_FAILURE #define EXIT_FAILURE (1) #endif #endif /* vms */ #if HAVE_UNISTD_H #include #endif #if STDC_HEADERS || HAVE_STRING_H # include /* An ANSI string.h and pre-ANSI memory.h might conflict. */ # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif /* not STDC_HEADERS and HAVE_MEMORY_H */ #else /* not STDC_HEADERS and not HAVE_STRING_H */ # include # define strchr index # define strrchr rindex extern char *strstr (const char *s, const char *p); /* memory.h and strings.h conflict on some systems. */ #endif /* not STDC_HEADERS and not HAVE_STRING_H */ /* * The DOALLOC symbol controls whether we compile in the simple memory tests * in 'trace.c' (use dbmalloc for more rigorous testing). */ #ifdef DOALLOC #include #endif /* DOALLOC */ /* * Lint libraries are useful only on systems that are likely to have lint. * The OPT_LINTLIBRARY symbol controls whether we compile in the lint library * support. */ #ifndef OPT_LINTLIBRARY # define OPT_LINTLIBRARY 0 #endif #if BISON_HAS_YYTNAME || YACC_HAS_YYTOKS || YACC_HAS_YYTOKS_2 || YACC_HAS_YYNAME # define YYDEBUG 1 #endif #if HAVE_LIBDMALLOC #include /* Gray Watson's library */ #endif #if HAVE_LIBDBMALLOC #include /* Conor Cahill's library */ #endif #endif /* SYSTEM_H */ cproto-4.7t/Makefile.in0000644000175100001440000000702414150117465013651 0ustar tomusers# $Id: Makefile.in,v 4.37 2021/11/26 08:47:49 tom Exp $ # # UNIX template-makefile for C prototype generator THIS = cproto RELEASE = 4_7t #### Start of system configuration section. #### srcdir = @srcdir@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ LEX = @LEX@ YACC = @YACC@ LINT = @LINT@ CTAGS = @CTAGS@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ DEFINES = EXTRA_CFLAGS = @EXTRA_CFLAGS@ CPPFLAGS = -I. -I$(srcdir) $(DEFINES) -DHAVE_CONFIG_H @CPPFLAGS@ CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS) LIBS = @LIBS@ @LEXLIB@ prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ bindir = @bindir@ mandir = @mandir@ manext = 1 BINDIR = $(DESTDIR)$(bindir) MANDIR = $(DESTDIR)$(mandir)/man$(manext) x = @EXEEXT@ o = .@OBJEXT@ .SUFFIXES: .c $o .i TEST_REF = . #### End of system configuration section. #### SHELL = @THIS_SHELL@ @SET_MAKE@ PROG = $(THIS)$x LDFLAGS = @LDFLAGS@ DOC_FILES = \ README \ CHANGES \ $(THIS).1 MAK_FILES = \ Makefile.in \ configure.in \ aclocal.m4 \ config_h.in H_FILES = \ yyerror.c \ system.h \ $(THIS).h \ semantic.h \ symbol.h C_FILES = \ $(THIS).c \ lintlibs.c \ semantic.c \ strkey.c \ symbol.c AUX_FILES = \ lex.l \ grammar.y JUNK = \ lex.yy.c \ y.tab.c EXTRA_OBJS = @EXTRA_OBJS@ OBJECTS = $(THIS)$o lintlibs$o semantic$o strkey$o symbol$o y.tab$o \ $(EXTRA_OBJS) SOURCES = $(DOC_FILES) $(MAK_FILES) $(H_FILES) $(C_FILES) $(AUX_FILES) all : $(PROG) # $(THIS).man install: all installdirs $(INSTALL_PROGRAM) $(PROG) $(BINDIR)/$(PROG) - $(INSTALL_DATA) $(srcdir)/$(THIS).1 $(MANDIR)/$(THIS).$(manext) installdirs: mkdir -p $(BINDIR) - mkdir -p $(MANDIR) uninstall: - rm -f $(BINDIR)/$(PROG) $(MANDIR)/$(THIS).$(manext) .c$o: @RULE_CC@ @ECHO_CC@$(CC) -c $(CFLAGS) $(CPPFLAGS) $< .c.i: @RULE_CC@ @ECHO_CC@$(CPP) $(CPPFLAGS) $< >$*.i $(PROG) : $(OBJECTS) @ECHO_LD@$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS) y.tab.c : grammar.y $(YACC) $(srcdir)/grammar.y lex.yy.c : lex.l $(LEX) $(srcdir)/lex.l mostlyclean :: - rm -f core .nfs* *$o *.i *.bak *.BAK *.out $(JUNK) default.h clean :: mostlyclean - rm -f $(PROG) - cd $(srcdir)/testing && $(MAKE) $@ distclean :: clean - rm -f config.log config.cache config.status config.h Makefile man2html.tmp - rm -f .version .fname - cd $(srcdir)/testing && $(MAKE) $@ realclean :: distclean - rm -f tags - cd $(srcdir)/testing && $(MAKE) $@ check \ check_errors: $(PROG) cd $(srcdir)/testing && $(MAKE) $@ TEST_REF="$(TEST_REF)" SHELL="$(SHELL)" default.h: $(C_FILES) lex.yy.c ./$(PROG) -e -v -m -M ARGS -d $(DEFINES) $(C_FILES) grammar.y >$@ getopt.o : $(srcdir)/porting/getopt.c $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/porting/getopt.c popen.o : $(srcdir)/porting/popen.c $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/porting/popen.c lint: $(C_FILES) $(JUNK) $(LINT) $(CPPFLAGS) $(C_FILES) y.tab.c >$@.out llib: $(C_FILES) $(JUNK) ./$(PROG) -l $(CPPFLAGS) $(C_FILES) y.tab.c >$@.out self: $(C_FILES) $(JUNK) ./$(PROG) $(CPPFLAGS) $(C_FILES) y.tab.c >$@.out tags: $(H_FILES) $(C_FILES) $(AUX_FILES) $(CTAGS) $(C_FILES) $(AUX_FILES) $(H_FILES) depend: makedepend -- $(CPPFLAGS) -- $(C_FILES) y.tab.c # DO NOT DELETE THIS LINE -- make depend depends on it. cproto$o : cproto.h config.h system.h lintlibs$o : cproto.h config.h system.h semantic.h symbol.h semantic$o : cproto.h config.h system.h semantic.h strkey$o : cproto.h config.h system.h symbol$o : cproto.h config.h system.h symbol.h y.tab$o : cproto.h config.h system.h symbol.h semantic.h lex.yy.c yyerror.c cproto-4.7t/porting/0000755000175100001440000000000012232565721013264 5ustar tomuserscproto-4.7t/porting/getopt.h0000644000175100001440000000036112232565721014737 0ustar tomusers/* $Id: getopt.h,v 4.3 2013/10/25 22:08:17 tom Exp $ */ #ifndef OLD_GETOPT_H #define OLD_GETOPT_H 1 extern char *optarg; extern int optind, opterr; extern int getopt (int argc, char **argv, const char *options); #endif /* OLD_GETOPT_H */ cproto-4.7t/porting/popen.c0000644000175100001440000000312106455013720014543 0ustar tomusers/* $Id: popen.c,v 4.2 1998/01/08 00:03:28 cthuang Exp $ * * Imitate a UNIX pipe in MS-DOS. */ #ifdef MSDOS #include #include #include #include #include "cproto.h" static char pipe_name[FILENAME_MAX]; /* name of the temporary file */ /* Open a pipe for reading. */ FILE * popen (cmd, type) char *cmd, *type; { char *tmpdir, *argv[30], **arg, *cmdline, *s, opt[FILENAME_MAX]; int ostdout, status; /* Set temporary file name. */ if ((tmpdir = getenv("TMP")) == NULL) { pipe_name[0] = '\0'; } else { strcpy(pipe_name, tmpdir); trim_path_sep(pipe_name); strcat(pipe_name, "/"); } strcat(pipe_name, tmpnam(NULL)); /* Split the command into an argument array. */ cmdline = xstrdup(cmd); arg = argv; s = strtok(cmdline, " "); *arg++ = s; #ifdef TURBO_CPP sprintf(opt, "-o%s", pipe_name); *arg++ = opt; #endif while ((s = strtok(NULL, " ")) != NULL) { *arg++ = s; } *arg = NULL; /* Redirect the program's stdout. */ ostdout = dup(fileno(stdout)); #ifdef TURBO_CPP freopen("nul", "w", stdout); #else freopen(pipe_name, "w", stdout); #endif /* Run the program. */ status = spawnvp(P_WAIT, argv[0], argv); /* Restore stdout. */ dup2(ostdout, fileno(stdout)); free(cmdline); if (status != 0) return NULL; /* Open the intermediate file and return the stream. */ return fopen(pipe_name, type) ; } /* Close the pipe. */ int pclose (f) FILE *f; { int status; status = fclose(f); unlink(pipe_name); return status; } #endif /* MSDOS */ cproto-4.7t/porting/getopt.c0000644000175100001440000000473612232565710014742 0ustar tomusers/* $Id: getopt.c,v 4.2 2013/10/25 22:08:08 tom Exp $ */ /* ::[[ @(#) getopt.c 1.5 89/03/11 05:40:23 ]]:: */ /* #ifndef LINT static char sccsid[]="::[[ @(#) getopt.c 1.5 89/03/11 05:40:23 ]]::"; #endif */ /* * Here's something you've all been waiting for: the AT&T public domain * source for getopt(3). It is the code which was given out at the 1985 * UNIFORUM conference in Dallas. I obtained it by electronic mail * directly from AT&T. The people there assure me that it is indeed * in the public domain. * * There is no manual page. That is because the one they gave out at * UNIFORUM was slightly different from the current System V Release 2 * manual page. The difference apparently involved a note about the * famous rules 5 and 6, recommending using white space between an option * and its first argument, and not grouping options that have arguments. * Getopt itself is currently lenient about both of these things White * space is allowed, but not mandatory, and the last option in a group can * have an argument. That particular version of the man page evidently * has no official existence, and my source at AT&T did not send a copy. * The current SVR2 man page reflects the actual behavor of this getopt. * However, I am not about to post a copy of anything licensed by AT&T. */ #include #include #include #define ERR(szz,czz) if(opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);} int opterr = 1; int optind = 1; int optopt; char *optarg; int getopt(int argc, char **argv, const char *opts) { static int sp = 1; register int c; register char *cp; if(sp == 1) { if(optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') return(EOF); else if(strcmp(argv[optind], "--") == 0) { optind++; return(EOF); } } optopt = (c = argv[optind][sp]); if(c == ':' || (cp=strchr(opts, c)) == NULL) { ERR(": illegal option -- ", c); if(argv[optind][++sp] == '\0') { optind++; sp = 1; } return('?'); } if(*++cp == ':') { if(argv[optind][sp+1] != '\0') optarg = &argv[optind++][sp+1]; else if(++optind >= argc) { ERR(": option requires an argument -- ", c); sp = 1; return('?'); } else optarg = argv[optind++]; sp = 1; } else { if(argv[optind][++sp] == '\0') { sp = 1; optind++; } optarg = NULL; } return(c); } cproto-4.7t/porting/README0000644000175100001440000000061206461031364014141 0ustar tomusersThe files in this directory are needed to build on non-UNIX platforms. getopt.c This is a free implementation of the getopt function for getopt.h systems that don't already have it (such as MS-DOS and VMS). Some systems that support auto-configuration may need these files. You'll have to edit the makefile in that case. popen.c fakes a pipe open/close by writing to a temporary file. cproto-4.7t/MANIFEST0000644000175100001440000001440014150117465012731 0ustar tomusersMANIFEST for cproto-4.7t, version v4_7t -------------------------------------------------------------------------------- MANIFEST this file AUTHORS authors CHANGES summary of changes made to CPROTO Makefile.in top-level makefile template README overview of the CPROTO program aclocal.m4 autoconf macros config.guess configure utility script config.sub configure utility script config_h.in template for config.h configure configure script configure.in script for generating 'configure' via autoconf cproto.1 man-page for CPROTO cproto.c main program of CPROTO cproto.h common datatypes and definitions for CPROTO dump.c debug/trace dump.h interface of dump.c grammar.y yacc grammar for CPROTO install-sh install-script lex.l lex rules for CPROTO lintlibs.c functions used for lint-library formatting semantic.c functions to support yacc grammar (formatting and translation) semantic.h interface definitions of semantic.c strkey.c look for a keyword within a string symbol.c symbol-table support for CPROTO symbol.h interface definitions for symbol.c system.h system-dependent definitions, coordinated with config.h trace.c debugging support for CPROTO trace.h header for trace.c, dump.c yyerror.c enhanced error reporting support for yacc/bison emx subdirectory emx/Makefile makefile for gcc (EMX) emx/README description of files in emx directory msdos subdirectory msdos/README description of files in msdos directory msdos/borland.mak makefile for Borland C msdos/micrsoft.lnk linker-file for Microsoft C msdos/micrsoft.mak makefile for Microsoft C msdos/turboc.mak makefile for TurboC os2 subdirectory os2/README description of files in os2 directory os2/run_test.cmd run test-cases on OS/2 os2/watcom.mak makefile for watcom (OS/2) package subdirectory package/cproto.spec RPM build-script for cproto package/debian subdirectory package/debian/changelog debian build script package/debian/compat debian build script package/debian/control debian build script package/debian/copyright debian build script package/debian/docs debian build script package/debian/rules debian build script package/debian/source subdirectory package/debian/source/format debian build script package/debian subdirectory package/debian/watch debian build script porting subdirectory porting/README description of files in CPROTO/PORTING porting/getopt.c free version of getopt porting/getopt.h header file for getopt porting/popen.c fake popen/pclose testing subdirectory testing/README description of files in CPROTO/TESTING testing/apollo.c template for apollo lint-library testing/case01.ref test case reference: no options testing/case02.ref test case reference: -f0 testing/case03.ref test case reference: -c -f1 testing/case04.ref test case reference: -c -f2 testing/case05.ref test case reference: -c -f3 testing/case06.ref test case reference: -c -f3 -v testing/case07.ref test case reference: -c -f3 -v -e testing/case08.ref test case reference: -c -f3 -v -e -m testing/case09.ref test case reference: -c -f3 -v + template testing/case10.ref test case reference: -T testing/case11.ref test case reference: -l testing/case12.ref test case reference: -s testing/case13.ref test case reference: -l -s testing/case14.ref test case reference: -l -x testing/case15.ref test case reference: apollo lint library (sr10.3.5) testing/case16.ref test case reference: -a testing/case17.ref test case reference: -t testing/case18.ref test case reference: -f1 testing/case19.ref test case reference: -f2 testing/case20.ref test case reference: -f3 testing/case21.ref test case reference: -f3 -v + template testing/case22.ref test case reference: -l -a testing/case23.ref test case reference: -i testing/case24.ref test case reference: -i -s testing/descrip.mms VAX MMS-script for CPROTO/TESTING directory testing/linux.c include all linux files, for testing testing/make_bat.sh script for making dos-scripts testing/make_dcl.sh script to generate UNIX/VMS ".dcl" files testing/makefile UNIX makefile for CPROTO/TESTING directory testing/run_test.com VAX/VMS test script for CPROTO testing/run_test.sh UNIX test-script for CPROTO testing/run_test.txt template for test-scripts testing/solaris.c template for lint-library on Solaris testing/syntax.c odds & ends of syntax to use for testing testing/test_dos.bat dos test script testing/testunix.sh runs UNIX test scripts testing/turboc.c test-case for TurboC include-files vms subdirectory vms/README description of files in vms directory vms/descrip.mms makefile for vms win32 subdirectory win32/README description of files in win32 directory win32/watcom.mak makefile for watcom cproto-4.7t/configure.in0000644000175100001440000000343014150246043014105 0ustar tomusersdnl Process this file with 'autoconf' to produce a 'configure' script dnl $Id: configure.in,v 4.25 2021/11/26 21:05:39 tom Exp $ AC_REVISION($Revision: 4.25 $) AC_PREREQ(2.52.20200802) AC_INIT(cproto.c) AC_CONFIG_HEADER(config.h:config_h.in) CF_CHECK_CACHE THIS_SHELL=${CONFIG_SHELL-/bin/sh} AC_SUBST(THIS_SHELL) CF_PROG_CC AC_PROG_CPP CF_CPP_DOES_COMMENTS AC_PROG_LEX AC_PROG_MAKE_SET AC_PROG_YACC AC_PROG_INSTALL CF_MAKE_TAGS CF_PROG_LINT CF_NEED_PROG(LEX) CF_NEED_PROG(YACC) CF_XOPEN_SOURCE CF_WITHOUT_X CF_ENABLE_WARNINGS CF_DISABLE_ECHO AC_MSG_CHECKING(if you want to enable lint-library (llib) support) AC_ARG_ENABLE(llib, [ --enable-llib enable lint-library (llib) support], [cf_enable_llib=$enableval], [cf_enable_llib=yes]) AC_MSG_RESULT($cf_enable_llib); if test "$cf_enable_llib" = yes ; then AC_DEFINE(OPT_LINTLIBRARY) fi ### extra things that we'll substitute in the makefile AC_SUBST(EXTRA_OBJS) AC_CONST AC_STDC_HEADERS AC_HAVE_HEADERS(stdlib.h unistd.h) AC_HAVE_HEADERS(getopt.h string.h memory.h) AC_HAVE_FUNCS(getopt popen strstr tmpfile link unlink) if test "x$ac_cv_func_getopt" = xno then CPPFLAGS="$CPPFLAGS -I\$(srcdir)/porting" EXTRA_OBJS="$EXTRA_OBJS getopt.o" fi if test "x$ac_cv_func_popen" = xno then CPPFLAGS="$CPPFLAGS -I\$(srcdir)/porting" EXTRA_OBJS="$EXTRA_OBJS popen.o" fi ### special configuration tests CF_MKSTEMP CF_SIZE_T CF_YACC_ERROR CF_POPEN_TEST ### debugging/testing AC_ARG_WITH(trace, [ --with-trace use trace.c for memory-testing],[ AC_HEADER_TIME AC_HAVE_FUNCS(gettimeofday) AC_DEFINE(DOALLOC,10000) EXTRA_OBJS="$EXTRA_OBJS trace.o dump.o"]) CF_DISABLE_LEAKS CF_WITH_MAN2HTML echo setting other definitions AC_DEFINE_UNQUOTED(CPP,"$CPP") ### output makefile and config.h AC_OUTPUT(Makefile,,,cat) CF_MAKE_DOCS(cproto,1) cproto-4.7t/config.guess0000755000175100001440000014030414056322625014124 0ustar tomusers#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2021 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2021-06-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-unknown ;; *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case $UNAME_VERSION in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. GUESS=$machine-${os}${release}${abi-} ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE ;; *:SecBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE ;; *:MidnightBSD:*:*) GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE ;; *:ekkoBSD:*:*) GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE ;; *:SolidBSD:*:*) GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE ;; *:OS108:*:*) GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE ;; macppc:MirBSD:*:*) GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE ;; *:MirBSD:*:*) GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE ;; *:Sortix:*:*) GUESS=$UNAME_MACHINE-unknown-sortix ;; *:Twizzler:*:*) GUESS=$UNAME_MACHINE-unknown-twizzler ;; *:Redox:*:*) GUESS=$UNAME_MACHINE-unknown-redox ;; mips:OSF1:*.*) GUESS=mips-dec-osf1 ;; alpha:OSF1:*:*) # Reset EXIT trap before exiting to avoid spurious non-zero exit code. trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` GUESS=$UNAME_MACHINE-dec-osf$OSF_REL ;; Amiga*:UNIX_System_V:4.0:*) GUESS=m68k-unknown-sysv4 ;; *:[Aa]miga[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-amigaos ;; *:[Mm]orph[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-morphos ;; *:OS/390:*:*) GUESS=i370-ibm-openedition ;; *:z/VM:*:*) GUESS=s390-ibm-zvmoe ;; *:OS400:*:*) GUESS=powerpc-ibm-os400 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) GUESS=arm-acorn-riscix$UNAME_RELEASE ;; arm*:riscos:*:*|arm*:RISCOS:*:*) GUESS=arm-unknown-riscos ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) GUESS=hppa1.1-hitachi-hiuxmpp ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. case `(/bin/universe) 2>/dev/null` in att) GUESS=pyramid-pyramid-sysv3 ;; *) GUESS=pyramid-pyramid-bsd ;; esac ;; NILE*:*:*:dcosx) GUESS=pyramid-pyramid-svr4 ;; DRS?6000:unix:4.0:6*) GUESS=sparc-icl-nx6 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) GUESS=sparc-icl-nx7 ;; esac ;; s390x:SunOS:*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL ;; sun4H:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-hal-solaris2$SUN_REL ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris2$SUN_REL ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) GUESS=i386-pc-auroraux$UNAME_RELEASE ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$SUN_ARCH-pc-solaris2$SUN_REL ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris3$SUN_REL ;; sun4*:SunOS:*:*) case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; sun3*:SunOS:*:*) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case `/bin/arch` in sun3) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac ;; aushp:SunOS:*:*) GUESS=sparc-auspex-sunos$UNAME_RELEASE ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) GUESS=m68k-milan-mint$UNAME_RELEASE ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) GUESS=m68k-hades-mint$UNAME_RELEASE ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) GUESS=m68k-unknown-mint$UNAME_RELEASE ;; m68k:machten:*:*) GUESS=m68k-apple-machten$UNAME_RELEASE ;; powerpc:machten:*:*) GUESS=powerpc-apple-machten$UNAME_RELEASE ;; RISC*:Mach:*:*) GUESS=mips-dec-mach_bsd4.3 ;; RISC*:ULTRIX:*:*) GUESS=mips-dec-ultrix$UNAME_RELEASE ;; VAX*:ULTRIX*:*:*) GUESS=vax-dec-ultrix$UNAME_RELEASE ;; 2020:CLIX:*:* | 2430:CLIX:*:*) GUESS=clipper-intergraph-clix$UNAME_RELEASE ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } GUESS=mips-mips-riscos$UNAME_RELEASE ;; Motorola:PowerMAX_OS:*:*) GUESS=powerpc-motorola-powermax ;; Motorola:*:4.3:PL8-*) GUESS=powerpc-harris-powermax ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) GUESS=powerpc-harris-powermax ;; Night_Hawk:Power_UNIX:*:*) GUESS=powerpc-harris-powerunix ;; m88k:CX/UX:7*:*) GUESS=m88k-harris-cxux7 ;; m88k:*:4*:R4*) GUESS=m88k-motorola-sysv4 ;; m88k:*:3*:R3*) GUESS=m88k-motorola-sysv3 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then GUESS=m88k-dg-dgux$UNAME_RELEASE else GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else GUESS=i586-dg-dgux$UNAME_RELEASE fi ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) GUESS=m88k-dolphin-sysv3 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 GUESS=m88k-motorola-sysv3 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) GUESS=m88k-tektronix-sysv3 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) GUESS=m68k-tektronix-bsd ;; *:IRIX*:*:*) IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` GUESS=mips-sgi-irix$IRIX_REL ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) GUESS=i386-ibm-aix ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then GUESS=$SYSTEM_NAME else GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then GUESS=rs6000-ibm-aix3.2.4 else GUESS=rs6000-ibm-aix3.2 fi ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$IBM_ARCH-ibm-aix$IBM_REV ;; *:AIX:*:*) GUESS=rs6000-ibm-aix ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) GUESS=romp-ibm-bsd4.4 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) GUESS=rs6000-bull-bosx ;; DPX/2?00:B.O.S.:*:*) GUESS=m68k-bull-sysv3 ;; 9000/[34]??:4.3bsd:1.*:*) GUESS=m68k-hp-bsd ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) GUESS=m68k-hp-bsd4.4 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi GUESS=$HP_ARCH-hp-hpux$HPUX_REV ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` GUESS=ia64-hp-hpux$HPUX_REV ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } GUESS=unknown-hitachi-hiuxwe2 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) GUESS=hppa1.1-hp-bsd ;; 9000/8??:4.3bsd:*:*) GUESS=hppa1.0-hp-bsd ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) GUESS=hppa1.0-hp-mpeix ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) GUESS=hppa1.1-hp-osf ;; hp8??:OSF1:*:*) GUESS=hppa1.0-hp-osf ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then GUESS=$UNAME_MACHINE-unknown-osf1mk else GUESS=$UNAME_MACHINE-unknown-osf1 fi ;; parisc*:Lites*:*:*) GUESS=hppa1.1-hp-lites ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) GUESS=c1-convex-bsd ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) GUESS=c34-convex-bsd ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) GUESS=c38-convex-bsd ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) GUESS=c4-convex-bsd ;; CRAY*Y-MP:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=ymp-cray-unicos$CRAY_REL ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=t90-cray-unicos$CRAY_REL ;; CRAY*T3E:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=alphaev5-cray-unicosmk$CRAY_REL ;; CRAY*SV1:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=sv1-cray-unicos$CRAY_REL ;; *:UNICOS/mp:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=craynv-cray-unicosmp$CRAY_REL ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE ;; sparc*:BSD/OS:*:*) GUESS=sparc-unknown-bsdi$UNAME_RELEASE ;; *:BSD/OS:*:*) GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m68*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; openrisc*:Linux:*:*) GUESS=or1k-unknown-linux-$LIBC ;; or32:Linux:*:* | or1k*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; padre:Linux:*:*) GUESS=sparc-unknown-linux-$LIBC ;; parisc64:Linux:*:* | hppa64:Linux:*:*) GUESS=hppa64-unknown-linux-$LIBC ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; *) GUESS=hppa-unknown-linux-$LIBC ;; esac ;; ppc64:Linux:*:*) GUESS=powerpc64-unknown-linux-$LIBC ;; ppc:Linux:*:*) GUESS=powerpc-unknown-linux-$LIBC ;; ppc64le:Linux:*:*) GUESS=powerpc64le-unknown-linux-$LIBC ;; ppcle:Linux:*:*) GUESS=powerpcle-unknown-linux-$LIBC ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; s390:Linux:*:* | s390x:Linux:*:*) GUESS=$UNAME_MACHINE-ibm-linux-$LIBC ;; sh64*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sh*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sparc:Linux:*:* | sparc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; tile*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; vax:Linux:*:*) GUESS=$UNAME_MACHINE-dec-linux-$LIBC ;; x86_64:Linux:*:*) set_cc_for_build LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then LIBCABI=${LIBC}x32 fi fi GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. GUESS=i386-sequent-sysv4 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; i*86:XTS-300:*:STOP) GUESS=$UNAME_MACHINE-unknown-stop ;; i*86:atheos:*:*) GUESS=$UNAME_MACHINE-unknown-atheos ;; i*86:syllable:*:*) GUESS=$UNAME_MACHINE-pc-syllable ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) GUESS=i386-unknown-lynxos$UNAME_RELEASE ;; i*86:*DOS:*:*) GUESS=$UNAME_MACHINE-pc-msdosdjgpp ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv32 fi ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. GUESS=i586-pc-msdosdjgpp ;; Intel:Mach:3*:*) GUESS=i386-pc-mach3 ;; paragon:*:*:*) GUESS=i860-intel-osf1 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi ;; mini*:CTIX:SYS*5:*) # "miniframe" GUESS=m68010-convergent-sysv ;; mc68k:UNIX:SYSTEM5:3.51m) GUESS=m68k-convergent-sysv ;; M680?0:D-NIX:5.3:*) GUESS=m68k-diab-dnix ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) GUESS=m68k-unknown-lynxos$UNAME_RELEASE ;; mc68030:UNIX_System_V:4.*:*) GUESS=m68k-atari-sysv4 ;; TSUNAMI:LynxOS:2.*:*) GUESS=sparc-unknown-lynxos$UNAME_RELEASE ;; rs6000:LynxOS:2.*:*) GUESS=rs6000-unknown-lynxos$UNAME_RELEASE ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) GUESS=powerpc-unknown-lynxos$UNAME_RELEASE ;; SM[BE]S:UNIX_SV:*:*) GUESS=mips-dde-sysv$UNAME_RELEASE ;; RM*:ReliantUNIX-*:*:*) GUESS=mips-sni-sysv4 ;; RM*:SINIX-*:*:*) GUESS=mips-sni-sysv4 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` GUESS=$UNAME_MACHINE-sni-sysv4 else GUESS=ns32k-sni-sysv fi ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm GUESS=hppa1.1-stratus-sysv4 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. GUESS=i860-stratus-sysv4 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. GUESS=$UNAME_MACHINE-stratus-vos ;; *:VOS:*:*) # From Paul.Green@stratus.com. GUESS=hppa1.1-stratus-vos ;; mc68*:A/UX:*:*) GUESS=m68k-apple-aux$UNAME_RELEASE ;; news*:NEWS-OS:6*:*) GUESS=mips-sony-newsos6 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then GUESS=mips-nec-sysv$UNAME_RELEASE else GUESS=mips-unknown-sysv$UNAME_RELEASE fi ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. GUESS=powerpc-be-beos ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. GUESS=powerpc-apple-beos ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. GUESS=i586-pc-beos ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; x86_64:Haiku:*:*) GUESS=x86_64-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE ;; SX-5:SUPER-UX:*:*) GUESS=sx5-nec-superux$UNAME_RELEASE ;; SX-6:SUPER-UX:*:*) GUESS=sx6-nec-superux$UNAME_RELEASE ;; SX-7:SUPER-UX:*:*) GUESS=sx7-nec-superux$UNAME_RELEASE ;; SX-8:SUPER-UX:*:*) GUESS=sx8-nec-superux$UNAME_RELEASE ;; SX-8R:SUPER-UX:*:*) GUESS=sx8r-nec-superux$UNAME_RELEASE ;; SX-ACE:SUPER-UX:*:*) GUESS=sxace-nec-superux$UNAME_RELEASE ;; Power*:Rhapsody:*:*) GUESS=powerpc-apple-rhapsody$UNAME_RELEASE ;; *:Rhapsody:*:*) GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE ;; arm64:Darwin:*:*) GUESS=aarch64-apple-darwin$UNAME_RELEASE ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE ;; *:QNX:*:4*) GUESS=i386-pc-qnx ;; NEO-*:NONSTOP_KERNEL:*:*) GUESS=neo-tandem-nsk$UNAME_RELEASE ;; NSE-*:NONSTOP_KERNEL:*:*) GUESS=nse-tandem-nsk$UNAME_RELEASE ;; NSR-*:NONSTOP_KERNEL:*:*) GUESS=nsr-tandem-nsk$UNAME_RELEASE ;; NSV-*:NONSTOP_KERNEL:*:*) GUESS=nsv-tandem-nsk$UNAME_RELEASE ;; NSX-*:NONSTOP_KERNEL:*:*) GUESS=nsx-tandem-nsk$UNAME_RELEASE ;; *:NonStop-UX:*:*) GUESS=mips-compaq-nonstopux ;; BS2000:POSIX*:*:*) GUESS=bs2000-siemens-sysv ;; DS/*:UNIX_System_V:*:*) GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "${cputype-}" = 386; then UNAME_MACHINE=i386 elif test "x${cputype-}" != x; then UNAME_MACHINE=$cputype fi GUESS=$UNAME_MACHINE-unknown-plan9 ;; *:TOPS-10:*:*) GUESS=pdp10-unknown-tops10 ;; *:TENEX:*:*) GUESS=pdp10-unknown-tenex ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) GUESS=pdp10-dec-tops20 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) GUESS=pdp10-xkl-tops20 ;; *:TOPS-20:*:*) GUESS=pdp10-unknown-tops20 ;; *:ITS:*:*) GUESS=pdp10-unknown-its ;; SEI:*:*:SEIUX) GUESS=mips-sei-seiux$UNAME_RELEASE ;; *:DragonFly:*:*) DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case $UNAME_MACHINE in A*) GUESS=alpha-dec-vms ;; I*) GUESS=ia64-dec-vms ;; V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) GUESS=i386-pc-xenix ;; i*86:skyos:*:*) SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL ;; i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; x86_64:VMkernel:*:*) GUESS=$UNAME_MACHINE-unknown-esx ;; amd64:Isilon\ OneFS:*:*) GUESS=x86_64-unknown-onefs ;; *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; esac # Do we have a guess based on uname results? if test "x$GUESS" != x; then echo "$GUESS" exit fi # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cproto-4.7t/yyerror.c0000644000175100001440000001133513301364304013454 0ustar tomusers/* $Id: yyerror.c,v 4.10 2018/05/23 22:18:44 tom Exp $ * * This file is included into grammar.y to provide the 'yyerror()' function. * If the yacc/bison parser is one that we know how to backtrack, we'll augment * the "syntax error" message with information that shows what type of token we * expected. */ #ifndef UCH #define UCH(c) ((unsigned char)(c)) #endif /* 'yyerror()' has to be a macro, since it must be expanded inline to subvert * the internal state of 'yyparse()'. */ #if BISON_HAS_YYTNAME /* bison 1.22 */ #if !defined(YYFLAG) #define YYFLAG YYPACT_NINF /* yabb (yet-another-bison-bug) */ #endif #if YYDEBUG /* this is better than defining YYERROR_VERBOSE */ #define yyerror(text) {\ register int n, c1, count = 0;\ yaccError(text);\ if (yypact[yystate] != YYFLAG) { \ for (c1 = 0; c1 < YYLAST; c1++) {\ n = yypact[yystate] + c1;\ if (n >= 0 && n < YYLAST\ && yycheck[n] == c1 && yytname[c1] != 0)\ yaccExpected(yytname[c1], count++);\ }\ }\ yaccExpected("", -1);\ } #endif #endif /* BISON_HAS_YYTNAME */ #if YACC_HAS_YYTOKS_2 #undef YACC_HAS_YYTOKS #define YACC_HAS_YYTOKS 1 #define YaccState yy_state #endif #if YACC_HAS_YYTOKS /* Solaris, Gould */ #if YYDEBUG #ifndef YaccState #define YaccState yystate /* sometimes 'yy_state' */ #endif #define yyerror(text) {\ register int n, x, c1, y, count = 0;\ yaccError(text);\ if (((n = yypact[YaccState]) > YYFLAG) && (n < YYLAST)) {\ for (x = ((n > 0) ? n : 0); x < YYLAST; ++x) {\ c1 = x - n;\ if ((yychk[yyact[x]] == c1) && (c1 != YYERRCODE)) {\ if ((c1 >= 32) && (c1 < 127)) {\ static char tmp[] = "'%'";\ tmp[1] = c1;\ yaccExpected(tmp, count++);\ } else {\ for (y = 0; yytoks[y].t_val >= 0; y++) {\ if (yytoks[y].t_val == c1) {\ yaccExpected(yytoks[y].t_name, count++);\ break;\ }\ }\ }\ }\ }\ }\ yaccExpected("", -1);\ } #endif #endif /* YACC_HAS_YYTOKS */ #if YACC_HAS_YYNAME /* Linux's yacc */ #if YYDEBUG #define yyerror(text) {\ register int n, x, c1, count = 0;\ yaccError(text);\ if (((n = yysindex[yystate]) != 0) && (n < YYTABLESIZE)) {\ for (x = ((n > 0) ? n : 0); x < YYTABLESIZE; ++x) {\ c1 = x - n;\ if ((yycheck[x] == c1) && (c1 != YYERRCODE)) {\ yaccExpected(yyname[c1] ? yyname[c1] : "illegal symbol",\ count++);\ }\ }\ }\ yaccExpected("", -1);\ } #endif #endif /* YACC_HAS_YYNAME */ /* * Any way we define it, 'yyerror()' is a real function (that we provide, * rather than use the one from a library). */ static void yaccError(const char *); #ifdef yyerror static int compar(const void *p1, const void *p2) { const char *a = *(const char *const *) p1; const char *b = *(const char *const *) p2; return strcmp(a, b); } #define MSGLEN 80 static void yaccExpected(const char *s, int count) { static struct { const char *actual, *name; } tbl[] = { { "...", "T_ELLIPSIS" }, { "[]", "T_BRACKETS" }, { "{", "T_LBRACE" }, { "}", "T_MATCHRBRACE" }, }; unsigned j; int k, x; unsigned n; const char *t = s; char *tt; const char *tag; char tmp[MSGLEN]; static unsigned have; static unsigned used; static char **vec; if (count < 0) { if (used != 0) { if (used > 1) qsort((char *) vec, used, sizeof(vec[0]), compar); /* limit length of error message */ k = MSGLEN - (int) (strlen(vec[used - 1]) + 2); for (j = 0; j < used; j++) { tag = j ? " " : "Expected: "; s = vec[j]; if (j != (used - 1)) { x = (int) (strlen(s) + strlen(tag)); if (k <= 0) continue; else if ((k - x) <= 0) s = "..."; k -= x; } fprintf(stderr, "%s%s", tag, s); } fprintf(stderr, "\n"); while (used-- != 0) { free(vec[used]); vec[used] = 0; } } used = 0; } else { int found = FALSE; strcpy(tmp, t); if (!strncmp(t, "T_", 2)) { for (j = 0; j < sizeof(tbl) / sizeof(tbl[0]); j++) { if (!strcmp(t, tbl[j].name)) { t = tbl[j].actual; found = TRUE; break; } } if (!found) { tt = strncpy(tmp, t + 2, sizeof(tmp) - 1); for (k = 0; tt[k] != '\0'; k++) { if (tt[k] == '_') tt[k] = '-'; else if (isalpha(UCH(tt[k])) && isupper(UCH(tt[k]))) tt[k] = (char) tolower(UCH(tt[k])); } } } if ((unsigned) count >= have) { have = (unsigned) (count + 10); if (vec == 0) { vec = (char **) malloc(have * sizeof(*vec)); } else { vec = (char **) realloc(vec, have * sizeof(*vec)); } for (n = used; n < have; n++) vec[n] = 0; } if (vec[count] != 0) { free(vec[count]); } vec[count] = xstrdup(found ? t : tmp); used = (unsigned) (count + 1); } } #else #define yyerror(s) yaccError(s) #endif /* yyerror */ cproto-4.7t/configure0000755000175100001440000071464214150246412013521 0ustar tomusers#! /bin/sh # From configure.in Revision: 4.25 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20210509. # # Copyright 2003-2020,2021 Thomas E. Dickey # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset="unset" else as_unset="false" fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : "${ac_max_here_lines=38}" ac_unique_file="cproto.c" # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${datarootdir}/info' mandir='${datarootdir}/man' # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo "$ac_feature" | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo "$ac_feature" | sed 's/-/_/g'` case "$ac_option" in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst \ | --runs | --run | --ru) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* \ | --runs=* | --run=* | --ru=*) runstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo "$ac_package" | sed 's/-/_/g'` case "$ac_option" in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo "$ac_package" | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export "$ac_envvar" ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option}" "${host_alias=$ac_option}" "${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo "$ac_prev" | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo "$ac_var"` case "$ac_val" in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo "$ac_var"` case "$ac_val" in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. build=$build_alias host=$host_alias target=$target_alias # FIXME: should be removed in autoconf 3.0. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat < if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. EOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue cd "$ac_subdir" # A "../" for each directory in /$ac_subdir. ac_dots=`echo "$ac_subdir" | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` case "$srcdir" in .) # No --srcdir option. We are building in place. ac_sub_srcdir="$srcdir" ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_sub_srcdir="$srcdir/$ac_subdir" ;; *) # Relative path. ac_sub_srcdir="$ac_dots$srcdir/$ac_subdir" ;; esac # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_sub_srcdir/configure.gnu"; then echo $SHELL "$ac_sub_srcdir/configure.gnu" --help=recursive elif test -f "$ac_sub_srcdir/configure"; then echo $SHELL "$ac_sub_srcdir/configure" --help=recursive elif test -f "$ac_sub_srcdir/configure.ac" || test -f "$ac_sub_srcdir/configure.in"; then echo "$ac_configure" --help else echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if "$ac_init_version"; then cat <<\EOF Copyright 2003-2020,2021 Thomas E. Dickey Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. EOF exit 0 fi exec 5>config.log cat >&5 </dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` PATH = $PATH _ASUNAME } >&5 cat >&5 <\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ac_sep=" " ;; *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" ac_sep=" " ;; esac # Get rid of the leading space. done # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. trap 'exit_status=$? # Save into config.log some information that might help in debugging. echo >&5 echo "## ----------------- ##" >&5 echo "## Cache variables. ##" >&5 echo "## ----------------- ##" >&5 echo >&5 # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } >&5 sed "/^$/d" confdefs.h >conftest.log if test -s conftest.log; then echo >&5 echo "## ------------ ##" >&5 echo "## confdefs.h. ##" >&5 echo "## ------------ ##" >&5 echo >&5 cat conftest.log >&5 fi (echo; echo) >&5 test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" >&5 echo "$as_me: exit $exit_status" >&5 rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' "$ac_signal" done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:866: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:877: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:885: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case "$ac_old_set,$ac_new_set" in set,) { echo "$as_me:901: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:905: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:911: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:913: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:915: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. It doesn't matter if # we pass some twice (in addition to the command line arguments). if test "$ac_new_set" = set; then case "$ac_new_val" in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" ;; esac fi done if "$ac_cache_corrupted"; then { echo "$as_me:934: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:936: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&5' ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return="return" case `echo "testing\c" 2>/dev/null; echo 1,2,3`,`echo -n testing 2>/dev/null; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C= # newlines do not sed ;-) only broken shells would use this case anyway ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh if { (echo "$as_me:965: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? echo "$as_me:968: \$? = $ac_status" >&5 (exit "$ac_status"); }; then ac_path_separator=';' else ac_path_separator=: fi PATH_SEPARATOR="$ac_path_separator" rm -f conftest.sh ac_config_headers="$ac_config_headers config.h:config_h.in" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:996: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:1006: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:1010: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:1019: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub "$ac_cv_build_alias"` || { { echo "$as_me:1023: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1028: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo "$ac_cv_build" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo "$ac_cv_build" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo "$ac_cv_build" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` if test -f "$srcdir/config.guess" || test -f "$ac_aux_dir/config.guess" ; then echo "$as_me:1036: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub "$ac_cv_host_alias"` || { { echo "$as_me:1045: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1050: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo "$ac_cv_host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$ac_cv_host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$ac_cv_host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && cat >>confdefs.h <&6 else cf_cv_system_name="$system_name" fi test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && echo "$as_me:1076: result: Configuring for $cf_cv_system_name" >&5 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 if test ".$system_name" != ".$cf_cv_system_name" ; then echo "$as_me:1080: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 { { echo "$as_me:1082: error: \"Please remove config.cache and try again.\"" >&5 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} { (exit 1); exit 1; }; } fi THIS_SHELL=${CONFIG_SHELL-/bin/sh} ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&5' ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return="return" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:1098: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:1113: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1121: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1124: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:1133: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:1148: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1156: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1159: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:1172: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:1187: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1195: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1198: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1207: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" echo "$as_me:1222: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1230: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1233: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1246: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:1266: found $ac_dir/$ac_word" >&5 break done if test "$ac_prog_rejected" = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1288: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1291: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:1302: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:1317: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1325: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1328: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:1341: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:1356: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1364: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1367: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:1379: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:1384:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo "$2"` { (eval echo "$as_me:1387: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:1390: \$? = $ac_status" >&5 (exit "$ac_status"); } { (eval echo "$as_me:1392: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:1395: \$? = $ac_status" >&5 (exit "$ac_status"); } { (eval echo "$as_me:1397: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:1400: \$? = $ac_status" >&5 (exit "$ac_status"); } cat >"conftest.$ac_ext" <<_ACEOF #line 1404 "configure" #include "confdefs.h" int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:1420: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *"conftest[^"]*"//'` if { (eval echo "$as_me:1423: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:1426: \$? = $ac_status" >&5 (exit "$ac_status"); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. for ac_file in `ls a.exe conftest.exe 2>/dev/null; ls a.out conftest 2>/dev/null; ls a.* conftest.* 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 { { echo "$as_me:1449: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:1455: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1460: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:1466: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1469: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:1476: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:1484: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe "conftest$ac_cv_exeext" ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1491: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:1493: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:1496: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 if { (eval echo "$as_me:1498: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1501: \$? = $ac_status" >&5 (exit "$ac_status"); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:1517: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f "conftest$ac_cv_exeext" echo "$as_me:1523: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f "conftest.$ac_ext" EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:1529: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 1535 "configure" #include "confdefs.h" int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:1547: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1550: \$? = $ac_status" >&5 (exit "$ac_status"); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 { { echo "$as_me:1562: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f "conftest.$ac_cv_objext" "conftest.$ac_ext" fi echo "$as_me:1569: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:1573: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 1579 "configure" #include "confdefs.h" int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1594: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1597: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1600: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1603: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_compiler_gnu=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:1615: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:1621: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 1627 "configure" #include "confdefs.h" int main (void) { ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1639: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1642: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1645: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1648: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_prog_cc_g=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:1658: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >"conftest.$ac_ext" <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1685: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1688: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1691: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1694: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >"conftest.$ac_ext" <<_ACEOF #line 1706 "configure" #include "confdefs.h" #include $ac_declaration int main (void) { exit (42); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1719: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1722: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1725: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1728: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 continue fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" cat >"conftest.$ac_ext" <<_ACEOF #line 1738 "configure" #include "confdefs.h" $ac_declaration int main (void) { exit (42); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1750: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1753: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1756: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1759: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then break else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" done rm -rf conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo "$ac_declaration" >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&5' ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return="return" GCC_VERSION=none if test "$GCC" = yes ; then echo "$as_me:1789: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown echo "$as_me:1793: result: $GCC_VERSION" >&5 echo "${ECHO_T}$GCC_VERSION" >&6 fi INTEL_COMPILER=no if test "$GCC" = yes ; then case "$host_os" in (linux*|gnu*) echo "$as_me:1802: checking if this is really Intel C compiler" >&5 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -no-gcc" cat >"conftest.$ac_ext" <<_ACEOF #line 1807 "configure" #include "confdefs.h" int main (void) { #ifdef __INTEL_COMPILER #else make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1824: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1827: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1830: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1833: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CFLAGS="$cf_save_CFLAGS" echo "$as_me:1844: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac fi CLANG_COMPILER=no if test "$GCC" = yes ; then echo "$as_me:1853: checking if this is really Clang C compiler" >&5 echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" cat >"conftest.$ac_ext" <<_ACEOF #line 1857 "configure" #include "confdefs.h" int main (void) { #ifdef __clang__ #else make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1874: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1877: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1880: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1883: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then CLANG_COMPILER=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CFLAGS="$cf_save_CFLAGS" echo "$as_me:1893: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi CLANG_VERSION=none if test "x$CLANG_COMPILER" = "xyes" ; then case "$CC" in (c[1-9][0-9]|*/c[1-9][0-9]) { echo "$as_me:1902: WARNING: replacing broken compiler alias $CC" >&5 echo "$as_me: WARNING: replacing broken compiler alias $CC" >&2;} CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" CC=clang ;; esac echo "$as_me:1909: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 CLANG_VERSION="`$CC --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(CLANG[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$CLANG_VERSION" && CLANG_VERSION=unknown echo "$as_me:1913: result: $CLANG_VERSION" >&5 echo "${ECHO_T}$CLANG_VERSION" >&6 for cf_clang_opt in \ -Qunused-arguments \ -Wno-error=implicit-function-declaration do echo "$as_me:1920: checking if option $cf_clang_opt works" >&5 echo $ECHO_N "checking if option $cf_clang_opt works... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cf_clang_opt" cat >"conftest.$ac_ext" <<_ACEOF #line 1925 "configure" #include "confdefs.h" #include int main (void) { printf("hello!\\n"); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:1939: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1942: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:1945: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1948: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_clang_optok=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_clang_optok=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" echo "$as_me:1959: result: $cf_clang_optok" >&5 echo "${ECHO_T}$cf_clang_optok" >&6 CFLAGS="$cf_save_CFLAGS" if test "$cf_clang_optok" = yes; then test -n "$verbose" && echo " adding option $cf_clang_opt" 1>&6 echo "${as_me:-configure}:1965: testing adding option $cf_clang_opt ..." 1>&5 test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_clang_opt" fi done fi echo "$as_me:1974: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >"conftest.$ac_ext" <<_ACEOF #line 1982 "configure" #include "confdefs.h" #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main (void) { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f "conftest.$ac_objext" if { (eval echo "$as_me:2031: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2034: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2037: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2040: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" done rm -f "conftest.$ac_ext" "conftest.$ac_objext" CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:2057: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:2060: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # This should have been defined by AC_PROG_CC : "${CC:=cc}" echo "$as_me:2068: checking \$CFLAGS variable" >&5 echo $ECHO_N "checking \$CFLAGS variable... $ECHO_C" >&6 case "x$CFLAGS" in (*-[IUD]*) echo "$as_me:2072: result: broken" >&5 echo "${ECHO_T}broken" >&6 { echo "$as_me:2074: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&5 echo "$as_me: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&2;} cf_flags="$CFLAGS" CFLAGS= for cf_arg in $cf_flags do cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_arg do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done ;; (*) echo "$as_me:2182: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac echo "$as_me:2187: checking \$CC variable" >&5 echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 case "$CC" in (*[\ \ ]-*) echo "$as_me:2191: result: broken" >&5 echo "${ECHO_T}broken" >&6 { echo "$as_me:2193: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 echo "$as_me: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} # humor him... cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[ ]* / /g' -e 's/[ ]*[ ]-[^ ].*//'` cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", substr($0,1+length(prog))); }'` CC="$cf_prog" for cf_arg in $cf_flags do case "x$cf_arg" in (x-[IUDfgOW]*) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_arg do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi ;; (*) CC="$CC $cf_arg" ;; esac done test -n "$verbose" && echo " resulting CC: '$CC'" 1>&6 echo "${as_me:-configure}:2310: testing resulting CC: '$CC' ..." 1>&5 test -n "$verbose" && echo " resulting CFLAGS: '$CFLAGS'" 1>&6 echo "${as_me:-configure}:2314: testing resulting CFLAGS: '$CFLAGS' ..." 1>&5 test -n "$verbose" && echo " resulting CPPFLAGS: '$CPPFLAGS'" 1>&6 echo "${as_me:-configure}:2318: testing resulting CPPFLAGS: '$CPPFLAGS' ..." 1>&5 ;; (*) echo "$as_me:2322: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac for ac_prog in ggrep grep do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:2331: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GREP"; then ac_cv_prog_GREP="$GREP" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_GREP="$ac_prog" echo "$as_me:2346: found $ac_dir/$ac_word" >&5 break done fi fi GREP=$ac_cv_prog_GREP if test -n "$GREP"; then echo "$as_me:2354: result: $GREP" >&5 echo "${ECHO_T}$GREP" >&6 else echo "$as_me:2357: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$GREP" && break done test -n "$GREP" || GREP=": " echo "$as_me:2365: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else for ac_prog in gegrep egrep do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:2377: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_EGREP="$EGREP" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_EGREP="$ac_dir/$ac_word" echo "$as_me:2394: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi EGREP=$ac_cv_path_EGREP if test -n "$EGREP"; then echo "$as_me:2405: result: $EGREP" >&5 echo "${ECHO_T}$EGREP" >&6 else echo "$as_me:2408: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$EGREP" && break done test -n "$EGREP" || EGREP=": " test "x$ac_cv_path_EGREP" = "x:" && { { echo "$as_me:2416: error: cannot find workable egrep" >&5 echo "$as_me: error: cannot find workable egrep" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:2421: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6 EGREP="$ac_cv_path_EGREP" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&5' ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return="return" echo "$as_me:2431: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >"conftest.$ac_ext" <<_ACEOF #line 2452 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:2457: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2463: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 # Broken: fails on valid input. continue fi rm -f conftest.err "conftest.$ac_ext" # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >"conftest.$ac_ext" <<_ACEOF #line 2486 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:2490: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2496: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err "conftest.$ac_ext" done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err "conftest.$ac_ext" if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:2533: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >"conftest.$ac_ext" <<_ACEOF #line 2543 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:2548: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2554: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 # Broken: fails on valid input. continue fi rm -f conftest.err "conftest.$ac_ext" # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >"conftest.$ac_ext" <<_ACEOF #line 2577 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:2581: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2587: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err "conftest.$ac_ext" done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err "conftest.$ac_ext" if $ac_preproc_ok; then : else { { echo "$as_me:2615: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&5' ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return="return" echo "$as_me:2627: checking if preprocessor ($CPP) has -C comment-option" >&5 echo $ECHO_N "checking if preprocessor ($CPP) has -C comment-option... $ECHO_C" >&6 if test "${cf_cv_cpp_does_comments+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cf_cv_cpp_does_comments=no cat >conftest.c <conftest.i 2>/dev/null if grep "HELLO WORLD" conftest.i >/dev/null then cf_cv_cpp_does_comments=yes fi fi echo "$as_me:2647: result: $cf_cv_cpp_does_comments" >&5 echo "${ECHO_T}$cf_cv_cpp_does_comments" >&6 test "$cf_cv_cpp_does_comments" = yes && cat >>confdefs.h <<\EOF #define CPP_DOES_COMMENTS 1 EOF for ac_prog in reflex flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:2657: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_LEX="$ac_prog" echo "$as_me:2672: found $ac_dir/$ac_word" >&5 break done fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then echo "$as_me:2680: result: $LEX" >&5 echo "${ECHO_T}$LEX" >&6 else echo "$as_me:2683: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test -z "$LEXLIB" then echo "$as_me:2693: checking for yywrap in -lfl" >&5 echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 if test "${ac_cv_lib_fl_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfl $LIBS" cat >"conftest.$ac_ext" <<_ACEOF #line 2701 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); int main (void) { yywrap (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:2720: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2723: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:2726: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2729: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_lib_fl_yywrap=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_lib_fl_yywrap=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2740: result: $ac_cv_lib_fl_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 if test "$ac_cv_lib_fl_yywrap" = yes; then LEXLIB="-lfl" else echo "$as_me:2745: checking for yywrap in -ll" >&5 echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 if test "${ac_cv_lib_l_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ll $LIBS" cat >"conftest.$ac_ext" <<_ACEOF #line 2753 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); int main (void) { yywrap (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:2772: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2775: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:2778: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2781: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_lib_l_yywrap=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_lib_l_yywrap=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2792: result: $ac_cv_lib_l_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 if test "$ac_cv_lib_l_yywrap" = yes; then LEXLIB="-ll" fi fi fi if test "x$LEX" != "x:"; then echo "$as_me:2803: checking lex output file root" >&5 echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 if test "${ac_cv_prog_lex_root+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # The minimal lex program is just a single line: %%. But some broken lexes # (Solaris, I think it was) want two %% lines, so accommodate them. echo '%% %%' | $LEX if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else { { echo "$as_me:2817: error: cannot find output from $LEX; giving up" >&5 echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:2822: result: $ac_cv_prog_lex_root" >&5 echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo "$as_me:2826: checking whether yytext is a pointer" >&5 echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS=$LIBS LIBS="$LIBS $LEXLIB" cat >"conftest.$ac_ext" <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:2842: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2845: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:2848: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2851: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_prog_lex_yytext_pointer=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" LIBS=$ac_save_LIBS rm -f "${LEX_OUTPUT_ROOT}.c" fi echo "$as_me:2863: result: $ac_cv_prog_lex_yytext_pointer" >&5 echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 if test $ac_cv_prog_lex_yytext_pointer = yes; then cat >>confdefs.h <<\EOF #define YYTEXT_POINTER 1 EOF fi fi echo "$as_me:2874: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:2894: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:2898: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi for ac_prog in byacc 'bison -y' do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:2907: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_YACC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_YACC="$ac_prog" echo "$as_me:2922: found $ac_dir/$ac_word" >&5 break done fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then echo "$as_me:2930: result: $YACC" >&5 echo "${ECHO_T}$YACC" >&6 else echo "$as_me:2933: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:2953: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_IFS=$IFS; IFS=$ac_path_separator for ac_dir in $PATH; do IFS=$ac_save_IFS # Account for people who put trailing slashes in PATH elements. case $ac_dir/ in / | ./ | .// | /cC/* \ | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ | /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if $as_executable_p "$ac_dir/$ac_prog"; then if test $ac_prog = install && grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:3002: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:3013: checking if filesystem supports mixed-case filenames" >&5 echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 if test "${cf_cv_mixedcase+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes ; then case "$target_alias" in (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*|darwin*) cf_cv_mixedcase=no ;; (*) cf_cv_mixedcase=yes ;; esac else rm -f conftest CONFTEST echo test >conftest if test -f CONFTEST ; then cf_cv_mixedcase=no else cf_cv_mixedcase=yes fi rm -f conftest CONFTEST fi fi echo "$as_me:3040: result: $cf_cv_mixedcase" >&5 echo "${ECHO_T}$cf_cv_mixedcase" >&6 test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF #define MIXEDCASE_FILENAMES 1 EOF for ac_prog in exctags ctags do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:3051: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CTAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CTAGS"; then ac_cv_prog_CTAGS="$CTAGS" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CTAGS="$ac_prog" echo "$as_me:3066: found $ac_dir/$ac_word" >&5 break done fi fi CTAGS=$ac_cv_prog_CTAGS if test -n "$CTAGS"; then echo "$as_me:3074: result: $CTAGS" >&5 echo "${ECHO_T}$CTAGS" >&6 else echo "$as_me:3077: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CTAGS" && break done for ac_prog in exetags etags do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:3088: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ETAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ETAGS"; then ac_cv_prog_ETAGS="$ETAGS" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ETAGS="$ac_prog" echo "$as_me:3103: found $ac_dir/$ac_word" >&5 break done fi fi ETAGS=$ac_cv_prog_ETAGS if test -n "$ETAGS"; then echo "$as_me:3111: result: $ETAGS" >&5 echo "${ECHO_T}$ETAGS" >&6 else echo "$as_me:3114: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ETAGS" && break done # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args. set dummy ${CTAGS:-ctags}; ac_word=$2 echo "$as_me:3123: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MAKE_LOWER_TAGS"; then ac_cv_prog_MAKE_LOWER_TAGS="$MAKE_LOWER_TAGS" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_LOWER_TAGS="yes" echo "$as_me:3138: found $ac_dir/$ac_word" >&5 break done test -z "$ac_cv_prog_MAKE_LOWER_TAGS" && ac_cv_prog_MAKE_LOWER_TAGS="no" fi fi MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS if test -n "$MAKE_LOWER_TAGS"; then echo "$as_me:3147: result: $MAKE_LOWER_TAGS" >&5 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 else echo "$as_me:3150: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$cf_cv_mixedcase" = yes ; then # Extract the first word of "${ETAGS:-etags}", so it can be a program name with args. set dummy ${ETAGS:-etags}; ac_word=$2 echo "$as_me:3157: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MAKE_UPPER_TAGS"; then ac_cv_prog_MAKE_UPPER_TAGS="$MAKE_UPPER_TAGS" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_UPPER_TAGS="yes" echo "$as_me:3172: found $ac_dir/$ac_word" >&5 break done test -z "$ac_cv_prog_MAKE_UPPER_TAGS" && ac_cv_prog_MAKE_UPPER_TAGS="no" fi fi MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS if test -n "$MAKE_UPPER_TAGS"; then echo "$as_me:3181: result: $MAKE_UPPER_TAGS" >&5 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 else echo "$as_me:3184: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAKE_UPPER_TAGS=no fi if test "$MAKE_UPPER_TAGS" = yes ; then MAKE_UPPER_TAGS= else MAKE_UPPER_TAGS="#" fi if test "$MAKE_LOWER_TAGS" = yes ; then MAKE_LOWER_TAGS= else MAKE_LOWER_TAGS="#" fi for ac_prog in lint cppcheck splint do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:3208: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LINT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LINT"; then ac_cv_prog_LINT="$LINT" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_LINT="$ac_prog" echo "$as_me:3223: found $ac_dir/$ac_word" >&5 break done fi fi LINT=$ac_cv_prog_LINT if test -n "$LINT"; then echo "$as_me:3231: result: $LINT" >&5 echo "${ECHO_T}$LINT" >&6 else echo "$as_me:3234: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LINT" && break done case "x$LINT" in (xcppcheck|x*/cppcheck) test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" ;; esac case "x$LEX" in (x|x:|xno|xnone) { { echo "$as_me:3249: error: LEX: no suitable program was found" >&5 echo "$as_me: error: LEX: no suitable program was found" >&2;} { (exit 1); exit 1; }; } ;; (*) ;; esac case "x$YACC" in (x|x:|xno|xnone) { { echo "$as_me:3260: error: YACC: no suitable program was found" >&5 echo "$as_me: error: YACC: no suitable program was found" >&2;} { (exit 1); exit 1; }; } ;; (*) ;; esac echo "$as_me:3269: checking if the POSIX test-macros are already defined" >&5 echo $ECHO_N "checking if the POSIX test-macros are already defined... $ECHO_C" >&6 if test "${cf_cv_posix_visible+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 3276 "configure" #include "confdefs.h" #include int main (void) { #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) #error conflicting symbols found #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3295: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3298: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3301: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3304: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_posix_visible=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_visible=yes fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:3315: result: $cf_cv_posix_visible" >&5 echo "${ECHO_T}$cf_cv_posix_visible" >&6 if test "$cf_cv_posix_visible" = no; then cf_XOPEN_SOURCE=500 cf_POSIX_C_SOURCE=199506L cf_xopen_source= case "$host_os" in (aix[4-7]*) cf_xopen_source="-D_ALL_SOURCE" ;; (msys) cf_XOPEN_SOURCE=600 ;; (darwin[0-8].*) cf_xopen_source="-D_APPLE_C_SOURCE" ;; (darwin*) cf_xopen_source="-D_DARWIN_C_SOURCE" cf_XOPEN_SOURCE= ;; (freebsd*|dragonfly*|midnightbsd*) # 5.x headers associate # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L cf_POSIX_C_SOURCE=200112L cf_XOPEN_SOURCE=600 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" ;; (hpux11*) cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" ;; (hpux*) cf_xopen_source="-D_HPUX_SOURCE" ;; (irix[56].*) cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) cf_gnu_xopen_source=$cf_XOPEN_SOURCE echo "$as_me:3360: checking if this is the GNU C library" >&5 echo $ECHO_N "checking if this is the GNU C library... $ECHO_C" >&6 if test "${cf_cv_gnu_library+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 3367 "configure" #include "confdefs.h" #include int main (void) { #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 return 0; #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 return 0; #else # error not GNU C library #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3386: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3389: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3392: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3395: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_library=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_library=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:3406: result: $cf_cv_gnu_library" >&5 echo "${ECHO_T}$cf_cv_gnu_library" >&6 if test x$cf_cv_gnu_library = xyes; then # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE # was changed to help a little. newlib incorporated the change about 4 # years later. echo "$as_me:3414: checking if _DEFAULT_SOURCE can be used as a basis" >&5 echo $ECHO_N "checking if _DEFAULT_SOURCE can be used as a basis... $ECHO_C" >&6 if test "${cf_cv_gnu_library_219+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cf_save="$CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 3426 "configure" #include "confdefs.h" #include int main (void) { #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) return 0; #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) return 0; #else # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3445: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3448: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3451: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3454: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_library_219=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_library_219=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CPPFLAGS="$cf_save" fi echo "$as_me:3466: result: $cf_cv_gnu_library_219" >&5 echo "${ECHO_T}$cf_cv_gnu_library_219" >&6 if test "x$cf_cv_gnu_library_219" = xyes; then cf_save="$CPPFLAGS" echo "$as_me:3471: checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE" >&5 echo $ECHO_N "checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE... $ECHO_C" >&6 if test "${cf_cv_gnu_dftsrc_219+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi cat >"conftest.$ac_ext" <<_ACEOF #line 3576 "configure" #include "confdefs.h" #include #include int main (void) { #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) return 0; #else # error GNU C library is too old #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3596: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3599: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3602: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3605: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_dftsrc_219=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_dftsrc_219=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:3616: result: $cf_cv_gnu_dftsrc_219" >&5 echo "${ECHO_T}$cf_cv_gnu_dftsrc_219" >&6 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" else cf_cv_gnu_dftsrc_219=maybe fi if test "x$cf_cv_gnu_dftsrc_219" != xyes; then echo "$as_me:3625: checking if we must define _GNU_SOURCE" >&5 echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 if test "${cf_cv_gnu_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 3632 "configure" #include "confdefs.h" #include int main (void) { #ifndef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3647: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3650: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3653: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3656: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_save="$CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -D_GNU_SOURCE do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi cat >"conftest.$ac_ext" <<_ACEOF #line 3763 "configure" #include "confdefs.h" #include int main (void) { #ifdef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be undefined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3778: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3781: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3784: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3787: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_source=yes fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CPPFLAGS="$cf_save" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:3802: result: $cf_cv_gnu_source" >&5 echo "${ECHO_T}$cf_cv_gnu_source" >&6 if test "$cf_cv_gnu_source" = yes then echo "$as_me:3807: checking if we should also define _DEFAULT_SOURCE" >&5 echo $ECHO_N "checking if we should also define _DEFAULT_SOURCE... $ECHO_C" >&6 if test "${cf_cv_default_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_GNU_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 3817 "configure" #include "confdefs.h" #include int main (void) { #ifdef _DEFAULT_SOURCE #error expected _DEFAULT_SOURCE to be undefined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3832: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3835: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3838: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3841: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_default_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_default_source=yes fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:3852: result: $cf_cv_default_source" >&5 echo "${ECHO_T}$cf_cv_default_source" >&6 if test "$cf_cv_default_source" = yes then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" fi fi fi fi ;; (minix*) cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... ;; (mirbsd*) # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= if test "$cf_cv_posix_visible" = no; then cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` echo "$as_me:3889: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo "${as_me:-configure}:3895: testing if the symbol is already defined go no further ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 3898 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3913: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3916: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3919: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3922: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_posix_c_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in (.[12]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; (.2) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; (.*) cf_want_posix_source=yes ;; esac if test "$cf_want_posix_source" = yes ; then cat >"conftest.$ac_ext" <<_ACEOF #line 3943 "configure" #include "confdefs.h" #include int main (void) { #ifdef _POSIX_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3958: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3961: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3964: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3967: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "${as_me:-configure}:3978: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" echo "${as_me:-configure}:3986: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 3989 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4004: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4007: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4010: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4013: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_c_source=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4029: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_cv_posix_c_source do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi fi fi # cf_cv_posix_visible ;; (netbsd*) cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw ;; (openbsd[6-9]*) # OpenBSD 6.x has broken locale support, both compile-time and runtime. # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html # Abusing the conformance level is a workaround. { echo "$as_me:4146: WARNING: this system does not provide usable locale support" >&5 echo "$as_me: WARNING: this system does not provide usable locale support" >&2;} cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=700 ;; (openbsd[4-5]*) # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=600 ;; (openbsd*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; (osf[45]*) cf_xopen_source="-D_OSF_SOURCE" ;; (nto-qnx*) cf_xopen_source="-D_QNX_SOURCE" ;; (sco*) # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; (solaris2.*) cf_xopen_source="-D__EXTENSIONS__" cf_cv_xopen_source=broken ;; (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) cf_XOPEN_SOURCE= cf_POSIX_C_SOURCE= ;; (*) echo "$as_me:4178: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 4185 "configure" #include "confdefs.h" #include #include #include int main (void) { #ifndef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4204: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4207: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4210: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4213: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_save="$CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 4225 "configure" #include "confdefs.h" #include #include #include int main (void) { #ifdef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4244: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4247: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4250: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4253: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_xopen_source=$cf_XOPEN_SOURCE fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CPPFLAGS="$cf_save" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4268: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then CFLAGS=`echo "$CFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" for cf_add_cflags in $cf_temp_xopen_source do case "x$cf_add_cflags" in (x-[DU]*) cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CFLAGS" != "$cf_old_cflag" || break CFLAGS="$cf_old_cflag" done cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CPPFLAGS" != "$cf_old_cflag" || break CPPFLAGS="$cf_old_cflag" done ;; esac cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_add_cflags do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done fi if test "$cf_cv_posix_visible" = no; then cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` echo "$as_me:4426: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo "${as_me:-configure}:4432: testing if the symbol is already defined go no further ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 4435 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4450: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4453: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4456: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4459: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_posix_c_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in (.[12]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; (.2) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; (.*) cf_want_posix_source=yes ;; esac if test "$cf_want_posix_source" = yes ; then cat >"conftest.$ac_ext" <<_ACEOF #line 4480 "configure" #include "confdefs.h" #include int main (void) { #ifdef _POSIX_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4495: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4498: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4501: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4504: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "${as_me:-configure}:4515: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" echo "${as_me:-configure}:4523: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 4526 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4541: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4544: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4547: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4550: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_c_source=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4566: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_cv_posix_c_source do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi fi fi # cf_cv_posix_visible ;; esac if test -n "$cf_xopen_source" ; then for cf_add_cflags in $cf_xopen_source do case "x$cf_add_cflags" in (x-[DU]*) cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CFLAGS" != "$cf_old_cflag" || break test -n "$verbose" && echo " removing old option $cf_add_cflags from CFLAGS" 1>&6 echo "${as_me:-configure}:4692: testing removing old option $cf_add_cflags from CFLAGS ..." 1>&5 CFLAGS="$cf_old_cflag" done cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CPPFLAGS" != "$cf_old_cflag" || break test -n "$verbose" && echo " removing old option $cf_add_cflags from CPPFLAGS" 1>&6 echo "${as_me:-configure}:4704: testing removing old option $cf_add_cflags from CPPFLAGS ..." 1>&5 CPPFLAGS="$cf_old_cflag" done ;; esac cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_add_cflags do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 echo "${as_me:-configure}:4792: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 echo "${as_me:-configure}:4802: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 echo "${as_me:-configure}:4812: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done fi if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then echo "$as_me:4824: checking if _XOPEN_SOURCE really is set" >&5 echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 cat >"conftest.$ac_ext" <<_ACEOF #line 4827 "configure" #include "confdefs.h" #include int main (void) { #ifndef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4842: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4845: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4848: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4851: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_XOPEN_SOURCE_set=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_XOPEN_SOURCE_set=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" echo "$as_me:4860: result: $cf_XOPEN_SOURCE_set" >&5 echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 if test "$cf_XOPEN_SOURCE_set" = yes then cat >"conftest.$ac_ext" <<_ACEOF #line 4865 "configure" #include "confdefs.h" #include int main (void) { #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4880: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4883: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4886: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4889: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_XOPEN_SOURCE_set_ok=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_XOPEN_SOURCE_set_ok=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" if test "$cf_XOPEN_SOURCE_set_ok" = no then { echo "$as_me:4900: WARNING: _XOPEN_SOURCE is lower than requested" >&5 echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} fi else echo "$as_me:4905: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 4912 "configure" #include "confdefs.h" #include #include #include int main (void) { #ifndef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4931: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4934: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4937: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4940: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_save="$CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 4952 "configure" #include "confdefs.h" #include #include #include int main (void) { #ifdef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4971: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4974: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4977: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4980: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_xopen_source=$cf_XOPEN_SOURCE fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CPPFLAGS="$cf_save" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4995: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then CFLAGS=`echo "$CFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" for cf_add_cflags in $cf_temp_xopen_source do case "x$cf_add_cflags" in (x-[DU]*) cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CFLAGS" != "$cf_old_cflag" || break CFLAGS="$cf_old_cflag" done cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CPPFLAGS" != "$cf_old_cflag" || break CPPFLAGS="$cf_old_cflag" done ;; esac cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_add_cflags do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done fi fi fi fi # cf_cv_posix_visible echo "$as_me:5142: checking for fgrep" >&5 echo $ECHO_N "checking for fgrep... $ECHO_C" >&6 if test "${ac_cv_path_FGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else for ac_prog in gfgrep fgrep do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:5154: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_FGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $FGREP in [\\/]* | ?:[\\/]*) ac_cv_path_FGREP="$FGREP" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_FGREP="$ac_dir/$ac_word" echo "$as_me:5171: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi FGREP=$ac_cv_path_FGREP if test -n "$FGREP"; then echo "$as_me:5182: result: $FGREP" >&5 echo "${ECHO_T}$FGREP" >&6 else echo "$as_me:5185: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$FGREP" && break done test -n "$FGREP" || FGREP=": " test "x$ac_cv_path_FGREP" = "x:" && { { echo "$as_me:5193: error: cannot find workable fgrep" >&5 echo "$as_me: error: cannot find workable fgrep" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:5198: result: $ac_cv_path_FGREP" >&5 echo "${ECHO_T}$ac_cv_path_FGREP" >&6 FGREP="$ac_cv_path_FGREP" echo "$as_me:5202: checking if you want to use C11 _Noreturn feature" >&5 echo $ECHO_N "checking if you want to use C11 _Noreturn feature... $ECHO_C" >&6 # Check whether --enable-stdnoreturn or --disable-stdnoreturn was given. if test "${enable_stdnoreturn+set}" = set; then enableval="$enable_stdnoreturn" test "$enableval" != yes && enableval=no if test "$enableval" != "no" ; then enable_stdnoreturn=yes else enable_stdnoreturn=no fi else enableval=no enable_stdnoreturn=no fi; echo "$as_me:5219: result: $enable_stdnoreturn" >&5 echo "${ECHO_T}$enable_stdnoreturn" >&6 if test $enable_stdnoreturn = yes; then echo "$as_me:5223: checking for C11 _Noreturn feature" >&5 echo $ECHO_N "checking for C11 _Noreturn feature... $ECHO_C" >&6 if test "${cf_cv_c11_noreturn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 5229 "configure" #include "confdefs.h" #include #include #include static _Noreturn void giveup(void) { exit(0); } int main (void) { if (feof(stdin)) giveup() ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5246: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5249: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5252: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5255: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_c11_noreturn=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_c11_noreturn=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:5266: result: $cf_cv_c11_noreturn" >&5 echo "${ECHO_T}$cf_cv_c11_noreturn" >&6 else cf_cv_c11_noreturn=no, fi if test "$cf_cv_c11_noreturn" = yes; then cat >>confdefs.h <<\EOF #define HAVE_STDNORETURN_H 1 EOF cat >>confdefs.h <&6 echo "${as_me:-configure}:5296: testing repairing CFLAGS: $CFLAGS ..." 1>&5 cf_temp_flags= for cf_temp_scan in $CFLAGS do case "x$cf_temp_scan" in (x-Werror=*) test -n "$EXTRA_CFLAGS" && EXTRA_CFLAGS="$EXTRA_CFLAGS " EXTRA_CFLAGS="${EXTRA_CFLAGS}$cf_temp_scan" ;; (*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; esac done CFLAGS="$cf_temp_flags" test -n "$verbose" && echo " ... fixed $CFLAGS" 1>&6 echo "${as_me:-configure}:5319: testing ... fixed $CFLAGS ..." 1>&5 test -n "$verbose" && echo " ... extra $EXTRA_CFLAGS" 1>&6 echo "${as_me:-configure}:5323: testing ... extra $EXTRA_CFLAGS ..." 1>&5 ;; esac fi if test "$GCC" = yes || test "$GXX" = yes then case $CPPFLAGS in (*-Werror=*) test -n "$verbose" && echo " repairing CPPFLAGS: $CPPFLAGS" 1>&6 echo "${as_me:-configure}:5335: testing repairing CPPFLAGS: $CPPFLAGS ..." 1>&5 cf_temp_flags= for cf_temp_scan in $CPPFLAGS do case "x$cf_temp_scan" in (x-Werror=*) test -n "$EXTRA_CFLAGS" && EXTRA_CFLAGS="$EXTRA_CFLAGS " EXTRA_CFLAGS="${EXTRA_CFLAGS}$cf_temp_scan" ;; (*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; esac done CPPFLAGS="$cf_temp_flags" test -n "$verbose" && echo " ... fixed $CPPFLAGS" 1>&6 echo "${as_me:-configure}:5358: testing ... fixed $CPPFLAGS ..." 1>&5 test -n "$verbose" && echo " ... extra $EXTRA_CFLAGS" 1>&6 echo "${as_me:-configure}:5362: testing ... extra $EXTRA_CFLAGS ..." 1>&5 ;; esac fi if test "$GCC" = yes || test "$GXX" = yes then case $LDFLAGS in (*-Werror=*) test -n "$verbose" && echo " repairing LDFLAGS: $LDFLAGS" 1>&6 echo "${as_me:-configure}:5374: testing repairing LDFLAGS: $LDFLAGS ..." 1>&5 cf_temp_flags= for cf_temp_scan in $LDFLAGS do case "x$cf_temp_scan" in (x-Werror=*) test -n "$EXTRA_CFLAGS" && EXTRA_CFLAGS="$EXTRA_CFLAGS " EXTRA_CFLAGS="${EXTRA_CFLAGS}$cf_temp_scan" ;; (*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; esac done LDFLAGS="$cf_temp_flags" test -n "$verbose" && echo " ... fixed $LDFLAGS" 1>&6 echo "${as_me:-configure}:5397: testing ... fixed $LDFLAGS ..." 1>&5 test -n "$verbose" && echo " ... extra $EXTRA_CFLAGS" 1>&6 echo "${as_me:-configure}:5401: testing ... extra $EXTRA_CFLAGS ..." 1>&5 ;; esac fi echo "$as_me:5407: checking if you want to turn on gcc warnings" >&5 echo $ECHO_N "checking if you want to turn on gcc warnings... $ECHO_C" >&6 # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then enableval="$enable_warnings" test "$enableval" != yes && enableval=no if test "$enableval" != "no" ; then enable_warnings=yes else enable_warnings=no fi else enableval=no enable_warnings=no fi; echo "$as_me:5424: result: $enable_warnings" >&5 echo "${ECHO_T}$enable_warnings" >&6 if test "$enable_warnings" = "yes" then if test "$GCC" = yes || test "$GXX" = yes then cat > conftest.i <&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > "conftest.$ac_ext" <&5 case "$cf_attribute" in (printf) cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5502: \$? = $ac_status" >&5 (exit "$ac_status"); }; then test -n "$verbose" && echo "$as_me:5504: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case "$cf_attribute" in (noreturn) cat >>confdefs.h <>confdefs.h <<\EOF #define GCC_PRINTF 1 EOF fi cat >>confdefs.h <>confdefs.h <<\EOF #define GCC_SCANF 1 EOF fi cat >>confdefs.h <>confdefs.h <>confdefs.h fi rm -rf ./conftest* fi if test "x$have_x" = xyes; then echo "skipping X-const check"; fi cat > "conftest.$ac_ext" <&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" for cf_opt in \ wd1419 \ wd1683 \ wd1684 \ wd193 \ wd593 \ wd279 \ wd810 \ wd869 \ wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if { (eval echo "$as_me:5597: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5600: \$? = $ac_status" >&5 (exit "$ac_status"); }; then test -n "$verbose" && echo "$as_me:5602: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS" elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown" then { echo "$as_me:5610: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" cf_warn_CONST="" test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= for cf_opt in W Wall \ Wbad-function-cast \ Wcast-align \ Wcast-qual \ Wdeclaration-after-statement \ Wextra \ Winline \ Wmissing-declarations \ Wmissing-prototypes \ Wnested-externs \ Wpointer-arith \ Wshadow \ Wstrict-prototypes \ Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if { (eval echo "$as_me:5633: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5636: \$? = $ac_status" >&5 (exit "$ac_status"); }; then test -n "$verbose" && echo "$as_me:5638: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case "$cf_opt" in (Winline) case "$GCC_VERSION" in ([34].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 echo "${as_me:-configure}:5646: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac ;; (Wpointer-arith) case "$GCC_VERSION" in ([12].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 echo "${as_me:-configure}:5656: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac ;; esac EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS" fi rm -rf ./conftest* fi fi echo "$as_me:5673: checking if you want to see long compiling messages" >&5 echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 # Check whether --enable-echo or --disable-echo was given. if test "${enable_echo+set}" = set; then enableval="$enable_echo" test "$enableval" != no && enableval=yes if test "$enableval" != "yes" ; then ECHO_LT='--silent' ECHO_LD='@echo linking $@;' RULE_CC='@echo compiling $<' SHOW_CC='@echo compiling $@' ECHO_CC='@' else ECHO_LT='' ECHO_LD='' RULE_CC='' SHOW_CC='' ECHO_CC='' fi else enableval=yes ECHO_LT='' ECHO_LD='' RULE_CC='' SHOW_CC='' ECHO_CC='' fi; echo "$as_me:5707: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 echo "$as_me:5710: checking if you want to enable lint-library (llib) support" >&5 echo $ECHO_N "checking if you want to enable lint-library (llib) support... $ECHO_C" >&6 # Check whether --enable-llib or --disable-llib was given. if test "${enable_llib+set}" = set; then enableval="$enable_llib" cf_enable_llib=$enableval else cf_enable_llib=yes fi; echo "$as_me:5721: result: $cf_enable_llib" >&5 echo "${ECHO_T}$cf_enable_llib" >&6; if test "$cf_enable_llib" = yes ; then cat >>confdefs.h <<\EOF #define OPT_LINTLIBRARY 1 EOF fi ### extra things that we'll substitute in the makefile echo "$as_me:5732: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 5738 "configure" #include "confdefs.h" int main (void) { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5796: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5799: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5802: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5805: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_c_const=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:5815: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\EOF #define const EOF fi echo "$as_me:5825: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 5831 "configure" #include "confdefs.h" #include #include #include #include _ACEOF if { (eval echo "$as_me:5839: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:5845: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_stdc=no fi rm -f conftest.err "conftest.$ac_ext" if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >"conftest.$ac_ext" <<_ACEOF #line 5867 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -rf conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >"conftest.$ac_ext" <<_ACEOF #line 5885 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -rf conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >"conftest.$ac_ext" <<_ACEOF #line 5906 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main (void) { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) $ac_main_return(2); $ac_main_return (0); } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:5932: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5935: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:5937: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5940: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_stdc=no fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi fi echo "$as_me:5953: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi for ac_header in stdlib.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:5966: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 5972 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:5976: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:5982: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:6001: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6020 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:6024: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:6030: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:6049: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6068 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6099: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6102: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6105: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6108: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:6118: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6153 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:6157: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:6163: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:6182: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6 if test "${cf_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -rf ./conftest* if test "$cross_compiling" = yes; then cf_cv_func_mkstemp=maybe else cat >"conftest.$ac_ext" <<_ACEOF #line 6203 "configure" #include "confdefs.h" #include #ifdef HAVE_UNISTD_H #include #endif #include #include #include #include int main(void) { char *tmpl = "conftestXXXXXX"; char name[2][80]; int n; int result = 0; int fd; struct stat sb; umask(077); for (n = 0; n < 2; ++n) { strcpy(name[n], tmpl); if ((fd = mkstemp(name[n])) >= 0) { if (!strcmp(name[n], tmpl) || stat(name[n], &sb) != 0 || (sb.st_mode & S_IFMT) != S_IFREG || (sb.st_mode & 077) != 0) { result = 1; } close(fd); } } if (result == 0 && !strcmp(name[0], name[1])) result = 1; ${cf_cv_main_return:-return}(result); } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:6244: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6247: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:6249: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6252: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_func_mkstemp=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_func_mkstemp=no fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:6267: result: $cf_cv_func_mkstemp" >&5 echo "${ECHO_T}$cf_cv_func_mkstemp" >&6 if test "x$cf_cv_func_mkstemp" = xmaybe ; then echo "$as_me:6270: checking for mkstemp" >&5 echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6 if test "${ac_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6276 "configure" #include "confdefs.h" #define mkstemp autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef mkstemp #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char mkstemp (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_mkstemp) || defined (__stub___mkstemp) #error found stub for mkstemp #endif return mkstemp (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6307: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6310: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6313: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6316: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_func_mkstemp=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_func_mkstemp=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:6326: result: $ac_cv_func_mkstemp" >&5 echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 fi if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then cat >>confdefs.h <<\EOF #define HAVE_MKSTEMP 1 EOF fi echo "$as_me:6338: checking for size_t in or " >&5 echo $ECHO_N "checking for size_t in or ... $ECHO_C" >&6 if test "${cf_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6345 "configure" #include "confdefs.h" #include #ifdef STDC_HEADERS #include #include #endif #include int main (void) { size_t x ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6363: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6366: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6369: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6372: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_type_size_t=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6384: result: $cf_cv_type_size_t" >&5 echo "${ECHO_T}$cf_cv_type_size_t" >&6 test "$cf_cv_type_size_t" = no && cat >>confdefs.h <<\EOF #define size_t unsigned EOF rm -f yacctest.y cat >yacctest.y < #include #include "yyerror.c" static void yaccError(const char *s) { (void)*s; return; } int yylex (void) { return 1; } %} %% dummy : /* empty */ | error '.' ; %% EOF echo "$as_me:6411: checking if $CPP can handle only .c files" >&5 echo $ECHO_N "checking if $CPP can handle only .c files... $ECHO_C" >&6 $CPP yacctest.y >yacctest.out 2>/dev/null if test ! -s yacctest.out then cat >>confdefs.h <<\EOF #define CPP_DOES_ONLY_C_FILES 1 EOF echo "$as_me:6420: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:6423: result: no" >&5 echo "${ECHO_T}no" >&6 fi $YACC yacctest.y rm -f yacctest.* td_incl='#include "y.tab.c"' for COND in BISON_HAS_YYTNAME YACC_HAS_YYTOKS YACC_HAS_YYTOKS_2 YACC_HAS_YYNAME do echo "$as_me:6432: checking for error-reporting with $COND" >&5 echo $ECHO_N "checking for error-reporting with $COND... $ECHO_C" >&6 if eval "test \"\${ac_cv_$COND+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6438 "configure" #include "confdefs.h" #define $COND 1 #define YYDEBUG 1 $td_incl int main (void) { ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6453: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6456: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6459: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6462: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval 'ac_cv_'$COND'=yes' else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval 'ac_cv_'$COND'=no' fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi eval 'td_result=$ac_cv_'$COND echo "$as_me:6474: result: $td_result" >&5 echo "${ECHO_T}$td_result" >&6 if test $td_result = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for conflicting prototype for popen... $ECHO_C" >&6 if test "${ac_cv_td_popen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6492 "configure" #include "confdefs.h" #include #include "system.h" #if defined(popen) || defined(pclose) make an error #else extern int pclose (FILE *p); extern FILE *popen (const char *c, const char *m); #endif int main (void) { ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6513: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6516: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6519: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6522: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_td_popen=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_td_popen=yes fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:6533: result: $ac_cv_td_popen" >&5 echo "${ECHO_T}$ac_cv_td_popen" >&6 if test $ac_cv_td_popen = yes; then cat >>confdefs.h <<\EOF #define HAVE_POPEN_PROTOTYPE 1 EOF fi ### debugging/testing # Check whether --with-trace or --without-trace was given. if test "${with_trace+set}" = set; then withval="$with_trace" echo "$as_me:6549: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6555 "configure" #include "confdefs.h" #include #include #include int main (void) { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6571: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6574: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6577: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6580: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_time=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6590: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF fi for ac_func in gettimeofday do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:6603: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6609 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6640: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6643: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6646: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6649: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:6659: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <>confdefs.h <<\EOF #define DOALLOC 10000 EOF EXTRA_OBJS="$EXTRA_OBJS trace.o dump.o" fi; echo "$as_me:6676: checking if you want to use dmalloc for testing" >&5 echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then withval="$with_dmalloc" case "x$withval" in (x|xno) ;; (*) : "${with_cflags:=-g}" : "${enable_leaks:=no}" with_dmalloc=yes cat >>confdefs.h <&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 case ".$with_cflags" in (.*-g*) case .$CFLAGS in (.*-g*) ;; (*) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -g do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi ;; esac ;; esac if test "$with_dmalloc" = yes ; then echo "$as_me:6812: checking for dmalloc.h" >&5 echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6818 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:6822: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:6828: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_dmalloc_h=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_dmalloc_h=no fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:6847: result: $ac_cv_header_dmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 if test "$ac_cv_header_dmalloc_h" = yes; then echo "$as_me:6851: checking for dmalloc_debug in -ldmalloc" >&5 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >"conftest.$ac_ext" <<_ACEOF #line 6859 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dmalloc_debug (); int main (void) { dmalloc_debug (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6878: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6881: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6884: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6887: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_lib_dmalloc_dmalloc_debug=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:6898: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 if test "$ac_cv_lib_dmalloc_dmalloc_debug" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 # Check whether --with-dbmalloc or --without-dbmalloc was given. if test "${with_dbmalloc+set}" = set; then withval="$with_dbmalloc" case "x$withval" in (x|xno) ;; (*) : "${with_cflags:=-g}" : "${enable_leaks:=no}" with_dbmalloc=yes cat >>confdefs.h <&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 case ".$with_cflags" in (.*-g*) case .$CFLAGS in (.*-g*) ;; (*) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -g do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi ;; esac ;; esac if test "$with_dbmalloc" = yes ; then echo "$as_me:7049: checking for dbmalloc.h" >&5 echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dbmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7055 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:7059: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:7065: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_dbmalloc_h=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_dbmalloc_h=no fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:7084: result: $ac_cv_header_dbmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 if test "$ac_cv_header_dbmalloc_h" = yes; then echo "$as_me:7088: checking for debug_malloc in -ldbmalloc" >&5 echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >"conftest.$ac_ext" <<_ACEOF #line 7096 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char debug_malloc (); int main (void) { debug_malloc (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:7115: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7118: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:7121: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7124: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_lib_dbmalloc_debug_malloc=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:7135: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 if test "$ac_cv_lib_dbmalloc_debug_malloc" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 # Check whether --with-valgrind or --without-valgrind was given. if test "${with_valgrind+set}" = set; then withval="$with_valgrind" case "x$withval" in (x|xno) ;; (*) : "${with_cflags:=-g}" : "${enable_leaks:=no}" with_valgrind=yes cat >>confdefs.h <&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 case ".$with_cflags" in (.*-g*) case .$CFLAGS in (.*-g*) ;; (*) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -g do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi ;; esac ;; esac echo "$as_me:7285: checking if you want to perform memory-leak testing" >&5 echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 # Check whether --enable-leaks or --disable-leaks was given. if test "${enable_leaks+set}" = set; then enableval="$enable_leaks" enable_leaks=$enableval else enable_leaks=yes fi; if test "x$enable_leaks" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi echo "$as_me:7296: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 if test "$enable_leaks" = no ; then cat >>confdefs.h <<\EOF #define NO_LEAKS 1 EOF cat >>confdefs.h <<\EOF #define YY_NO_LEAKS 1 EOF fi # Extract the first word of "groff", so it can be a program name with args. set dummy groff; ac_word=$2 echo "$as_me:7313: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GROFF_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GROFF_PATH in [\\/]* | ?:[\\/]*) ac_cv_path_GROFF_PATH="$GROFF_PATH" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_GROFF_PATH="$ac_dir/$ac_word" echo "$as_me:7330: found $ac_dir/$ac_word" >&5 break fi done test -z "$ac_cv_path_GROFF_PATH" && ac_cv_path_GROFF_PATH="no" ;; esac fi GROFF_PATH=$ac_cv_path_GROFF_PATH if test -n "$GROFF_PATH"; then echo "$as_me:7342: result: $GROFF_PATH" >&5 echo "${ECHO_T}$GROFF_PATH" >&6 else echo "$as_me:7345: result: no" >&5 echo "${ECHO_T}no" >&6 fi for ac_prog in nroff mandoc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:7353: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_NROFF_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $NROFF_PATH in [\\/]* | ?:[\\/]*) ac_cv_path_NROFF_PATH="$NROFF_PATH" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_NROFF_PATH="$ac_dir/$ac_word" echo "$as_me:7370: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi NROFF_PATH=$ac_cv_path_NROFF_PATH if test -n "$NROFF_PATH"; then echo "$as_me:7381: result: $NROFF_PATH" >&5 echo "${ECHO_T}$NROFF_PATH" >&6 else echo "$as_me:7384: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$NROFF_PATH" && break done test -n "$NROFF_PATH" || NROFF_PATH="no" # Extract the first word of "tbl", so it can be a program name with args. set dummy tbl; ac_word=$2 echo "$as_me:7394: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_TBL_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $TBL_PATH in [\\/]* | ?:[\\/]*) ac_cv_path_TBL_PATH="$TBL_PATH" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_TBL_PATH="$ac_dir/$ac_word" echo "$as_me:7411: found $ac_dir/$ac_word" >&5 break fi done test -z "$ac_cv_path_TBL_PATH" && ac_cv_path_TBL_PATH="cat" ;; esac fi TBL_PATH=$ac_cv_path_TBL_PATH if test -n "$TBL_PATH"; then echo "$as_me:7423: result: $TBL_PATH" >&5 echo "${ECHO_T}$TBL_PATH" >&6 else echo "$as_me:7426: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$GROFF_PATH" = xno then NROFF_NOTE= GROFF_NOTE="#" else NROFF_NOTE="#" GROFF_NOTE= fi case "x${with_man2html}" in (xno) cf_man2html=no ;; (x|xyes) # Extract the first word of "man2html", so it can be a program name with args. set dummy man2html; ac_word=$2 echo "$as_me:7446: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_cf_man2html+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $cf_man2html in [\\/]* | ?:[\\/]*) ac_cv_path_cf_man2html="$cf_man2html" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_cf_man2html="$ac_dir/$ac_word" echo "$as_me:7463: found $ac_dir/$ac_word" >&5 break fi done test -z "$ac_cv_path_cf_man2html" && ac_cv_path_cf_man2html="no" ;; esac fi cf_man2html=$ac_cv_path_cf_man2html if test -n "$cf_man2html"; then echo "$as_me:7475: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 else echo "$as_me:7478: result: no" >&5 echo "${ECHO_T}no" >&6 fi case "x$cf_man2html" in (x/*) echo "$as_me:7484: checking for the modified Earl Hood script" >&5 echo $ECHO_N "checking for the modified Earl Hood script... $ECHO_C" >&6 if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) then cf_man2html_ok=yes else cf_man2html=no cf_man2html_ok=no fi echo "$as_me:7493: result: $cf_man2html_ok" >&5 echo "${ECHO_T}$cf_man2html_ok" >&6 ;; (*) cf_man2html=no ;; esac esac echo "$as_me:7502: checking for program to convert manpage to html" >&5 echo $ECHO_N "checking for program to convert manpage to html... $ECHO_C" >&6 # Check whether --with-man2html or --without-man2html was given. if test "${with_man2html+set}" = set; then withval="$with_man2html" cf_man2html=$withval else cf_man2html=$cf_man2html fi; cf_with_groff=no case $cf_man2html in (yes) echo "$as_me:7517: result: man2html" >&5 echo "${ECHO_T}man2html" >&6 # Extract the first word of "man2html", so it can be a program name with args. set dummy man2html; ac_word=$2 echo "$as_me:7521: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_cf_man2html+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $cf_man2html in [\\/]* | ?:[\\/]*) ac_cv_path_cf_man2html="$cf_man2html" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_cf_man2html="$ac_dir/$ac_word" echo "$as_me:7538: found $ac_dir/$ac_word" >&5 break fi done test -z "$ac_cv_path_cf_man2html" && ac_cv_path_cf_man2html="no" ;; esac fi cf_man2html=$ac_cv_path_cf_man2html if test -n "$cf_man2html"; then echo "$as_me:7550: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 else echo "$as_me:7553: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; (no|groff|*/groff*) cf_with_groff=yes cf_man2html=$GROFF_PATH echo "$as_me:7561: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; (*) echo "$as_me:7565: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; esac MAN2HTML_TEMP="man2html.tmp" cat >$MAN2HTML_TEMP <>$MAN2HTML_TEMP <&5 echo $ECHO_N "checking if nroff is really groff... $ECHO_C" >&6 cf_check_groff="`$NROFF_PATH --version 2>/dev/null | grep groff`" test -n "$cf_check_groff" && cf_check_groff=yes test -n "$cf_check_groff" || cf_check_groff=no echo "$as_me:7611: result: $cf_check_groff" >&5 echo "${ECHO_T}$cf_check_groff" >&6 test "x$cf_check_groff" = xyes && NROFF_OPTS="-rHY=0" fi MAN2HTML_NOTE="" if test "x$prefix" != xNONE; then cf_path_syntax="$prefix" else cf_path_syntax="$ac_default_prefix" fi case ".$cf_man2html" in (.\$\(*\)*|.\'*\'*) ;; (..|./*|.\\*) ;; (.[a-zA-Z]:[\\/]*) # OS/2 EMX ;; (.\$\{*prefix\}*|.\$\{*dir\}*) eval cf_man2html="$cf_man2html" case ".$cf_man2html" in (.NONE/*) cf_man2html=`echo "$cf_man2html" | sed -e s%NONE%$cf_path_syntax%` ;; esac ;; (.no|.NONE/*) cf_man2html=`echo "$cf_man2html" | sed -e s%NONE%$cf_path_syntax%` ;; (*) { { echo "$as_me:7642: error: expected a pathname, not \"$cf_man2html\"" >&5 echo "$as_me: error: expected a pathname, not \"$cf_man2html\"" >&2;} { (exit 1); exit 1; }; } ;; esac MAN2HTML_PATH="$cf_man2html" echo "$as_me:7649: checking for $cf_man2html top/bottom margins" >&5 echo $ECHO_N "checking for $cf_man2html top/bottom margins... $ECHO_C" >&6 # for this example, expect 3 lines of content, the remainder is head/foot cat >conftest.in <conftest.out cf_man2html_1st="`${FGREP-fgrep} -n MARKER conftest.out |sed -e 's/^[^0-9]*://' -e 's/:.*//'`" cf_man2html_top=`expr "$cf_man2html_1st" - 2` cf_man2html_bot="`wc -l conftest.out |sed -e 's/[^0-9]//g'`" cf_man2html_bot=`expr "$cf_man2html_bot" - 2 - "$cf_man2html_top"` cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" echo "$as_me:7667: result: $cf_man2html_top_bot" >&5 echo "${ECHO_T}$cf_man2html_top_bot" >&6 echo "$as_me:7670: checking for pagesize to use" >&5 echo $ECHO_N "checking for pagesize to use... $ECHO_C" >&6 for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 do cat >>conftest.in <conftest.out cf_man2html_page="`${FGREP-fgrep} -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[^0-9]*://' -e 's/:.*//'`" test -z "$cf_man2html_page" && cf_man2html_page=99999 test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 rm -rf conftest* echo "$as_me:7695: result: $cf_man2html_page" >&5 echo "${ECHO_T}$cf_man2html_page" >&6 cat >>$MAN2HTML_TEMP <>confdefs.h <confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overriden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H : "${CONFIG_STATUS=./config.status}" ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:7801: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >"$CONFIG_STATUS" <<_ACEOF #! $SHELL # Generated automatically by configure. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false SHELL=\${CONFIG_SHELL-$SHELL} ac_cs_invocation="\$0 \$@" CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS _ACEOF cat >>"$CONFIG_STATUS" <<\_ACEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset="unset" else as_unset="false" fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } exec 6>&1 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>"$CONFIG_STATUS" fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>"$CONFIG_STATUS" fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>"$CONFIG_STATUS" fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>"$CONFIG_STATUS" fi cat >>"$CONFIG_STATUS" <<\EOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." EOF cat >>"$CONFIG_STATUS" <>"$CONFIG_STATUS" <<\EOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` shift set dummy "$ac_option" "$ac_optarg" ${1+"$@"} shift ;; -*);; *) # This is not an option, so the user has probably given explicit # arguments. ac_need_defaults=false;; esac case $1 in # Handling of the options. EOF cat >>"$CONFIG_STATUS" <>"$CONFIG_STATUS" <<\EOF --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:7980: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) shift CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) shift CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; # This is an error. -*) { { echo "$as_me:7999: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done exec 5>>config.log cat >&5 << _ACEOF ## ----------------------- ## ## Running config.status. ## ## ----------------------- ## This file was extended by $as_me 2.52.20210509, executed with CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS > "$ac_cs_invocation" on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF EOF cat >>"$CONFIG_STATUS" <<\EOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config_h.in" ;; *) { { echo "$as_me:8037: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if "$ac_need_defaults"; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. : ${TMPDIR=/tmp} { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=$TMPDIR/cs$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } EOF cat >>"$CONFIG_STATUS" <\$tmp/subs.sed <<\\CEOF s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_LIBS@,$X_LIBS,;t t s,@SHELL@,$SHELL,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datarootdir@,$datarootdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@runstatedir@,$runstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@DEFS@,$DEFS,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@THIS_SHELL@,$THIS_SHELL,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t s,@CPP@,$CPP,;t t s,@GREP@,$GREP,;t t s,@EGREP@,$EGREP,;t t s,@LEX@,$LEX,;t t s,@LEXLIB@,$LEXLIB,;t t s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@YACC@,$YACC,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CTAGS@,$CTAGS,;t t s,@ETAGS@,$ETAGS,;t t s,@MAKE_LOWER_TAGS@,$MAKE_LOWER_TAGS,;t t s,@MAKE_UPPER_TAGS@,$MAKE_UPPER_TAGS,;t t s,@LINT@,$LINT,;t t s,@LINT_OPTS@,$LINT_OPTS,;t t s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t s,@FGREP@,$FGREP,;t t s,@HAVE_STDNORETURN_H@,$HAVE_STDNORETURN_H,;t t s,@STDC_NORETURN@,$STDC_NORETURN,;t t s,@ECHO_LT@,$ECHO_LT,;t t s,@ECHO_LD@,$ECHO_LD,;t t s,@RULE_CC@,$RULE_CC,;t t s,@SHOW_CC@,$SHOW_CC,;t t s,@ECHO_CC@,$ECHO_CC,;t t s,@EXTRA_OBJS@,$EXTRA_OBJS,;t t s,@GROFF_PATH@,$GROFF_PATH,;t t s,@NROFF_PATH@,$NROFF_PATH,;t t s,@TBL_PATH@,$TBL_PATH,;t t s,@GROFF_NOTE@,$GROFF_NOTE,;t t s,@NROFF_NOTE@,$NROFF_NOTE,;t t s,@cf_man2html@,$cf_man2html,;t t s,@MAN2HTML_NOTE@,$MAN2HTML_NOTE,;t t s,@MAN2HTML_PATH@,$MAN2HTML_PATH,;t t s,@MAN2HTML_TEMP@,$MAN2HTML_TEMP,;t t CEOF EOF cat >>"$CONFIG_STATUS" <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while "$ac_more_lines"; do if test "$ac_beg" -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed # It is possible to make a multiline substitution using escaped newlines. # Ensure that we do not split the substitution between script fragments. ac_BEG=$ac_end ac_END=`expr "$ac_end" + "$ac_max_sed_lines"` sed "1,${ac_BEG}d; ${ac_END}p; q" $tmp/subs.sed >$tmp/subs.next if test -s $tmp/subs.next; then grep '^s,@[^@,][^@,]*@,.*\\$' $tmp/subs.next >$tmp/subs.edit if test ! -s $tmp/subs.edit; then grep "^s,@[^@,][^@,]*@,.*,;t t$" $tmp/subs.next >$tmp/subs.edit if test ! -s $tmp/subs.edit; then if test "$ac_beg" -gt 1; then ac_end=`expr "$ac_end" - 1` continue fi fi fi fi if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr "$ac_sed_frag" + 1` ac_beg=$ac_end ac_end=`expr "$ac_end" + "$ac_max_sed_lines"` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" EOF cat >>"$CONFIG_STATUS" <<\EOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` else ac_dir_suffix= ac_dots= fi case "$srcdir" in .) ac_srcdir=. if test -z "$ac_dots"; then ac_top_srcdir=. else ac_top_srcdir=`echo "$ac_dots" | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) ac_srcdir="$srcdir$ac_dir_suffix"; ac_top_srcdir="$srcdir" ;; *) # Relative path. ac_srcdir="$ac_dots$srcdir$ac_dir_suffix" ac_top_srcdir="$ac_dots$srcdir" ;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_dots$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:8308: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ configure_input="Generated automatically from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:8326: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:8339: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } EOF cat >>"$CONFIG_STATUS" <<\EOF ac_warn_datarootdir=no if test x"$ac_file" != x-; then for ac_item in $ac_file_inputs do ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' "$ac_item"` if test -n "$ac_seen"; then ac_used=`grep '@datarootdir@' "$ac_item"` if test -z "$ac_used"; then { echo "$as_me:8355: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&2;} ac_warn_datarootdir=yes fi fi ac_seen=`grep '${datarootdir}' "$ac_item"` if test -n "$ac_seen"; then { echo "$as_me:8364: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&2;} ac_warn_datarootdir=yes fi done fi if test "x$ac_warn_datarootdir" = xyes; then ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" fi EOF cat >>"$CONFIG_STATUS" <>"$CONFIG_STATUS" <<\EOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then cp "$tmp/out" "$ac_file" for ac_name in prefix exec_prefix datarootdir do ac_seen=`${FGREP-fgrep} -n '${'$ac_name'[:=].*}' "$ac_file"` if test -n "$ac_seen"; then ac_init=`${EGREP-egrep} '[ ]*'$ac_name'[ ]*=' "$ac_file"` if test -z "$ac_init"; then ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` { echo "$as_me:8401: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&5 echo "$as_me: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&2;} fi fi done ${EGREP-egrep} -n '@[a-z_][a-z_0-9]+@' "$ac_file" >$tmp/out ${EGREP-egrep} -n '@[A-Z_][A-Z_0-9]+@' "$ac_file" >>$tmp/out if test -s $tmp/out; then ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` { echo "$as_me:8412: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} fi else cat $tmp/out fi rm -f $tmp/out done EOF cat >>"$CONFIG_STATUS" <<\EOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_iB='\([ ]\),\1#\2define\3' ac_iC=' ' ac_iD='\4,;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:8461: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:8472: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:8485: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in EOF # Transform confdefs.h into a list of #define's. We won't use it as a sed # script, but as data to insert where we see @DEFS@. We expect AC_SAVE_DEFS to # be either 'cat' or 'sort'. cat confdefs.h | uniq >conftest.vals # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail echo ' rm -f conftest.frag' >> "$CONFIG_STATUS" while grep . conftest.vals >/dev/null do # Write chunks of a limited-size here document to conftest.frag. echo ' cat >> conftest.frag <> "$CONFIG_STATUS" sed "${ac_max_here_lines}q" conftest.vals | sed -e 's/#ifdef.*/#if 0/' >> "$CONFIG_STATUS" echo 'CEOF' >> "$CONFIG_STATUS" sed "1,${ac_max_here_lines}d" conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals # Run sed to substitute the contents of conftest.frag into $tmp/in at the # marker @DEFS@. echo ' cat >> conftest.edit < $tmp/out rm -f $tmp/in mv $tmp/out $tmp/in rm -f conftest.edit conftest.frag ' >> "$CONFIG_STATUS" cat >>"$CONFIG_STATUS" <<\EOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated automatically by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s "$ac_file" "$tmp/config.h" 2>/dev/null; then { echo "$as_me:8543: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } fi rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" fi else cat $tmp/config.h rm -f $tmp/config.h fi done EOF cat >>"$CONFIG_STATUS" <<\EOF { (exit 0); exit 0; } EOF chmod +x "$CONFIG_STATUS" ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: exec 5>/dev/null $SHELL "$CONFIG_STATUS" || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. "$ac_cs_success" || { (exit 1); exit 1; } fi test -z "$cf_make_docs" && cf_make_docs=0 cf_output=makefile test -f "$cf_output" || cf_output=Makefile if test "$cf_make_docs" = 0 then cat >>$cf_output <\$@ ${GROFF_NOTE}.ps.pdf : ${GROFF_NOTE} ps2pdf \$*.ps ${GROFF_NOTE} ${GROFF_NOTE}.1.ps : ${GROFF_NOTE} \$(SHELL) -c "tbl \$*.1 | groff -man" >\$@ ${GROFF_NOTE} ${GROFF_NOTE}.1.txt : ${GROFF_NOTE} GROFF_NO_SGR=stupid \$(SHELL) -c "tbl \$*.1 | nroff -rHY=0 -Tascii -man | col -bx" >\$@ ${MAN2HTML_NOTE}.1.html : ${MAN2HTML_NOTE} ./${MAN2HTML_TEMP} \$* 1 man >\$@ CF_EOF cf_make_docs=1 fi for cf_name in cproto do cat >>$cf_output < %description Cproto generates function prototypes for functions defined in the specified C source files to the standard output. The function definitions may be in the old style or ANSI C style. Optionally, cproto also outputs declarations for variables defined in the files. %prep %define debug_package %{nil} %setup -q -n %{AppProgram}-%{AppVersion} %build INSTALL_PROGRAM='${INSTALL}' \ %configure \ --target %{_target_platform} \ --prefix=%{_prefix} \ --bindir=%{_bindir} \ --libdir=%{_libdir} \ --mandir=%{_mandir} \ --enable-llib make %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT strip $RPM_BUILD_ROOT%{_bindir}/%{AppProgram} %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{_prefix}/bin/%{AppProgram} %{_mandir}/man1/%{AppProgram}.* %changelog # each patch should add its ChangeLog entries here * Wed May 23 2018 Thomas Dickey - turn off debug package; add llib feature * Sun Jan 02 2011 Thomas Dickey - cproto 4.7j * Wed Jul 14 2010 Thomas Dickey - initial version cproto-4.7t/package/debian/0000755000175100001440000000000014150117465014416 5ustar tomuserscproto-4.7t/package/debian/source/0000755000175100001440000000000013301372551015712 5ustar tomuserscproto-4.7t/package/debian/source/format0000644000175100001440000000001513301372551017121 0ustar tomusers3.0 (native) cproto-4.7t/package/debian/control0000644000175100001440000000117314020033227016010 0ustar tomusersSource: cproto Maintainer: Thomas E. Dickey Section: devel Priority: optional Standards-Version: 3.8.4 Build-Depends: debhelper (>= 5) Homepage: http://invisible-island.net/cproto/ Package: cproto Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: generate C function prototypes and convert function definitions Cproto generates function prototypes for functions defined in the specified C source files to the standard output. The function definitions may be in the old style or ANSI C style. Optionally, cproto also outputs declarations for variables defined in the files. cproto-4.7t/package/debian/watch0000644000175100001440000000013711417276136015454 0ustar tomusersversion=3 opts=passive ftp://invisible-island.net/cproto/cproto-(\d+)\.tgz \ debian uupdate cproto-4.7t/package/debian/rules0000755000175100001440000000416413301474634015504 0ustar tomusers#!/usr/bin/make -f # Made with the aid of dh_make, by Craig Small # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. # Some lines taken from debmake, by Cristoph Lameter. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) CFLAGS := $(shell dpkg-buildflags --get CFLAGS) LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif configure: configure-stamp configure-stamp: dh_testdir CPPFLAGS="$(CPPFLAGS)" \ CFLAGS="$(CFLAGS)" \ LDFLAGS="$(LDFLAGS)" \ ./configure \ --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ --mandir=\$${prefix}/share/man \ --sysconfdir=/etc \ --enable-llib touch configure-stamp build: build-stamp build-stamp: configure-stamp dh_testdir $(MAKE) touch build-stamp clean: dh_testdir dh_testroot [ ! -f Makefile ] || $(MAKE) clean rm -f configure-stamp build-stamp install-stamp \ config.cache config.h config.status config.log makefile rm -f *.o cproto dh_clean install: install-stamp install-stamp: build-stamp dh_testdir dh_testroot dh_clean -k dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/cproto touch install-stamp # Build architecture-independent files here. binary-indep: build install # No binary-indep target. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installdocs dh_installexamples dh_installchangelogs CHANGES dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install install-stamp cproto-4.7t/package/debian/copyright0000644000175100001440000001152413776567244016375 0ustar tomusersUpstream source https://invisible-island.net/cproto/cproto.html cproto is in the public domain; changes made to it by the current maintainer are likewise unrestricted. That applies to most of the files. A few files (currently those related to autoconf scripting) have other licenses as noted here. Current cproto upstream maintainer: Thomas Dickey ------------------------------------------------------------------------------- Files: aclocal.m4 Licence: other-BSD Copyright: 1994-2020,2021 by Thomas E. Dickey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, distribute with modifications, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. Files: install-sh Copyright: 1994 X Consortium Licence: other-BSD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the X Consor- tium. FSF changes to this file are in the public domain. Calling this script install-sh is preferred over install.sh, to prevent `make' implicit rules from creating a file called install from it when there is no Makefile. This script is compatible with the BSD install script, but was written from scratch. It can only install one file at a time, a restriction shared with many OS's install programs. Files: debian/* Copyright: 2010-2020,2021 Thomas E. Dickey Licence: other-BSD Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. On Debian systems, the complete text of the GNU General Public License can be found in '/usr/share/common-licenses/GPL-2' cproto-4.7t/package/debian/compat0000644000175100001440000000000314020030546015603 0ustar tomusers10 cproto-4.7t/package/debian/docs0000644000175100001440000000000711417276261015271 0ustar tomusersREADME cproto-4.7t/package/debian/changelog0000644000175100001440000000353214150117465016273 0ustar tomuserscproto (4.7t) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Fri, 26 Nov 2021 03:47:49 -0500 cproto (4.7s) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Wed, 03 Mar 2021 17:04:59 -0500 cproto (4.7r) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sun, 10 Jan 2021 07:01:55 -0500 cproto (4.7q) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sun, 11 Oct 2020 11:35:01 -0400 cproto (4.7p) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Wed, 15 Jul 2020 16:20:37 -0400 cproto (4.7o) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Thu, 24 May 2018 19:36:34 -0400 cproto (4.7n) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Tue, 22 May 2018 20:35:01 -0400 cproto (4.7m) unstable; urgency=low * configure script updates -- Thomas E. Dickey Sun, 05 Jul 2015 20:52:03 -0400 cproto (4.7l) unstable; urgency=low * correct configure-check for yyname vs yytname -- Thomas E. Dickey Wed, 01 Jan 2014 10:31:44 -0500 cproto (4.7k) unstable; urgency=low * update configure scripts -- Thomas E. Dickey Fri, 25 Oct 2013 04:28:30 -0400 cproto (4.7j) unstable; urgency=low * minor fix to lint-library check for function vs function-pointer. -- Thomas E. Dickey Sun, 02 Jan 2011 14:33:51 -0500 cproto (4.7i) unstable; urgency=low * Add package scripts to upstream source, for test-builds. -- Thomas E. Dickey Wed, 14 Jul 2010 04:59:59 -0400 cproto-4.7t/semantic.h0000644000175100001440000000341511510145747013561 0ustar tomusers/* $Id: semantic.h,v 4.6 2011/01/02 19:03:03 tom Exp $ * * Declarations of semantic action routines */ #ifdef __cplusplus extern "C" { #endif #include extern void new_decl_spec ( DeclSpec *decl_spec, const char *text, long offset, int flags); extern void free_decl_spec ( DeclSpec *decl_spec); extern void join_decl_specs ( DeclSpec *result, DeclSpec *a, DeclSpec *b); extern void check_untagged ( DeclSpec *decl_spec); extern Declarator *new_declarator ( const char *text, const char *name, long offset); extern void free_declarator ( Declarator *d); extern void new_decl_list ( DeclaratorList *decl_list, Declarator *declarator); extern void free_decl_list ( DeclaratorList *decl_list); extern void add_decl_list ( DeclaratorList *to, DeclaratorList *from, Declarator *declarator); extern Parameter *new_parameter ( DeclSpec *decl_spec, Declarator *declarator); extern void free_parameter ( Parameter *param); extern void new_param_list ( ParameterList *param_list, Parameter *param); extern void free_param_list ( ParameterList *param_list); extern void add_param_list ( ParameterList *to, ParameterList *from, Parameter *param); extern void new_ident_list ( ParameterList *param_list); extern void add_ident_list ( ParameterList *to, ParameterList *from, const char *name); extern void set_param_types ( ParameterList *params, DeclSpec *decl_spec, DeclaratorList *declarators); extern void gen_declarations ( DeclSpec *decl_spec, DeclaratorList *decl_list); extern void gen_prototype ( DeclSpec *decl_spec, Declarator *declarator); extern void gen_func_declarator ( Declarator *declarator); extern void gen_func_definition ( DeclSpec *decl_spec, Declarator *declarator); #ifdef __cplusplus } #endif cproto-4.7t/cproto.c0000644000175100001440000005375014150117465013265 0ustar tomusers/* $Id: cproto.c,v 4.52 2021/11/26 08:47:49 tom Exp $ * * C function prototype generator and function definition converter */ #define VERSION "4.7t" #include /* getopt declarations */ #if HAVE_GETOPT_H #include #else extern int getopt(int argc, char *const *argv, const char *shortopts); extern char *optarg; extern int optind; #endif /* Name of the program (from argv[0]) */ char *progname; /* Program options */ /* If nonzero, output variables declared "extern" in include-files */ unsigned extern_in = 0; /* When TRUE, track the include-level (works with gcc, not some others) */ #if OPT_LINTLIBRARY int do_tracking = FALSE; #endif /* When TRUE, suppress return-statements in function-bodies */ int exitlike_func = FALSE; /* If TRUE, output "extern" before global declarations */ boolean extern_out = FALSE; /* By default, generate global declarations only */ Scope scope_out = SCOPE_EXTERN; /* If TRUE, output definitions for inline functions */ boolean inline_out = FALSE; /* If TRUE, export typedef declarations (needed for lint-libs) */ #if OPT_LINTLIBRARY boolean types_out = FALSE; #endif /* If TRUE, undef functions to avoid shadowing problems */ #if OPT_LINTLIBRARY boolean lint_shadowed = FALSE; #endif /* If TRUE, generate variable declarations */ boolean variables_out = FALSE; /* If TRUE, enable formal parameter promotion */ boolean promote_param = TRUE; /* Style of function prototype to generate */ PrototypeStyle proto_style = PROTO_ANSI; /* Function definition style converted to */ FuncDefStyle func_style = FUNC_UNKNOWN; /* If TRUE, put guard macro around prototype parameters */ boolean proto_macro = FALSE; /* Name of macro to guard prototypes */ const char *macro_name = "P_"; /* Type of parameter to use with no-parameter functions */ const char *void_name = "void"; /* If TRUE, output prototype macro definition */ boolean define_macro = TRUE; /* If TRUE, output comments in prototypes */ boolean proto_comments = FALSE; /* If TRUE, output comments naming source files */ boolean file_comments = TRUE; /* Conditional compilation directive output in front of function definitions */ const char *func_directive = "#ifdef ANSI_FUNC"; /* Output formats for function declarators */ FuncFormat fmt[] = { /* miscellaneous function declarator */ {"", " ", "", "", " ", ""}, /* prototype */ {"", " ", "", "", " ", ""}, /* function definition */ {"", "\n", " ", "", " ", ""}, /* function definition with parameter comments */ {"", "\n", " ", "\n ", "\n ", "\n"}, }; /* If TRUE, don't output message if unable to read an include file */ boolean quiet = FALSE; /* Include file directories */ unsigned num_inc_dir = 0; char **inc_dir = 0; /* Run the C preprocessor */ #ifdef CPP # if !HAVE_POPEN_PROTOTYPE extern FILE *popen(const char *c, const char *m); extern int pclose(FILE *p); # endif static size_t cpp_len; static const char *cpp = CPP; static char *cpp_opt; static char *cpp_cmd; #endif /* Try to allocate some memory. * If unsuccessful, output an error message and exit. */ #if !HAVE_LIBDMALLOC #ifdef NO_LEAKS void * xMalloc(size_t n, char *f GCC_UNUSED, int l GCC_UNUSED) #else void * xmalloc(size_t n) #endif { void *p; #if HAVE_LIBDBMALLOC p = debug_malloc(f, l, n); #else p = malloc(n); #endif if (p == NULL) { fprintf(stderr, "%s: out of memory (cannot allocate %lu bytes)\n", progname, (unsigned long) n); exit(EXIT_FAILURE); } return p; } #endif /* if !HAVE_LIBDMALLOC */ /* Try to reallocate some memory. * If unsuccessful, output an error message and exit. */ #if !HAVE_LIBDMALLOC #ifdef NO_LEAKS void * xRealloc(void *p, size_t n, char *f GCC_UNUSED, int l GCC_UNUSED) #else void * xrealloc(void *p, size_t n) #endif { #if HAVE_LIBDBMALLOC p = debug_malloc(f, l, p, n); #else p = realloc(p, n); #endif if (p == NULL) { fprintf(stderr, "%s: out of memory (cannot allocate %lu bytes)\n", progname, (unsigned long) n); exit(EXIT_FAILURE); } return p; } #endif /* if !HAVE_LIBDMALLOC */ /* Copy the string into allocated memory. * If unsuccessful, output an error message and exit. */ #if !HAVE_LIBDMALLOC #ifdef NO_LEAKS char * xStrdup(const char *src, char *f, int l) #else char * xstrdup(const char *src) #endif { #if defined(NO_LEAKS) return strcpy((char *) xMalloc(strlen(src) + 1, f, l), src); #else return strcpy((char *) xmalloc(strlen(src) + 1), src); #endif } #endif /* if !HAVE_LIBDMALLOC */ /* Output the current source file name and line number. */ void put_error(void) { fprintf(stderr, "%s:%u: ", cur_file_name(), cur_line_num()); } /* Scan for options from a string. */ static void parse_options(char *src, int maxargc, int *pargc, char **argv) { char *g, *p, c; int argc; argc = 0; g = xstrdup(src); c = *g; while (c != '\0' && argc < maxargc) { while (c == ' ' || c == '\t') c = *++g; if (c == '\0') break; argv[argc++] = g; p = g; for (;;) { if (c == ' ' || c == '\t' || c == '\0') { *p = '\0'; break; } else if (c == '"') { for (;;) { c = *++g; if (c == '"') { c = *++g; break; } else if (c == '\0') { break; } else { *p++ = c; } } } else { *p++ = c; c = *++g; } } if (c != '\0') c = *++g; } *pargc = argc; } /* Replace any character escape sequences in a string with the actual * characters. Return a pointer to malloc'ed memory containing the result. * This function knows only a few escape sequences. */ static char * escape_string(char *src) { char *result, *get, *put; result = xstrdup(src); put = result; get = src; while (*get != '\0') { if (*get == '\\') { switch (*(++get)) { case 'n': *put++ = '\n'; ++get; break; case 's': *put++ = ' '; ++get; break; case 't': *put++ = '\t'; ++get; break; default: if (*get != '\0') *put++ = *get++; } } else { *put++ = *get++; } } *put = *get; return result; } /* Returns true iff the character is a path leaf separator */ int is_path_sep(int ch) { #if defined(MSDOS) || defined(OS2) return ch == '/' || ch == '\\'; #else return ch == '/'; #endif } /* Trim any path name separator from the end of the string. * Return a pointer to the string. */ char * trim_path_sep(char *s) { size_t n = strlen(s); if (n != 0) { if (is_path_sep(s[n - 1])) s[n - 1] = '\0'; } return s; } /* Output usage message and exit. */ static void usage(void) { static const char *table[] = { "Options:", " -a, -t Convert function definitions to ANSI or traditional style", " -b Rewrite function definitions in both styles", " -c Enable comments in prototype parameters", " -C template Set format for function definition with parameter comments", " -D name[=value] Define C preprocessor symbol", " -d Omit prototype macro definition", " -E 0 Do not run any C preprocessor", " -E command Run specified C preprocessor command", " -e Output \"extern\" keyword before global declarations", " -f n Set function prototype style (0 to 3)", " -F template Set function definition format template \" int f (a, b)\"", " -I directory Add #include search directory", " -i Output inline declarations also", #if OPT_LINTLIBRARY " -l Generate output in lint-library style", #endif " -M name Set name of prototype macro", " -m Put macro around prototype parameters", " -N name Set parameter type for no-parameter functions", " -n Do not fill in \"void\" for no-parameter functions", " -O file Redirect errors to file", " -o file Redirect output to file", " -p Disable formal parameter promotion", " -P template Set prototype format template \" int f (a, b)\"", " -q Disable include file read failure messages", " -s Output static declarations also", " -S Output static declarations only", #if OPT_LINTLIBRARY " -T Output type definitions", #endif " -U name Undefine C preprocessor symbol", " -v Output variable declarations", " -V Print version information", #if OPT_LINTLIBRARY " -X level Limit externs to given include-level", #endif " -x Output variables and functions declared \"extern\"", }; size_t n; fprintf(stderr, "usage: %s [ option ... ] [ file ... ]\n", progname); for (n = 0; n < sizeof(table) / sizeof(table[0]); ++n) { fprintf(stderr, "%s\n", table[n]); } exit(EXIT_FAILURE); } #define CHUNK(n) (((n) | 7) + 1) /* * CURRENT_DIR is the first element in the array, and the system includes * are the last. Other -I options are inserted in order between the two. */ static void add_inc_dir(const char *src) { size_t have = CHUNK(num_inc_dir); size_t need = CHUNK(num_inc_dir + 1); size_t used = (need * sizeof(char *)); char *save; if (inc_dir == 0) { inc_dir = (char **) malloc(used); } else if (have != need) { inc_dir = (char **) realloc(inc_dir, used); } switch (num_inc_dir) { case 0: /* FALLTHRU */ case 1: inc_dir[num_inc_dir++] = trim_path_sep(xstrdup(src)); break; default: save = inc_dir[--num_inc_dir]; inc_dir[num_inc_dir++] = trim_path_sep(xstrdup(src)); inc_dir[num_inc_dir++] = save; break; } } #ifdef vms static char *cpp_defines; static char *cpp_include; static char *cpp_undefns; static void add2list(char *dst, char *src) { if (*dst) strcat(dst, ","); strcat(dst, src); } static void add_option(char *keyword, char *src) { if (*src) sprintf(cpp_opt + strlen(cpp_opt), " /%s=(%s)", keyword, src); } #endif /* vms */ #ifdef QUOTE_POPEN_ARGS /* Calculate length of string including shell quoting characters that * must be inserted to preserve the string when it is passed to /bin/sh. * On UNIX systems, popen() runs /bin/sh. */ #define QUOTECHARS "\"\'\t\n " static int quote_length(char *s) { int len = strlen(s); if (strpbrk(s, QUOTECHARS)) { len += 2; while (*s) if (*s++ == '\'') len += 4; /* replace ' with '"'"' (ick!) */ } return len; } /* Insert quoting characters to preserve the string when it is passed to * /bin/sh. */ static char * quote_string(char *s) { if (strpbrk(s, QUOTECHARS)) { char *src = s; char *dup, *dup_orig; dup = dup_orig = xstrdup(s); while (isspace(*src)) *src++ = *dup++; *src++ = '\''; while (*dup) { if (*dup == '\'') { *src++ = '\''; *src++ = '"'; *src++ = '\''; *src++ = '"'; *src++ = '\''; dup++; } else { *src++ = *dup++; } } *src++ = '\''; *src = '\0'; free(dup_orig); } return s; } #else #define quote_length(s) strlen(s) #define quote_string(s) (s) #endif /*QUOTE_POPEN_ARGS */ #define MAX_OPTIONS 40 #define ALL_OPTIONS "\ B:\ C:\ D:\ E:\ F:\ I:\ M:\ N:\ O:\ P:\ S\ T\ U:\ V\ X:\ a\ b\ c\ d\ e\ f:\ i\ l\ m\ n\ o:\ p\ q\ s\ t\ v\ x\ " /* If optarg is a number, return its value. Otherwise, return -1. */ static int numeric_param(void) { int result = -1; char *next = NULL; long value = strtol(optarg, &next, 0); if (value >= 0 && (next == NULL || *next == '\0')) { result = (int) value; } return result; } /* Process the command line options. */ static void process_options(int *pargc, char ***pargv) { int argc, eargc, nargc; char **argv, *eargv[MAX_OPTIONS], **nargv; int i, c; char *s; #if defined(CPP) size_t n; #endif #if defined(CPP) && !defined(vms) char *tmp; #endif argc = *pargc; argv = *pargv; #ifndef vms /* this conflicts with use of foreign commands... */ if ((s = getenv("CPROTO")) != NULL) { parse_options(s, MAX_OPTIONS, &eargc, eargv); nargv = (char **) xmalloc(((unsigned) (eargc + argc + 1)) * sizeof(char *)); nargv[0] = argv[0]; nargc = 1; for (i = 0; i < eargc; ++i) nargv[nargc++] = eargv[i]; for (i = 1; i < argc; ++i) nargv[nargc++] = argv[i]; nargv[nargc] = NULL; argc = nargc; argv = nargv; } #endif #ifdef CPP /* Allocate buffer for C preprocessor command line. */ n = strlen(cpp) + 1; for (i = 0; i < argc; ++i) { n += quote_length(argv[i]) + 1; /* add more for possible quoting */ } #ifdef vms *(cpp_include = xmalloc(n + argc)) = '\0'; *(cpp_defines = xmalloc(n + argc)) = '\0'; *(cpp_undefns = xmalloc(n + argc)) = '\0'; n += 30; /* for keywords */ #endif *(cpp_opt = (char *) xmalloc(n)) = '\0'; n += (2 + strlen(CPP) + BUFSIZ); *(cpp_cmd = (char *) xmalloc(n)) = '\0'; cpp_len = n; #endif while ((c = getopt(argc, argv, ALL_OPTIONS)) != EOF) { switch (c) { case 'I': #ifdef vms add2list(cpp_include, optarg); break; #else /* unix */ add_inc_dir(optarg); #endif /*FALLTHRU */ case 'D': #ifdef vms add2list(cpp_defines, optarg); break; #endif /*FALLTHRU */ case 'U': #ifdef vms add2list(cpp_undefns, optarg); break; #else /* UNIX, etc. */ #ifdef CPP tmp = (char *) xmalloc(quote_length(optarg) + 10); sprintf(tmp, " -%c%s", c, optarg); strcat(cpp_opt, quote_string(tmp)); free(tmp); #endif #endif break; case 'a': func_style = FUNC_ANSI; break; case 'B': func_directive = optarg; break; case 'b': func_style = FUNC_BOTH; break; case 'c': proto_comments = TRUE; break; case 'd': define_macro = FALSE; break; case 'E': #ifdef CPP if (strcmp(optarg, "0") == 0) { cpp = NULL; } else { cpp = optarg; } #endif break; case 'e': extern_out = TRUE; break; case 'C': case 'F': case 'P': s = escape_string(optarg); i = (c == 'C') ? FMT_FUNC_COMMENT : ((c == 'F') ? FMT_FUNC : FMT_PROTO); fmt[i].decl_spec_prefix = s; while (*s != '\0' && !isalnum(UCH(*s))) ++s; if (*s == '\0') usage(); *s++ = '\0'; while (*s != '\0' && isalnum(UCH(*s))) ++s; if (*s == '\0') usage(); fmt[i].declarator_prefix = s; while (*s != '\0' && !isalnum(UCH(*s))) ++s; if (*s == '\0') usage(); *s++ = '\0'; while (*s != '\0' && isalnum(UCH(*s))) ++s; if (*s == '\0') usage(); fmt[i].declarator_suffix = s; while (*s != '\0' && *s != '(') ++s; if (*s == '\0') usage(); *s++ = '\0'; fmt[i].first_param_prefix = s; while (*s != '\0' && !isalnum(UCH(*s))) ++s; if (*s == '\0') usage(); *s++ = '\0'; while (*s != '\0' && *s != ',') ++s; if (*s == '\0') usage(); fmt[i].middle_param_prefix = ++s; while (*s != '\0' && !isalnum(UCH(*s))) ++s; if (*s == '\0') usage(); *s++ = '\0'; while (*s != '\0' && isalnum(UCH(*s))) ++s; if (*s == '\0') usage(); fmt[i].last_param_suffix = s; while (*s != '\0' && *s != ')') ++s; *s = '\0'; break; case 'f': proto_style = numeric_param(); if (proto_style < 0 || proto_style > PROTO_ANSI) usage(); break; case 'm': proto_macro = TRUE; break; case 'M': macro_name = optarg; break; case 'n': void_name = "/*empty*/"; break; case 'N': void_name = optarg; break; case 'p': promote_param = FALSE; break; case 'q': quiet = TRUE; break; case 'S': scope_out = SCOPE_STATIC; break; case 's': scope_out = SCOPE_ALL; break; case 'i': inline_out = TRUE; break; case 't': func_style = FUNC_TRADITIONAL; break; case 'V': fprintf(stderr, "%s\n", VERSION); exit(EXIT_FAILURE); break; case 'v': variables_out = TRUE; break; case 'o': if (freopen(optarg, "w", stdout) == 0) { perror(optarg); exit(EXIT_FAILURE); } break; case 'O': if (numeric_param() < 0 && freopen(optarg, "w", stderr) == 0) { perror(optarg); exit(EXIT_FAILURE); } break; #if OPT_LINTLIBRARY case 'T': /* emit typedefs */ types_out = TRUE; break; case 'l': proto_style = PROTO_LINTLIBRARY; extern_out = FALSE; types_out = TRUE; variables_out = TRUE; # if defined(CPP_DOES_COMMENTS) (void) strcat(cpp_opt, " -C"); /* pass-through comments */ # endif break; case 'X': do_tracking = TRUE; if ((i = numeric_param()) < 0) usage(); extern_in = (unsigned) i; break; #endif /* OPT_LINTLIBRARY */ case 'x': extern_in = MAX_INC_DEPTH; break; default: usage(); } } #ifdef vms add_option("includes", cpp_include); add_option("define", cpp_defines); add_option("undefine", cpp_undefns); #endif *pargc = argc; *pargv = argv; } int main(int argc, char *argv[]) { int i; FILE *inf; #ifdef NO_LEAKS char *argv0; #endif #ifdef __EMX__ /* Expand file wild cards. */ _wildcard(&argc, &argv); #endif add_inc_dir(CURRENT_DIR); #if defined(MSDOS) && defined(__TURBOC__) add_inc_dir("/tc/include"); #elif defined(vms) add_inc_dir("sys$library:"); #else add_inc_dir("/usr/include"); #endif /* Get the program name from the 0th argument, stripping the pathname * for readability. */ progname = xstrdup(argv[0]); #ifdef NO_LEAKS argv0 = progname; #endif #ifdef vms for (i = strlen(progname) - 1; i >= 0; i--) { if (progname[i] == SQUARE_R || progname[i] == ':') { progname += (i + 1); break; } else if (progname[i] == '.') { progname[i] = '\0'; } } #else for (i = (int) strlen(progname) - 1; i >= 0; i--) { if (is_path_sep(progname[i])) { progname += (i + 1); break; # if defined(MSDOS) || defined(OS2) } else if (progname[i] == '.') { progname[i] = '\0'; # endif } } #endif argv[0] = progname; /* do this so getopt is consistent with us */ process_options(&argc, &argv); #if OPT_LINTLIBRARY if (lintLibrary()) { put_string(stdout, "/* LINTLIBRARY */\n"); switch (func_style) { case FUNC_ANSI: case FUNC_BOTH: lint_shadowed = TRUE; /* e.g., ctype.h */ proto_style = PROTO_ANSI_LLIB; break; } func_style = FUNC_NONE; } else if (func_style == FUNC_UNKNOWN) func_style = FUNC_NONE; #endif if (proto_macro && define_macro) { printf("#if __STDC__ || defined(__cplusplus)\n"); printf("#define %s(s) s\n", macro_name); printf("#else\n"); printf("#define %s(s) ()\n", macro_name); printf("#endif\n\n"); } init_parser(); if (optind == argc) { if (func_style != FUNC_NONE) { proto_style = PROTO_NONE; variables_out = FALSE; file_comments = FALSE; } process_file(stdin, "stdin"); pop_file(FALSE); } else { if (!optind) optind++; for (i = optind; i < argc; ++i) { #ifdef CPP # if defined(CPP_DOES_ONLY_C_FILES) /* * GCC (and possibly other compilers) don't pass-through the ".l" * and ".y" files to the C preprocessor stage. Fix this by * temporarily linking the input file to a temporary-file with a * ".c" suffix. * * Of course, this solution assumes that the input directory is * writeable. */ char temp[BUFSIZ]; char *s = strcpy(temp, argv[i]); # if HAVE_LINK int len = (int) strlen(temp); s += len - 1; if ((len > 2) && (s[-1] == '.') && (*s == 'l' || *s == 'y')) { while (s != temp && s[-1] != '/') s--; (void) strcpy(s, "XXXXXX.c"); if (call_mktemp(temp) && link(argv[i], temp) < 0) { (void) strcpy(temp, argv[i]); } else { perror("mktemp/link"); exit(EXIT_FAILURE); } } # endif # define FileName temp # else # define FileName argv[i] # ifdef vms char temp[BUFSIZ]; (void) strcpy(temp, FileName); # endif # endif if (func_style == FUNC_NONE && cpp != NULL) { #ifdef vms /* * Assume the 'cpp' command contains a "%s" for the name of * the file that we're writing to. */ sprintf(cpp_cmd, cpp, call_mktemp(strcpy(temp, "sys$scratch:XXXXXX.i"))); sprintf(cpp_cmd + strlen(cpp_cmd), "%s %s", cpp_opt, FileName); system(cpp_cmd); inf = fopen(temp, "r"); #else if (cpp_len < (strlen(cpp) + strlen(cpp_opt) + strlen(FileName) + 100)) { cpp_len = (strlen(cpp) + strlen(cpp_opt) + strlen(FileName) + 100); cpp_cmd = realloc(cpp_cmd, cpp_len); } sprintf(cpp_cmd, "%s%s %s", cpp, cpp_opt, FileName); if (quiet) strcat(cpp_cmd, " 2>/dev/null"); inf = popen(cpp_cmd, "r"); #endif if (inf == NULL || ferror(inf) || feof(inf)) { fprintf(stderr, "%s: error running %s\n", progname, cpp_cmd); continue; } } else { if ((inf = fopen(argv[i], "r")) == NULL) { fprintf(stderr, "%s: cannot read file %s\n", progname, argv[i]); continue; } } #else if ((inf = fopen(argv[i], "r")) == NULL) { fprintf(stderr, "%s: cannot read file %s\n", progname, argv[i]); continue; } #endif process_file(inf, argv[i]); #ifdef CPP if (func_style == FUNC_NONE && cpp != NULL) { #ifdef vms fclose(inf); #else pclose(inf); #endif #if defined(CPP_DOES_ONLY_C_FILES) || defined(vms) if (strcmp(argv[i], temp)) { (void) unlink(temp); } pop_file(TRUE); #endif } else { pop_file(FALSE); } #else /* no CPP defined */ pop_file(FALSE); #endif } } if (proto_macro && define_macro) { printf("\n#undef %s\n", macro_name); } #ifdef NO_LEAKS # ifdef CPP if (cpp_opt != 0) free(cpp_opt); if (cpp_cmd != 0) free(cpp_cmd); # ifdef vms if (cpp_include != 0) free(cpp_include); if (cpp_defines != 0) free(cpp_defines); if (cpp_undefns != 0) free(cpp_undefns); # endif # endif if (inc_dir != 0) { while (num_inc_dir-- > 0) { free(inc_dir[num_inc_dir]); } free(inc_dir); inc_dir = 0; } free_lexer(); free_parser(); # if OPT_LINTLIBRARY free_lintlibs(); # endif # ifdef DOALLOC show_alloc(); # endif free(argv0); #endif return EXIT_SUCCESS; } /* Intercept 'exit()' for debugging. (The Linux libc uses malloc/free in * 'exit()', so we cannot get a trace unless we resort to this hack ;-) */ #if HAVE_LIBDBMALLOC #undef exit void ExitProgram(int code) { extern int malloc_errfd; /* FIXME: should be in dbmalloc.h */ malloc_dump(malloc_errfd); exit(code); } #endif cproto-4.7t/symbol.c0000644000175100001440000000456311510147473013261 0ustar tomusers/* $Id: symbol.c,v 4.9 2011/01/02 19:17:15 tom Exp $ * * Implements a symbol table abstract data type. */ #include /* Create a symbol table. * Return a pointer to the symbol table or NULL if an error occurs. */ SymbolTable * new_symbol_table(void) { SymbolTable *symtab; int i; if ((symtab = NEW(SymbolTable)) != NULL) { for (i = 0; i < SYM_MAX_HASH; ++i) symtab->bucket[i] = NULL; } return symtab; } /* Free the memory allocated to the symbol table. */ void free_symbol_table(SymbolTable * symtab) { int i; Symbol *sym, *next; for (i = 0; i < SYM_MAX_HASH; ++i) { sym = symtab->bucket[i]; while (sym != NULL) { next = sym->next; if (sym->name != 0) free(sym->name); if (sym->value != 0) free(sym->value); free(sym); sym = next; } } free(symtab); } /* This is a simple hash function mapping a symbol name to a hash bucket. */ static unsigned hash(const char *name) { const char *s; unsigned h; h = 0; s = name; while (*s != '\0') h = (h << 1) ^ (unsigned char) (*s++); return h % SYM_MAX_HASH; } /* Search the list of symbols for the symbol . * Return a pointer to the symbol or NULL if not found. */ static Symbol * search_symbol_list(Symbol * list, const char *name) { Symbol *sym; for (sym = list; sym != NULL; sym = sym->next) { if (strcmp(sym->name, name) == 0) return sym; } return NULL; } /* Look for symbol in symbol table . * Return a pointer to the symbol or NULL if not found. */ Symbol * find_symbol(SymbolTable * symtab, const char *name) { return search_symbol_list(symtab->bucket[hash(name)], name); } /* If the symbol does not already exist in symbol table , * then add the symbol to the symbol table. * Return a pointer to the symbol. */ Symbol * new_symbol( SymbolTable * symtab, /* symbol table */ const char *name, /* symbol name */ const char *value, /* symbol value */ int flags) /* symbol attributes */ { Symbol *sym; unsigned i; if ((sym = find_symbol(symtab, name)) == NULL) { sym = NEW(Symbol); sym->name = xstrdup(name); i = hash(name); sym->next = symtab->bucket[i]; symtab->bucket[i] = sym; } else { free(sym->value); } sym->value = (value != NULL) ? xstrdup(value) : NULL; sym->flags = (short) flags; return sym; } cproto-4.7t/LICENSE0000644000175100001440000000045713704163034012611 0ustar tomuserscproto is in the public domain; changes made to it by the current maintainer are likewise unrestricted. That applies to most of the files. A few files (currently those related to autoconf scripting) have other licenses (MIT-X11). Current cproto maintainer: Thomas Dickey cproto-4.7t/symbol.h0000644000175100001440000000166611510147525013265 0ustar tomusers/* $Id: symbol.h,v 4.4 2011/01/02 19:17:41 tom Exp $ * * A symbol table is a collection of string identifiers stored in a * hash table. */ #ifndef SYMBOL_H #define SYMBOL_H #include typedef struct symbol { struct symbol *next; /* next symbol in list */ char *name; /* name of symbol */ char *value; /* value of symbol (for defines) */ short flags; /* symbol attributes */ } Symbol; /* The hash table length should be a prime number. */ #define SYM_MAX_HASH 251 typedef struct symbol_table { Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */ } SymbolTable; extern SymbolTable *new_symbol_table /* Create symbol table */ (void); extern void free_symbol_table /* Destroy symbol table */ (SymbolTable *s); extern Symbol *find_symbol /* Lookup symbol name */ (SymbolTable *s, const char *n); extern Symbol *new_symbol /* Define new symbol */ (SymbolTable *s, const char *n, const char *v, int f); #endif cproto-4.7t/config.sub0000755000175100001440000010471414105766526013603 0ustar tomusers#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2021 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2021-08-14' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 basic_os=$field2 ;; zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 basic_os= ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; convex-c1) basic_machine=c1-convex basic_os=bsd ;; convex-c2) basic_machine=c2-convex basic_os=bsd ;; convex-c32) basic_machine=c32-convex basic_os=bsd ;; convex-c34) basic_machine=c34-convex basic_os=bsd ;; convex-c38) basic_machine=c38-convex basic_os=bsd ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next case $basic_os in openstep*) ;; nextstep*) ;; ns2*) basic_os=nextstep2 ;; *) basic_os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x$basic_os != x then # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read kernel os <&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ | linux-musl* | linux-relibc* | linux-uclibc* ) ;; uclinux-uclibc* ) ;; -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) ;; nto-qnx*) ;; os2-emx) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cproto-4.7t/AUTHORS0000644000175100001440000000013711416372254012653 0ustar tomusers-- $Id: AUTHORS,v 4.1 2010/07/11 16:43:24 tom Exp $ cthuang Chin Huang dickey Thomas E. Dickey cproto-4.7t/config_h.in0000644000175100001440000000013605701601743013704 0ustar tomusers/* @configure_input@ */ /* $Id: config_h.in,v 4.2 1995/01/01 19:34:59 cthuang Exp $ */ @DEFS@ cproto-4.7t/grammar.y0000644000175100001440000005312314020026501013407 0ustar tomusers/* $Id: grammar.y,v 4.26 2021/03/04 00:43:45 tom Exp $ * * yacc grammar for C function prototype generator * This was derived from the grammar in Appendix A of * "The C Programming Language" by Kernighan and Ritchie. */ %token '(' '*' '&' /* identifiers that are not reserved words */ T_IDENTIFIER T_TYPEDEF_NAME T_DEFINE_NAME /* storage class */ T_AUTO T_EXTERN T_REGISTER T_STATIC T_TYPEDEF /* This keyword included for compatibility with C++. */ T_INLINE /* These keywords included for compatibility with GCC */ T_EXTENSION T_ATTRIBUTE /* type specifiers */ T_CHAR T_DOUBLE T_FLOAT T_INT T_VOID T_LONG T_SHORT T_SIGNED T_UNSIGNED T_ENUM T_STRUCT T_UNION /* C9X new types */ T_Bool T_Complex T_Imaginary /* nonstandard "gcc" types */ T_LONG_DOUBLE /* type qualifiers */ T_TYPE_QUALIFIER /* paired square brackets and everything between them: [ ... ] */ T_BRACKETS %token /* left brace */ T_LBRACE /* all input to the matching right brace */ T_MATCHRBRACE /* three periods */ T_ELLIPSIS /* constant expression or paired braces following an equal sign */ T_INITIALIZER /* string literal */ T_STRING_LITERAL /* asm */ T_ASM /* ( "string literal" ) following asm keyword */ T_ASMARG /* va_dcl from */ T_VA_DCL %type decl_specifiers decl_specifier %type storage_class type_specifier type_qualifier %type struct_or_union_specifier enum_specifier %type init_declarator_list %type init_declarator declarator direct_declarator %type abs_declarator direct_abs_declarator %type parameter_type_list parameter_list %type parameter_declaration %type opt_identifier_list identifier_list %type struct_or_union pointer opt_type_qualifiers type_qualifier_list any_id identifier_or_ref %type enumeration %{ #include #include #define YYMAXDEPTH 150 extern int yylex(void); /* declaration specifier attributes for the typedef statement currently being * scanned */ static int cur_decl_spec_flags; /* pointer to parameter list for the current function definition */ static ParameterList *func_params; /* A parser semantic action sets this pointer to the current declarator in * a function parameter declaration in order to catch any comments following * the parameter declaration on the same line. If the lexer scans a comment * and is not NULL, then the comment is attached to the * declarator. To ignore subsequent comments, the lexer sets this to NULL * after scanning a comment or end of line. */ static Declarator *cur_declarator; /* temporary string buffer */ static char *temp_buf = 0; static size_t temp_len = 0; /* table of typedef names */ static SymbolTable *typedef_names; /* table of define names */ static SymbolTable *define_names; /* table of type qualifiers */ static SymbolTable *type_qualifiers; /* information about the current input file */ typedef struct { char *base_name; /* base input file name */ char *file_name; /* current file name */ size_t len_file_name; /* ...its allocated size */ FILE *file; /* input file */ unsigned line_num; /* current line number in input file */ FILE *tmp_file; /* temporary file */ long begin_comment; /* tmp file offset after last written ) or ; */ long end_comment; /* tmp file offset after last comment */ boolean convert; /* if TRUE, convert function definitions */ boolean changed; /* TRUE if conversion done in this file */ } IncludeStack; static IncludeStack *cur_file; /* current input file */ #include "yyerror.c" static int haveAnsiParam(void); /* Flags to enable us to find if a procedure returns a value. */ static int return_val, /* nonzero on BRACES iff return-expression found */ returned_at; /* marker for token-number to set 'return_val' */ #if OPT_LINTLIBRARY static const char * dft_decl_spec(void) { return (lintLibrary() && !return_val) ? "void" : "int"; } #else #define dft_decl_spec() "int" #endif static int haveAnsiParam(void) { Parameter *p; if (func_params != 0) { for (p = func_params->first; p != 0; p = p->next) { if (p->declarator->func_def == FUNC_ANSI) { return TRUE; } } } return FALSE; } static void need_temp(size_t need) { if (need > temp_len) { if (need < MAX_TEXT_SIZE) need = MAX_TEXT_SIZE; if (need < temp_len * 2) need = temp_len * 2; temp_buf = type_realloc(char, temp_buf, need); temp_len = need; } } %} %% program : /* empty */ | translation_unit ; translation_unit : external_declaration | translation_unit external_declaration ; external_declaration : declaration | function_definition | ';' | linkage_specification | asm_specifier | error T_MATCHRBRACE { yyerrok; } | error ';' { yyerrok; } ; braces : T_LBRACE T_MATCHRBRACE ; linkage_specification : T_EXTERN T_STRING_LITERAL braces { /* Provide an empty action here so bison will not complain about * incompatible types in the default action it normally would * have generated. */ } | T_EXTERN T_STRING_LITERAL declaration { /* empty */ } ; declaration : decl_specifiers ';' { #if OPT_LINTLIBRARY if (types_out && want_typedef()) { gen_declarations(&$1, (DeclaratorList *)0); flush_varargs(); } #endif free_decl_spec(&$1); end_typedef(); } | decl_specifiers init_declarator_list ';' { if (func_params != NULL) { set_param_types(func_params, &$1, &$2); } else { gen_declarations(&$1, &$2); #if OPT_LINTLIBRARY flush_varargs(); #endif free_decl_list(&$2); } free_decl_spec(&$1); end_typedef(); } | any_typedef decl_specifiers { cur_decl_spec_flags = $2.flags; free_decl_spec(&$2); } opt_declarator_list ';' { end_typedef(); } ; any_typedef : T_EXTENSION T_TYPEDEF { begin_typedef(); } | T_TYPEDEF { begin_typedef(); } ; opt_declarator_list : /* empty */ | declarator_list ; declarator_list : declarator { int flags = cur_decl_spec_flags; /* If the typedef is a pointer type, then reset the short type * flags so it does not get promoted. */ if (strcmp($1->text, $1->name) != 0) flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); new_symbol(typedef_names, $1->name, NULL, flags); free_declarator($1); } | declarator_list ',' declarator { int flags = cur_decl_spec_flags; if (strcmp($3->text, $3->name) != 0) flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); new_symbol(typedef_names, $3->name, NULL, flags); free_declarator($3); } ; function_definition : decl_specifiers declarator { check_untagged(&$1); if ($2->func_def == FUNC_NONE) { yyerror("syntax error"); YYERROR; } func_params = &($2->head->params); func_params->begin_comment = cur_file->begin_comment; func_params->end_comment = cur_file->end_comment; } opt_declaration_list T_LBRACE { /* If we're converting to K&R and we've got a nominally K&R * function which has a parameter which is ANSI (i.e., a prototyped * function pointer), then we must override the deciphered value of * 'func_def' so that the parameter will be converted. */ if (func_style == FUNC_TRADITIONAL && haveAnsiParam() && $2->head->func_def == func_style) { $2->head->func_def = FUNC_BOTH; } func_params = NULL; if (cur_file->convert) gen_func_definition(&$1, $2); gen_prototype(&$1, $2); #if OPT_LINTLIBRARY flush_varargs(); #endif free_decl_spec(&$1); free_declarator($2); } T_MATCHRBRACE | declarator { if ($1->func_def == FUNC_NONE) { yyerror("syntax error"); YYERROR; } func_params = &($1->head->params); func_params->begin_comment = cur_file->begin_comment; func_params->end_comment = cur_file->end_comment; } opt_declaration_list T_LBRACE T_MATCHRBRACE { DeclSpec decl_spec; func_params = NULL; new_decl_spec(&decl_spec, dft_decl_spec(), $1->begin, DS_NONE); if (cur_file->convert) gen_func_definition(&decl_spec, $1); gen_prototype(&decl_spec, $1); #if OPT_LINTLIBRARY flush_varargs(); #endif free_decl_spec(&decl_spec); free_declarator($1); } ; opt_declaration_list : /* empty */ | T_VA_DCL | declaration_list ; declaration_list : declaration | declaration_list declaration ; decl_specifiers : decl_specifier | decl_specifiers decl_specifier { join_decl_specs(&$$, &$1, &$2); free_decl_spec(&$1); free_decl_spec(&$2); } ; decl_specifier : storage_class | type_specifier | type_qualifier ; storage_class : T_AUTO { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_EXTERN { new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN); } | T_REGISTER { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_STATIC { new_decl_spec(&$$, $1.text, $1.begin, DS_STATIC); } | T_INLINE { new_decl_spec(&$$, $1.text, $1.begin, DS_INLINE); } | T_EXTENSION { new_decl_spec(&$$, $1.text, $1.begin, DS_JUNK); } ; type_specifier : T_CHAR { new_decl_spec(&$$, $1.text, $1.begin, DS_CHAR); } | T_DOUBLE { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_LONG_DOUBLE { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_FLOAT { new_decl_spec(&$$, $1.text, $1.begin, DS_FLOAT); } | T_INT { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_LONG { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_SHORT { new_decl_spec(&$$, $1.text, $1.begin, DS_SHORT); } | T_SIGNED { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_UNSIGNED { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_VOID { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_Bool { new_decl_spec(&$$, $1.text, $1.begin, DS_CHAR); } | T_Complex { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_Imaginary { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_TYPEDEF_NAME { Symbol *s; s = find_symbol(typedef_names, $1.text); if (s != NULL) new_decl_spec(&$$, $1.text, $1.begin, s->flags); } | struct_or_union_specifier | enum_specifier ; type_qualifier : T_TYPE_QUALIFIER { new_decl_spec(&$$, $1.text, $1.begin, DS_NONE); } | T_DEFINE_NAME { /* This rule allows the nonterminal to scan #define * names as if they were type modifiers. */ Symbol *s; s = find_symbol(define_names, $1.text); if (s != NULL) new_decl_spec(&$$, $1.text, $1.begin, s->flags); } ; struct_or_union_specifier : struct_or_union any_id braces { char *s; if ((s = implied_typedef()) == 0) { need_temp(2 + strlen($1.text) + strlen($2.text)); (void)sprintf(s = temp_buf, "%s %s", $1.text, $2.text); } new_decl_spec(&$$, s, $1.begin, DS_NONE); } | struct_or_union braces { char *s; if ((s = implied_typedef()) == 0) { need_temp(4 + strlen($1.text)); (void)sprintf(s = temp_buf, "%s {}", $1.text); } new_decl_spec(&$$, s, $1.begin, DS_NONE); } | struct_or_union any_id { need_temp(2 + strlen($1.text) + strlen($2.text)); (void)sprintf(temp_buf, "%s %s", $1.text, $2.text); new_decl_spec(&$$, temp_buf, $1.begin, DS_NONE); } ; struct_or_union : T_STRUCT { imply_typedef($$.text); } | T_UNION { imply_typedef($$.text); } ; init_declarator_list : init_declarator { new_decl_list(&$$, $1); } | init_declarator_list ',' init_declarator { add_decl_list(&$$, &$1, $3); } ; init_declarator : declarator { if ($1->func_def != FUNC_NONE && func_params == NULL && func_style == FUNC_TRADITIONAL && cur_file->convert) { gen_func_declarator($1); fputs(cur_text(), cur_file->tmp_file); } cur_declarator = $$; } | declarator '=' { if ($1->func_def != FUNC_NONE && func_params == NULL && func_style == FUNC_TRADITIONAL && cur_file->convert) { gen_func_declarator($1); fputs(" =", cur_file->tmp_file); } } T_INITIALIZER ; asm_specifier : T_ASM T_ASMARG | parameter_declaration T_ASM T_ASMARG { free_parameter($1); } ; enum_specifier : enumeration any_id braces { char *s; if ((s = implied_typedef()) == 0) { need_temp(6 + strlen($2.text)); (void)sprintf(s = temp_buf, "enum %s", $2.text); } new_decl_spec(&$$, s, $1.begin, DS_NONE); } | enumeration braces { char *s; if ((s = implied_typedef()) == 0) { need_temp(4 + strlen($1.text)); (void)sprintf(s = temp_buf, "%s {}", $1.text); } new_decl_spec(&$$, s, $1.begin, DS_NONE); } | enumeration any_id { need_temp(6 + strlen($2.text)); (void)sprintf(temp_buf, "enum %s", $2.text); new_decl_spec(&$$, temp_buf, $1.begin, DS_NONE); } ; enumeration : T_ENUM { imply_typedef("enum"); $$ = $1; } ; any_id : T_IDENTIFIER | T_TYPEDEF_NAME ; declarator : pointer direct_declarator { $$ = $2; need_temp(1 + strlen($1.text) + strlen($2->text)); (void)sprintf(temp_buf, "%s%s", $1.text, $$->text); free($$->text); $$->text = xstrdup(temp_buf); $$->begin = $1.begin; $$->pointer = TRUE; } | direct_declarator ; direct_declarator : identifier_or_ref { $$ = new_declarator($1.text, $1.text, $1.begin); } | '(' declarator ')' { $$ = $2; need_temp(2 + strlen($2->text)); (void)sprintf(temp_buf, "(%s)", $$->text); free($$->text); $$->text = xstrdup(temp_buf); $$->begin = $1.begin; } | direct_declarator T_BRACKETS { $$ = $1; need_temp(1 + strlen($1->text) + strlen($2.text)); (void)sprintf(temp_buf, "%s%s", $$->text, $2.text); free($$->text); $$->text = xstrdup(temp_buf); } | direct_declarator '(' parameter_type_list ')' { $$ = new_declarator("%s()", $1->name, $1->begin); $$->params = $3; $$->func_stack = $1; $$->head = ($1->func_stack == NULL) ? $$ : $1->head; $$->func_def = FUNC_ANSI; } | direct_declarator '(' opt_identifier_list ')' { $$ = new_declarator("%s()", $1->name, $1->begin); $$->params = $3; $$->func_stack = $1; $$->head = ($1->func_stack == NULL) ? $$ : $1->head; $$->func_def = FUNC_TRADITIONAL; } ; pointer : '*' opt_type_qualifiers { need_temp(2 + strlen($2.text)); (void)sprintf($$.text, "*%.*s", MAX_TEXT_SIZE - 2, $2.text); $$.begin = $1.begin; } | '*' opt_type_qualifiers pointer { need_temp(2 + strlen($2.text) + strlen($3.text)); (void)sprintf($$.text, "*%.*s%.*s", (MAX_TEXT_SIZE / 2) - 2, $2.text, (MAX_TEXT_SIZE / 2) - 2, $3.text); $$.begin = $1.begin; } ; opt_type_qualifiers : /* empty */ { strcpy($$.text, ""); $$.begin = 0L; } | type_qualifier_list ; type_qualifier_list : type_qualifier { need_temp(2 + strlen($1.text)); (void)sprintf($$.text, "%s ", $1.text); $$.begin = $1.begin; free($1.text); } | type_qualifier_list type_qualifier { need_temp(1 + strlen($1.text) + strlen($2.text)); (void)sprintf($$.text, "%.*s%.*s ", (MAX_TEXT_SIZE / 2) - 2, $1.text, (MAX_TEXT_SIZE / 2) - 2, $2.text); $$.begin = $1.begin; free($2.text); } ; parameter_type_list : parameter_list | parameter_list ',' T_ELLIPSIS { add_ident_list(&$$, &$1, "..."); } ; parameter_list : parameter_declaration { new_param_list(&$$, $1); } | parameter_list ',' parameter_declaration { add_param_list(&$$, &$1, $3); } ; parameter_declaration : decl_specifiers declarator { check_untagged(&$1); $$ = new_parameter(&$1, $2); } | decl_specifiers abs_declarator { check_untagged(&$1); $$ = new_parameter(&$1, $2); } | decl_specifiers { check_untagged(&$1); $$ = new_parameter(&$1, (Declarator *)0); } ; opt_identifier_list : /* empty */ { new_ident_list(&$$); } | identifier_list ; identifier_list : any_id { new_ident_list(&$$); add_ident_list(&$$, &$$, $1.text); } | identifier_list ',' any_id { add_ident_list(&$$, &$1, $3.text); } ; identifier_or_ref : any_id { $$ = $1; } | '&' any_id { need_temp(2 + strlen($2.text)); #if OPT_LINTLIBRARY if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */ $$ = $2; } else #endif (void)sprintf($$.text, "&%.*s", MAX_TEXT_SIZE - 2, $2.text); $$.begin = $1.begin; } ; abs_declarator : pointer { $$ = new_declarator($1.text, "", $1.begin); } | pointer direct_abs_declarator { $$ = $2; need_temp(1 + strlen($1.text) + strlen($2->text)); (void)sprintf(temp_buf, "%s%s", $1.text, $$->text); free($$->text); $$->text = xstrdup(temp_buf); $$->begin = $1.begin; } | direct_abs_declarator ; direct_abs_declarator : '(' abs_declarator ')' { $$ = $2; need_temp(3 + strlen($2->text)); (void)sprintf(temp_buf, "(%s)", $$->text); free($$->text); $$->text = xstrdup(temp_buf); $$->begin = $1.begin; } | direct_abs_declarator T_BRACKETS { $$ = $1; need_temp(1 + strlen($1->text) + strlen($2.text)); (void)sprintf(temp_buf, "%s%s", $$->text, $2.text); free($$->text); $$->text = xstrdup(temp_buf); } | T_BRACKETS { $$ = new_declarator($1.text, "", $1.begin); } | direct_abs_declarator '(' parameter_type_list ')' { $$ = new_declarator("%s()", "", $1->begin); $$->params = $3; $$->func_stack = $1; $$->head = ($1->func_stack == NULL) ? $$ : $1->head; $$->func_def = FUNC_ANSI; } | direct_abs_declarator '(' ')' { $$ = new_declarator("%s()", "", $1->begin); $$->func_stack = $1; $$->head = ($1->func_stack == NULL) ? $$ : $1->head; $$->func_def = FUNC_ANSI; } | '(' parameter_type_list ')' { Declarator *d; d = new_declarator("", "", $1.begin); $$ = new_declarator("%s()", "", $1.begin); $$->params = $2; $$->func_stack = d; $$->head = $$; $$->func_def = FUNC_ANSI; } | '(' ')' { Declarator *d; d = new_declarator("", "", $1.begin); $$ = new_declarator("%s()", "", $1.begin); $$->func_stack = d; $$->head = $$; $$->func_def = FUNC_ANSI; } ; %% #if defined(HAVE_CONFIG_H) # include "lex.yy.c" #else #if defined(__EMX__) || defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(vms) # ifdef USE_flex # include "lexyy.c" # else # include "lex_yy.c" # endif #else # include "lex.yy.c" #endif #endif static void yaccError(const char *msg) { func_params = NULL; put_error(); /* tell what line we're on, and what file */ fprintf(stderr, "%s at token '%s'\n", msg, yytext); } /* Initialize the table of type qualifier keywords recognized by the lexical * analyzer. */ void init_parser(void) { static const char *keywords[] = { "const", "restrict", "volatile", "interrupt", #ifdef vms "noshare", "readonly", #endif #if defined(MSDOS) || defined(OS2) "__cdecl", "__export", "__far", "__fastcall", "__fortran", "__huge", "__inline", "__interrupt", "__loadds", "__near", "__pascal", "__saveregs", "__segment", "__stdcall", "__syscall", "_cdecl", "_cs", "_ds", "_es", "_export", "_far", "_fastcall", "_fortran", "_huge", "_interrupt", "_loadds", "_near", "_pascal", "_saveregs", "_seg", "_segment", "_ss", "cdecl", "far", "huge", "near", "pascal", #ifdef OS2 "__far16", #endif #endif #ifdef __GNUC__ /* gcc aliases */ "__builtin_va_arg", "__builtin_va_list", "__const", "__const__", "__gnuc_va_list", "__inline", "__inline__", "__restrict", "__restrict__", "__volatile", "__volatile__", #endif #ifdef __FreeBSD__ "_Noreturn", "_Thread_local", #endif }; unsigned i; /* Initialize type qualifier table. */ type_qualifiers = new_symbol_table(); for (i = 0; i < sizeof(keywords) / sizeof(keywords[0]); ++i) { new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE); } } #ifdef DEBUG_YYIN static FILE * copyfile(FILE *input, const char *name) { FILE *output; char my_filename[1024]; int n; int ch; for (n = 0; n < 999; ++n) { sprintf(my_filename, "%s.gen%03d", name, n); if ((output = fopen(my_filename, "r")) != 0) { fclose(output); } else { break; } } if ((output = fopen(my_filename, "w")) != 0) { while ((ch = fgetc(input)) != EOF) { if (ferror(input)) break; fputc(ch, output); } fclose(output); } return fopen(my_filename, "r"); } #endif /* DEBUG_YYIN */ /* Process the C source file. Write function prototypes to the standard * output. Convert function definitions and write the converted source * code to a temporary file. */ void process_file(FILE *infile, const char *name) { const char *s; if (strlen(name) > 2) { s = name + strlen(name) - 2; if (*s == '.') { ++s; if (*s == 'l' || *s == 'y') BEGIN LEXYACC; #if defined(MSDOS) || defined(OS2) if (*s == 'L' || *s == 'Y') BEGIN LEXYACC; #endif } } included_files = new_symbol_table(); typedef_names = new_symbol_table(); define_names = new_symbol_table(); inc_depth = -1; curly = 0; ly_count = 0; func_params = NULL; #ifdef DEBUG_YYIN yyin = copyfile(infile, name); #else yyin = infile; #endif include_file(strcpy(base_file, name), func_style != FUNC_NONE); if (file_comments) { #if OPT_LINTLIBRARY if (lintLibrary()) { put_blankline(stdout); begin_tracking(); } #endif put_string(stdout, "/* "); put_string(stdout, cur_file_name()); put_string(stdout, " */\n"); } yyparse(); free_symbol_table(define_names); free_symbol_table(typedef_names); free_symbol_table(included_files); } #ifdef NO_LEAKS void free_parser(void) { free_symbol_table(type_qualifiers); #ifdef FLEX_SCANNER if (yy_current_buffer != 0) yy_delete_buffer(yy_current_buffer); #endif if (temp_buf != 0) { temp_buf = 0; temp_len = 0; } } #endif cproto-4.7t/lintlibs.c0000644000175100001440000003561114020017561013563 0ustar tomusers/* $Id: lintlibs.c,v 4.22 2021/03/03 23:44:49 tom Exp $ * * C prototype/lint-library generator * These routines implement the semantic actions for lint libraries executed by * the yacc parser. */ #include #include #if OPT_LINTLIBRARY unsigned in_include; static SymbolTable *include_list; static SymbolTable *declared_list; static int in_typedef; static int blank_lines; /* used to filter blank lines from typedefs */ static int implied_cnt; /* state-count associated with implied_buf */ static char *implied_buf; static char quote_l = '"'; static char quote_r = '"'; /* * Output a string to standard output, keeping track of the trailing newlines * to make it simple to format with blank lines. */ void put_string(FILE *outf, const char *s) { if (*s != '\0') { fputs(s, outf); if (outf == stdout) { /* ensure we aren't doing temp-file! */ while (*s != '\0') { if (*s++ == '\n') blank_lines++; else blank_lines = 0; } } } } /* * Output a single character */ void put_char(FILE *outf, int c) { static char s[] = "?"; s[0] = (char) c; put_string(outf, s); } /* * Write a newline, taking care not to make a blank line */ void put_newline(FILE *outf) { while (!blank_lines) put_string(outf, "\n"); } /* * Make a blank line (limited to 2 successive newlines) */ void put_blankline(FILE *outf) { while (blank_lines < 2) put_string(outf, "\n"); } /* * Put a token, padded by a tab if it is short enough */ void put_padded(FILE *outf, const char *s) { put_string(outf, s); put_char(outf, (lintLibrary() && strlen(s) < 8) ? '\t' : ' '); } /* * Format lint-library so that we put a blank line before each item that may * take up multiple lines: * 0) functions * 1) typedefs (explicit and implied) * as well as when transitioning to * 2) variable declarations * * If the "-T" option is set, we skip a blank line around typedefs. */ void fmt_library(int code) { if (lintLibrary() || types_out) { static int save; if (!lintLibrary() && code == 0) code = 3; if (code <= 1 || code != save) put_blankline(stdout); save = code; } } /* * conversion for names so test-diffs are less * (patch: should use relpath) */ static char * strip_name(char *s) { #ifdef vms static char stripped[BUFSIZ]; auto int len = strlen(getwd(stripped)); if (strlen(s) > len && !strncmp(s, stripped, len)) s += len; s = (vms2name(stripped, s)); #else static char GccLeaf[] = "/gcc-lib/"; static char IncLeaf[] = "/include/"; char *t; unsigned n; size_t len; int standard = FALSE; for (n = 1; n < num_inc_dir; n++) { len = strlen(inc_dir[n]); if (!strncmp(inc_dir[n], s, len) && is_path_sep(s[len])) { standard = TRUE; s += len + 1; quote_l = '<'; quote_r = '>'; break; } } if (!standard) { quote_l = quote_r = '"'; if (*s == '.' && is_path_sep(s[1])) s += 2; else if ((t = strstr(s, GccLeaf)) != 0 && (t = strstr(t, IncLeaf)) != 0) { s = t + sizeof(IncLeaf) - 1; quote_l = '<'; quote_r = '>'; } } #endif return s; } #define CUR_FILE strip_name(cur_file_name()) static unsigned base_level; static unsigned inc_depth = 0; static char **inc_stack = 0; static char * get_inc_stack(unsigned n) { return (((int) n) < 0 || n >= inc_depth) ? 0 : inc_stack[n]; } #ifdef DEBUG static void dump_stack(char *tag) { unsigned j; printf("/* stack%s:%s", tag, cur_file_name()); for (j = 0; j <= in_include; j++) printf("\n\t%d%s:%s", j, j == base_level ? "*" : "", get_inc_stack(j) ? get_inc_stack(j) : "?"); printf(" */\n"); } #endif /* DEBUG */ static void free_inc_stack(unsigned n) { if (get_inc_stack(n) != 0) { free(inc_stack[n]); inc_stack[n] = 0; } } static void make_inc_stack(unsigned n, char *s) { if (n != 0) { unsigned need = (n | 31) + 1; free_inc_stack(n); if (n > inc_depth) { inc_stack = type_realloc(char *, inc_stack, need); while (inc_depth < need) inc_stack[inc_depth++] = 0; inc_depth = need; } inc_stack[n] = xstrdup(s); } } /* * Keep track of include-files so that we only include each once. */ static int already_included(char *path) { if (!include_list) include_list = new_symbol_table(); if (find_symbol(include_list, path) != NULL) return TRUE; new_symbol(include_list, path, NULL, DS_NONE); return FALSE; } /* * Keep track of variables that may have been implicitly declared via * include-files so that we declare them only once in the lint library * output. */ int already_declared(char *name) { if (declared_list == 0) declared_list = new_symbol_table(); if (find_symbol(declared_list, name) == 0) { (void) new_symbol(declared_list, name, 0, 0); return FALSE; } return TRUE; } /* * Initialize state for 'track_in()' */ static int InitTracking; void begin_tracking(void) { InitTracking = FALSE; } static int c_suffix(char *path) { char *last = path + strlen(path); #ifdef vms char *vers = strrchr(path, ';'); if (vers != 0) last = vers; #endif return ((last - path) > 2 && !strcmp(last - 2, ".c")); } /* * Keep track of "include files" that we always want to filter out (ignore). */ static int ignored(char *path) { if (strcmp(path, "") == 0 || strcmp(path, "") == 0) return TRUE; return FALSE; } static const char * skip_dot(const char *a) { if (a != NULL && !strncmp(a, "./", (size_t) 2)) a += 2; return a; } static int same_file(const char *a, const char *b) { return (a != NULL && b != NULL) ? !strcmp(skip_dot(a), skip_dot(b)) : 0; } /* * For lint-library, we want to keep track of what file we are in so that we * can generate appropriate comments and include-statements. * * The main program 'cproto' is invoked with 'cpp' once for each C-file, * relying on it to spit out "#" comments which identify the name and line * number of each processed file. After the first '#' comment, all others * refer to included files. */ void track_in(void) { static char old_file[MAX_TEXT_SIZE]; /* from last call */ auto int show = lintLibrary(); if (!show && !do_tracking && !debug_trace) return; #ifdef DEBUG printf("/* track_in: in_include=%d line_num=%d base_file=%s */\n", in_include, cur_line_num(), base_file); dump_stack("-before"); #endif /* DEBUG */ if (cur_line_num() == 0) { /* begin new (nested?) file */ if (!InitTracking) { InitTracking = TRUE; /* yacc may omit first cpp-line! */ in_include = base_level = (unsigned) !same_file(cur_file_name(), base_file); make_inc_stack(0, base_file); } else if (same_file(cur_file_name(), base_file)) { flush_varargs(); in_include = 0; /* reset level */ } else { make_inc_stack(in_include, old_file); if (in_include++ == 0) { char *s = CUR_FILE; if (show && !already_included(s) && !ignored(s)) { fmt_library(4); put_string(stdout, "#include "); put_char(stdout, quote_l); put_string(stdout, s); put_char(stdout, quote_r); put_newline(stdout); } if (debug_trace) fprintf(stderr, "++ %s\n", cur_file_name()); } make_inc_stack(in_include, cur_file_name()); } (void) strcpy(old_file, cur_file_name()); } else if (same_file(cur_file_name(), base_file)) { in_include = 0; /* kludgy bison! */ (void) strcpy(old_file, cur_file_name()); } else if (!same_file(old_file, cur_file_name())) { /* continue/unnest ? */ unsigned n; int found; char *s = cur_file_name(); #ifdef DEBUG char temp[80]; #endif char *inc_file; flush_varargs(); for (n = in_include, found = FALSE; (int) n >= 0; n--) { if (same_file(get_inc_stack(n), s)) { found = TRUE; in_include--; break; } } if (!found) { /* * There's two kinds of broken programs that can cause * us to lose sync at this point: (1) programs such as * yacc that don't reference the grammar file, instead * referencing the generated file, and (2) broken * preprocessors (such as on OSF/1) that neglect to * report line #1 on headers that are rejected due to * prior inclusion. * * If the source file's extension is ".h", we'll assume * the latter case (i.e., just report it). The former * case requires that we reset the stack. */ #ifdef DEBUG sprintf(temp, "/* lost sync @%d: ", cur_line_num() + 1); put_blankline(stdout); put_string(stdout, temp); put_string(stdout, s); put_string(stdout, " */\n"); #endif if (in_include == 1 && c_suffix(s)) { /* yacc did it again! */ in_include = 0; make_inc_stack(in_include, strcpy(base_file, s)); #ifdef DEBUG put_string(stdout, "/* processed "); put_string(stdout, s); put_string(stdout, " */\n"); #endif } } inc_file = get_inc_stack(in_include); (void) strcpy(old_file, inc_file ? inc_file : ""); } #ifdef DEBUG dump_stack("-after"); #endif /* DEBUG */ } /* * Copy/append to 'implied_buf[]' */ static void add2implied_buf(const char *s, int append) { static size_t implied_len; /* current strlen(implied_buf) */ static size_t implied_max; /* maximum size of implied_buf */ if (!append) implied_len = 0; implied_len += strlen(s); if (implied_buf == 0) *(implied_buf = (char *) malloc(implied_max = BUFSIZ)) = '\0'; if (implied_max < implied_len + 2) implied_buf = (char *) realloc(implied_buf, implied_max += implied_len + 2); if (!append) *implied_buf = '\0'; (void) strcat(implied_buf, s); } /* * If the "-t" option is set (or if we are generating a lint-library), we * intercept tokens which are part of a typedef, copying them to the output. * * The 'imply_typedef()' entrypoint is called from the grammar for the special * cases of struct/union/enum when we expect to be getting curly-braces which * define the structure. If no curly-braces are found by the end of the * rule, we can discard the buffer. */ int want_typedef(void) { if (lintLibrary()) { if (in_include == 0) return (TRUE); } else if (types_out) { return (TRUE); } return (FALSE); } void begin_typedef(void) { if (want_typedef()) { in_typedef = TRUE; fmt_library(1); copy_typedef("typedef"); } } void copy_typedef(const char *s) { if (!strcmp(s, "/*") || *s == '#') ; /* ignore */ else if (in_typedef) { if (*s == '\n') put_newline(stdout); else put_string(stdout, s); } else if (implied_cnt > 0) { /* "KEY ID {" ? */ add2implied_buf(s, TRUE); if (!isspace(UCH(*s))) implied_cnt--; if ((implied_cnt == 2 || implied_cnt == 1) && !strcmp(s, "{")) { implied_cnt = 9999; } } } void end_typedef(void) { copy_typedef("\n"); in_typedef = FALSE; (void) implied_typedef(); } void imply_typedef(const char *s) { if (!in_typedef && want_typedef()) { add2implied_buf(s, FALSE); implied_cnt = 3; } } char * implied_typedef(void) { if (implied_cnt > 0) { implied_cnt = 0; return (implied_buf); } return (0); } /* * Indent lint-library stuff to make it readable */ void indent(FILE *outf) { put_string(outf, "\n\t\t"); } /* Test for the special case of an ellipsis-parameter when trying to make a * lint-library */ int lint_ellipsis(Parameter * p) { return (knrLintLibrary() && (!strcmp(p->declarator->name, ELLIPSIS))); } /* * Reset the data used for "VARARGS" comment. Actually, reset almost any * special attribute that's attached to a function, so we don't accidentally * propagate it to the next function (or data) to be output. */ void flush_varargs(void) { exitlike_func = FALSE; varargs_num = 0; if (varargs_str != 0) { free(varargs_str); varargs_str = 0; } } /* If either we received a "VARARGS" comment in the lexical scanner, or if the * parameter list contains an ellipsis, generate a corresponding "VARARGS" * comment for lint-library output. */ void ellipsis_varargs(Declarator * d) { int count; Parameter *p; fmt_library(0); for (p = d->params.first, count = 0; p != 0; p = p->next, count++) if (lint_ellipsis(p)) { varargs_num = count; break; } if (varargs_num != 0) { put_string(stdout, "\t/* VARARGS"); if (varargs_num > 0) { printf("%d", varargs_num); if (varargs_str != 0) { put_char(stdout, ' '); put_string(stdout, varargs_str); } } flush_varargs(); put_string(stdout, " */\n"); } } /* (Attempt to) create a parameter name for lint-library applications in which * we are starting from a function prototype which has no explicit parameter * name. */ char * supply_parm(int count) { static char temp[80]; (void) sprintf(temp, "p%d", count); while (is_typedef_name(temp) && (strlen(temp) < sizeof(temp) - 1)) (void) strcat(temp, "_"); return (temp); } /* * (Attempt to) distinguish between declarators for functions and for * function pointers. */ int is_actual_func(Declarator * d) { if (lintLibrary() && (d->func_def != FUNC_NONE)) { if (d->func_stack->text[0] == PAREN_L && d->func_stack->text[1] == '*') { if (strstr(d->func_stack->text, "()") != 0) return TRUE; } else { return TRUE; } } return FALSE; } /* * Output the body (or terminating semicolon) of a procedure */ void put_body( FILE *outf, DeclSpec * decl_spec, /* declaration specifier */ Declarator * declarator) { const char *spec_text; if (is_actual_func(declarator)) { strcut(decl_spec->text, "static"); strcut(decl_spec->text, "extern"); indent(outf); put_char(outf, CURL_L); if (!*(spec_text = decl_spec->text)) spec_text = "void"; if (exitlike_func) { put_string(outf, " for(;;); /* no return */ "); } else if (!strcmp(spec_text, "void") && declarator->text[0] != '*' && declarator->func_stack->func_def == FUNC_NONE) { put_string(outf, " /* void */ "); } else { put_string(outf, " return(*("); if (declarator->func_stack->func_def == FUNC_NONE) { put_string(outf, spec_text); put_char(outf, ' '); if (declarator->pointer) { char *s = declarator->text; while (*s++ == '*') put_char(outf, '*'); } put_char(outf, '*'); } else { put_string(outf, spec_text); put_string(outf, "(*)()"); } put_string(outf, ")0); "); } put_char(outf, CURL_R); } else { if (proto_style == PROTO_LINTLIBRARY || proto_style == PROTO_ANSI_LLIB) { /* SVR4 lint complains if we declare const data without an * initializer. */ if (strkey(decl_spec->text, "const") != NULL || strkey(declarator->text, "const") != NULL) { put_string(outf, " = {0}"); } } put_string(outf, ";"); } put_newline(outf); exitlike_func = FALSE; } #ifdef NO_LEAKS void free_lintlibs(void) { unsigned n; if (implied_buf != 0) free(implied_buf); if (inc_stack != 0) { for (n = 0; n < inc_depth; n++) free_inc_stack(n); free(inc_stack); } if (include_list != 0) free_symbol_table(include_list); if (declared_list != 0) free_symbol_table(declared_list); } #endif #endif /* OPT_LINTLIBRARY */ cproto-4.7t/cproto.h0000644000175100001440000002535713776624326013310 0ustar tomusers/* $Id: cproto.h,v 4.21 2021/01/10 16:18:30 tom Exp $ * * Declarations for C function prototype generator */ #ifndef CPROTO_H #define CPROTO_H #ifdef HAVE_CONFIG_H #include #endif #ifndef BISON_HAS_YYTNAME #define BISON_HAS_YYTNAME 0 #endif #ifndef YACC_HAS_YYNAME #define YACC_HAS_YYNAME 0 #endif #ifndef YACC_HAS_YYTOKS #define YACC_HAS_YYTOKS 0 #endif #ifndef YACC_HAS_YYTOKS_2 #define YACC_HAS_YYTOKS_2 0 #endif #ifndef HAVE_LINK #define HAVE_LINK 0 #endif #ifndef HAVE_POPEN_PROTOTYPE #define HAVE_POPEN_PROTOTYPE 0 #endif #ifndef HAVE_LIBDBMALLOC #define HAVE_LIBDBMALLOC 0 #endif #ifndef HAVE_LIBDMALLOC #define HAVE_LIBDMALLOC 0 #endif #include #ifndef GCC_PRINTFLIKE #if defined(GCC_PRINTF) && !defined(printf) #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) #else #define GCC_PRINTFLIKE(fmt,var) /*nothing */ #endif #endif #ifndef GCC_SCANFLIKE #if defined(GCC_SCANF) && !defined(scanf) #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) #else #define GCC_SCANFLIKE(fmt,var) /*nothing */ #endif #endif #ifndef GCC_NORETURN #define GCC_NORETURN /* nothing */ #endif #ifndef GCC_UNUSED #define GCC_UNUSED /* nothing */ #endif #if HAVE_LIBDMALLOC || HAVE_LIBDBMALLOC || defined(DOALLOC) #undef NO_LEAKS #define NO_LEAKS 1 #endif #ifdef lint #define NEW(type) (type *)0 #else #define NEW(type) (type *)xmalloc(sizeof(type)) #endif #ifndef UCH #define UCH(c) ((unsigned char)(c)) #endif /* Useful constants (mainly to avoid problems balancing parentheses...) */ #define ELLIPSIS "..." #define PAREN_L '(' #define PAREN_R ')' #define SQUARE_L '[' #define SQUARE_R ']' #define CURL_L '{' #define CURL_R '}' #define COMMENT_BEGIN "/*" #define COMMENT_END "*/" /* Boolean type */ typedef char boolean; /* Source file text */ typedef struct text { char text[MAX_TEXT_SIZE]; /* source text */ long begin; /* offset in temporary file */ } Text; /* This is a list of function parameters. */ typedef struct parameter_list { struct parameter *first; /* pointer to first parameter in list */ struct parameter *last; /* pointer to last parameter in list */ long begin_comment; /* begin offset of comment */ long end_comment; /* end offset of comment */ char *comment; /* comment at start of parameter list */ } ParameterList; /* Declaration specifier flags */ #define DS_NONE 0 /* default */ #define DS_EXTERN 1 /* contains "extern" specifier */ #define DS_STATIC 2 /* contains "static" specifier */ #define DS_CHAR 4 /* contains "char" type specifier */ #define DS_SHORT 8 /* contains "short" type specifier */ #define DS_FLOAT 16 /* contains "float" type specifier */ #define DS_INLINE 32 /* contains "inline" specifier */ #define DS_JUNK 64 /* we're not interested in this declaration */ /* This structure stores information about a declaration specifier. */ typedef struct decl_spec { unsigned short flags; /* flags defined above */ char *text; /* source text */ long begin; /* offset in temporary file */ } DeclSpec; /* Styles of function definitions */ #if OPT_LINTLIBRARY #define FUNC_UNKNOWN -1 /* unspecified */ #else #define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */ #endif #define FUNC_NONE 0 /* not a function definition */ #define FUNC_TRADITIONAL 1 /* traditional style */ #define FUNC_ANSI 2 /* ANSI style */ #define FUNC_BOTH 3 /* both styles */ typedef int FuncDefStyle; /* This structure stores information about a declarator. */ typedef struct declarator { char *name; /* name of variable or function */ char *text; /* source text */ long begin; /* offset in temporary file */ long begin_comment; /* begin offset of comment */ long end_comment; /* end offset of comment */ FuncDefStyle func_def; /* style of function definition */ ParameterList params; /* function parameters */ boolean pointer; /* TRUE if it declares a pointer */ struct declarator *head; /* head function declarator */ struct declarator *func_stack; /* stack of function declarators */ struct declarator *next; /* next declarator in list */ } Declarator; /* This is a list of declarators. */ typedef struct declarator_list { Declarator *first; /* pointer to first declarator in list */ Declarator *last; /* pointer to last declarator in list */ } DeclaratorList; /* This structure stores information about a function parameter. */ typedef struct parameter { struct parameter *next; /* next parameter in list */ DeclSpec decl_spec; Declarator *declarator; char *comment; /* comment following the parameter */ } Parameter; /* parser stack entry type */ typedef union { Text text; DeclSpec decl_spec; Parameter *parameter; ParameterList param_list; Declarator *declarator; DeclaratorList decl_list; } YYSTYPE; /* Prototype styles */ #if OPT_LINTLIBRARY #define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */ #define PROTO_LINTLIBRARY -1 /* form lint-library source */ #endif #define PROTO_NONE 0 /* do not output any prototypes */ #define PROTO_TRADITIONAL 1 /* comment out parameters */ #define PROTO_ABSTRACT 2 /* comment out parameter names */ #define PROTO_ANSI 3 /* ANSI C prototype */ typedef int PrototypeStyle; #define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB) #define knrLintLibrary() (proto_style == PROTO_LINTLIBRARY) #define lintLibrary() (knrLintLibrary() || ansiLintLibrary()) /* The role of a function declarator */ #define FUNC_OTHER 0 /* miscellaneous declaration */ #define FUNC_PROTO 1 /* prototype */ #define FUNC_DEF 2 /* function definition */ typedef int FuncDeclRole; /* Prototype/function definition output formats */ #define FMT_OTHER 0 /* miscellaneous */ #define FMT_PROTO 1 /* prototype */ #define FMT_FUNC 2 /* function definition */ #define FMT_FUNC_COMMENT 3 /* func. def. with parameter comments */ typedef int FuncFormatType; /* select scope of declarations to output */ #define SCOPE_STATIC 1 /* only output declarations with local scope */ #define SCOPE_EXTERN 2 /* only output declarations with global scope */ #define SCOPE_ALL 3 /* output all declarations */ typedef int Scope; /* Prototype/function definition output format */ typedef struct func_format { const char *decl_spec_prefix; /* output before declaration specifier */ const char *declarator_prefix; /* output before declarator name */ const char *declarator_suffix; /* output before '(' of parameter list */ const char *first_param_prefix; /* output before first parameter */ const char *middle_param_prefix; /* output before each subsequent parameter */ const char *last_param_suffix; /* output after last parameter */ } FuncFormat; /* Program options */ extern boolean extern_out; extern Scope scope_out; extern boolean inline_out; #if OPT_LINTLIBRARY extern boolean types_out; extern boolean lint_shadowed; #endif extern boolean variables_out; extern boolean promote_param; extern PrototypeStyle proto_style; extern FuncDefStyle func_style; extern boolean proto_macro; extern boolean define_macro; extern const char *macro_name; extern const char *void_name; extern boolean proto_comments; extern boolean file_comments; extern boolean quiet; extern const char *func_directive; extern unsigned num_inc_dir; extern char **inc_dir; extern FuncFormat fmt[4]; /* Global declarations */ extern char *progname; extern int varargs_num; /* supports varargs-comment */ extern char *varargs_str; /* additional info, such as PRINTFLIKEnn */ extern unsigned extern_in; /* supports "LINT_EXTERNnn" */ extern int do_tracking; /* supports "-X" option */ extern int exitlike_func; /* supports noreturn-attribute */ extern unsigned in_include; /* current include-level */ extern int debug_trace; extern char base_file[]; /* cproto.c */ #if HAVE_LIBDBMALLOC extern void ExitProgram(int code); #define exit(code) ExitProgram(code) #endif #if !HAVE_LIBDMALLOC #ifdef NO_LEAKS extern void *xRealloc(void *p, size_t n, char *f, int l); extern void *xMalloc(size_t n, char *f, int l); extern char *xStrdup(const char *s, char *f, int l); #define xrealloc(p,n) xRealloc(p, n, __FILE__, __LINE__) #define xmalloc(n) xMalloc(n, __FILE__, __LINE__) #define xstrdup(s) xStrdup(s, __FILE__, __LINE__) #else extern void *xrealloc(void *p, size_t n); extern void *xmalloc(size_t n); extern char *xstrdup(const char *src); #endif #endif /* !HAVE_LIBDMALLOC */ extern void put_error(void); extern int is_path_sep(int ch); extern char *trim_path_sep(char *s); /* lintlibs.c */ #if OPT_LINTLIBRARY extern void put_string(FILE *outf, const char *s); extern void put_char(FILE *outf, int c); extern void put_newline(FILE *outf); extern void put_blankline(FILE *outf); extern void put_padded(FILE *outf, const char *s); extern void fmt_library(int code); extern void begin_tracking(void); extern int already_declared(char *name); extern void track_in(void); extern int want_typedef(void); extern void begin_typedef(void); extern void copy_typedef(const char *s); extern void end_typedef(void); extern void imply_typedef(const char *s); extern char *implied_typedef(void); extern void indent(FILE *outf); extern int lint_ellipsis(Parameter * p); #if OPT_LINTLIBRARY extern void flush_varargs(void); #else #define flush_varargs() /* nothing */ #endif extern void ellipsis_varargs(Declarator * d); extern char *supply_parm(int count); extern int is_actual_func(Declarator * d); extern void put_body(FILE *outf, DeclSpec * decl_spec, Declarator * declarator); # ifdef NO_LEAKS extern void free_lintlibs(void); # endif #else #define put_string(fp,S) fputs(S, fp) #define put_char(fp,C) fputc(C, fp) #define put_padded(fp,S) fprintf(fp, "%s ", S) #define put_body(fp,s,d) put_string(fp,";\n") #define track_in() #define begin_typedef() #define copy_typedef() #define end_typedef() #define imply_typedef(s) #define implied_typedef() ((char *)0) #endif /* strkey.c */ extern char *strkey(char *src, const char *key); extern void strcut(char *src, const char *key); /* grammar.y */ extern boolean is_typedef_name(char *name); extern char *cur_file_name(void); extern unsigned cur_line_num(void); extern FILE *cur_tmp_file(void); extern void cur_file_changed(void); extern long cur_begin_comment(void); extern char *cur_text(void); extern void pop_file(int closed); extern void init_parser(void); extern void process_file(FILE *infile, const char *name); #ifdef NO_LEAKS extern void free_lexer(void); extern void free_parser(void); #endif /* workaround for one of the bugs in bison 1.875 */ #ifdef YYBISON #define YYSTYPE YYSTYPE #endif #ifdef HAVE_MKSTEMP #define call_mktemp(s) (mkstemp(s) >= 0) #else #define call_mktemp(s) (mktemp(s) != NULL) #endif #define type_realloc(type,ptr,size) \ (((ptr) != 0) \ ? (type *) xrealloc(ptr, (size) * sizeof(type)) \ : (type *) xmalloc((size) * sizeof(type))) #endif /* CPROTO_H */ cproto-4.7t/semantic.c0000644000175100001440000007371213776627415013600 0ustar tomusers/* $Id: semantic.c,v 4.20 2021/01/10 16:45:01 tom Exp $ * * Semantic actions executed by the parser of the * C function prototype generator. */ #include #if OPT_LINTLIBRARY #define putParameter(fp,p,f,n,c) put_parameter(fp, p, f, n, c) #else #define putParameter(fp,p,f,n,c) put_parameter(fp, p, c) #endif static void put_declarator(FILE *outf, Declarator * declarator, int commented); /* Head function declarator in a prototype or function definition */ static Declarator *func_declarator; /* Role of the function declarator * FUNC_PROTO if it is the declarator in a function prototype. * FUNC_DEF if it is the declarator in a function definition. */ static int where; /* Output format to use */ static int format; /* Function-parameter level, used to simplify logic that comments/suppresses * function parameters in the output. */ static int nestedParams; /* Initialize a new declaration specifier part. */ void new_decl_spec(DeclSpec * decl_spec, const char *text, long offset, int flags) { #if OPT_LINTLIBRARY if (lintLibrary()) { if (!strcmp(text, "register")) text = ""; } #endif decl_spec->text = xstrdup(text); decl_spec->begin = offset; decl_spec->flags = (unsigned short) flags; } /* Free storage used by a declaration specifier part. */ void free_decl_spec(DeclSpec * decl_spec) { free(decl_spec->text); } /* Create a new string by joining two strings with a space between them. * Return a pointer to the resultant string. * If out of memory, output an error message and exit. */ static char * concat_string(char *a, char *b) { char *result; result = (char *) xmalloc(strlen(a) + strlen(b) + 2); strcpy(result, a); strcat(result, " "); strcat(result, b); return result; } #if OPT_LINTLIBRARY /* concatenate w/o embedded blank */ static char * glue_strings(char *a, char *b) { char *result; result = (char *) xmalloc(strlen(a) + strlen(b) + 2); strcpy(result, a); strcat(result, b); return result; } #endif /* Append two declaration specifier parts together. */ void join_decl_specs(DeclSpec * result, DeclSpec * a, DeclSpec * b) { result->text = concat_string(a->text, b->text); result->flags = a->flags | b->flags; result->begin = a->begin; /* don't free the old text value - this is only used in one case where * the 'a' parameter holds the same data as 'result' did. */ } /* Output an error message if the declaration specifier is an untagged * struct, union or enum. */ void check_untagged(DeclSpec * decl_spec) { if (strstr(decl_spec->text, "struct {}") != NULL) { put_error(); fputs("untagged struct declaration\n", stderr); } else if (strstr(decl_spec->text, "union {}") != NULL) { put_error(); fputs("untagged union declaration\n", stderr); } else if (strstr(decl_spec->text, "enum {}") != NULL) { put_error(); fputs("untagged enum declaration\n", stderr); } } /* Allocate and initialize a declarator. */ Declarator * new_declarator(const char *text, const char *name, long offset) { Declarator *d; d = NEW(Declarator); d->text = xstrdup(text); d->name = xstrdup(name); d->begin = offset; d->begin_comment = d->end_comment = 0; d->func_def = FUNC_NONE; new_ident_list(&d->params); d->head = d; d->func_stack = NULL; d->pointer = FALSE; return d; } /* Free storage used by a declarator. */ void free_declarator(Declarator * d) { free(d->text); free(d->name); free_param_list(&d->params); if (d->func_stack != NULL) free_declarator(d->func_stack); free(d); } /* Initialize a declarator list and add the given declarator to it. */ void new_decl_list(DeclaratorList * decl_list, Declarator * declarator) { decl_list->first = decl_list->last = declarator; declarator->next = NULL; } /* Free storage used by the declarators in the declarator list. */ void free_decl_list(DeclaratorList * decl_list) { Declarator *d, *next; d = decl_list->first; while (d != NULL) { next = d->next; free_declarator(d); d = next; } } /* Add the declarator to the declarator list. */ void add_decl_list(DeclaratorList * to, DeclaratorList * from, Declarator * declarator) { to->first = from->first; from->last->next = declarator; to->last = declarator; to->last->next = NULL; } /* Create a new parameter structure. */ Parameter * new_parameter(DeclSpec * decl_spec, Declarator * declarator) { Parameter *param; param = NEW(Parameter); if (decl_spec == NULL) { new_decl_spec(¶m->decl_spec, "", 0L, DS_NONE); } else { param->decl_spec = *decl_spec; } if (declarator == NULL) { declarator = new_declarator("", "", 0L); } param->declarator = declarator; param->comment = NULL; return param; } /* Free the storage used by the parameter. */ void free_parameter(Parameter * param) { free_decl_spec(¶m->decl_spec); free_declarator(param->declarator); if (param->comment != NULL) free(param->comment); free(param); } /* Return TRUE if the parameter is void. */ static boolean is_void_parameter(Parameter * p) { return (boolean) ((p == NULL) || (strcmp(p->decl_spec.text, "void") == 0 && p->declarator->text[0] == '\0')); } /* Initialize a list of function parameters. */ void new_param_list(ParameterList * param_list, Parameter * param) { param_list->first = param_list->last = param; param->next = NULL; param_list->begin_comment = param_list->end_comment = 0; param_list->comment = NULL; } /* Free storage used by the elements in the function parameter list. */ void free_param_list(ParameterList * param_list) { Parameter *p, *next; p = param_list->first; while (p != NULL) { next = p->next; free_parameter(p); p = next; } if (param_list->comment != NULL) free(param_list->comment); } /* Add the parameter to the function parameter list. */ void add_param_list(ParameterList * to, ParameterList * from, Parameter * param) { to->first = from->first; from->last->next = param; to->last = param; param->next = NULL; } /* Initialize an empty list of function parameter names. */ void new_ident_list(ParameterList * param_list) { param_list->first = param_list->last = NULL; param_list->begin_comment = param_list->end_comment = 0; param_list->comment = NULL; } /* Add an item to the list of function parameter declarations but set only * the parameter name field. */ void add_ident_list(ParameterList * to, ParameterList * from, const char *name) { Parameter *p; Declarator *declarator; declarator = new_declarator(name, name, 0L); p = new_parameter((DeclSpec *) 0, declarator); to->first = from->first; if (to->first == NULL) { to->first = p; } else { from->last->next = p; } to->last = p; p->next = NULL; } /* Search the list of parameters for a matching parameter name. * Return a pointer to the matching parameter or NULL if not found. */ static Parameter * search_parameter_list(ParameterList * params, char *name) { Parameter *p; for (p = params->first; p != NULL; p = p->next) { if (strcmp(p->declarator->name, name) == 0) return p; } return (Parameter *) NULL; } /* For each name in the declarator list , set the declaration * specifier part of the parameter in having the same name. * This is also where we promote formal parameters. Parameters of type * "char", "unsigned char", "short", or "unsigned short" are promoted to * "int". Parameters of type "float" are promoted to "double". */ void set_param_types(ParameterList * params, DeclSpec * decl_spec, DeclaratorList * declarators) { Declarator *d; Parameter *p; const char *decl_spec_text; for (d = declarators->first; d != NULL; d = d->next) { /* Search the parameter list for a matching name. */ if ((p = search_parameter_list(params, d->name)) == NULL) { put_error(); fprintf(stderr, "declared argument \"%s\" is missing\n", d->name); } else { decl_spec_text = decl_spec->text; if (promote_param && strcmp(d->text, d->name) == 0) { if (decl_spec->flags & (DS_CHAR | DS_SHORT)) decl_spec_text = "int"; else if (decl_spec->flags & DS_FLOAT) decl_spec_text = "double"; } free(p->decl_spec.text); p->decl_spec.text = xstrdup(decl_spec_text); free_declarator(p->declarator); p->declarator = d; } } } /* Output a function parameter. */ static int put_parameter(FILE *outf, Parameter * p, #if OPT_LINTLIBRARY int name_only, /* nonzero if we only show the parameter name */ int count, /* index in parameter list if we haven't names */ #endif int commented) /* comment-delimiters already from higher level */ { const char *s2; char gap = ' '; #if OPT_LINTLIBRARY if (name_only) { char *s = p->declarator->name; if (lintLibrary()) { while (*s == '*') s++; if (*s == '\0' && !is_void_parameter(p)) s = supply_parm(count); } put_string(outf, s); /* ... remainder of p->declarator.name */ return (TRUE); } #endif s2 = p->decl_spec.text; #if OPT_LINTLIBRARY if (lintLibrary()) { if (is_void_parameter(p)) return (FALSE); indent(outf); if (knrLintLibrary() && !*s2) s2 = "int"; if (strlen(s2) < 8) gap = '\t'; } #endif put_string(outf, s2); #if OPT_LINTLIBRARY if (lintLibrary()) { char *t, *u; char *s = p->declarator->text; while (*s == '*') s++; if (*s == '\0') { u = p->declarator->text; p->declarator->text = glue_strings(u, supply_parm(count)); free(u); } else if (p->declarator->name[0] == '\0') { if ((t = strstr(s, "%s")) != 0) { int parenthesized = FALSE; Declarator *q; free(p->declarator->name); p->declarator->name = xstrdup(supply_parm(count)); for (q = p->declarator; q != 0; q = q->func_stack) { if (q->func_def == FUNC_NONE) { if (!strcmp(q->text, "(*)")) { char temp[20]; sprintf(temp, "(*%s)", p->declarator->name); free(q->text); q->text = xstrdup(temp); parenthesized = TRUE; } else { free(q->text); q->text = xstrdup(p->declarator->name); } break; } } if (!parenthesized) { if (strchr(t, PAREN_L) != 0) { /* e.g., "*%s()" */ t = p->declarator->text; u = (char *) xmalloc(strlen(t) + 3); (void) sprintf(u, "(%s)", t); p->declarator->text = u; free(t); } } } else { /* e.g., s is "[20]" for "char [20]" parameter */ /* ...or something like "* const *" */ while (*s != '\0' && *s != SQUARE_L) s++; u = xstrdup(s); /* the "[20]" */ *s = '\0'; if (s != p->declarator->text) { s = glue_strings(p->declarator->text, supply_parm(count)); } else { s = xstrdup(supply_parm(count)); } t = p->declarator->text; p->declarator->text = glue_strings(s, u); free(u); free(s); free(t); } } } #endif if (p->declarator->text[0] != '\0') { if (strcmp(p->declarator->text, ELLIPSIS) == 0) { put_string(outf, ELLIPSIS); } else { if (proto_style != PROTO_ABSTRACT || proto_comments || where != FUNC_PROTO || strcmp(p->declarator->text, p->declarator->name) != 0) put_char(outf, gap); put_declarator(outf, p->declarator, commented); } } return (TRUE); } /* Check for the special case where -n option is used. */ static int void_is_comment(Declarator * declarator) { int result = FALSE; Parameter *p = declarator->params.first; if (p->next == NULL) { if (p->decl_spec.text != NULL && !strncmp(p->decl_spec.text, "/*", 2)) result = TRUE; } return result; } /* Output a parameter list. */ static void put_param_list(FILE *outf, Declarator * declarator, int commented) { #if OPT_LINTLIBRARY int count = 0; #endif Parameter *p; int f; int hide_it = (where == FUNC_PROTO) && (proto_style == PROTO_TRADITIONAL); int do_cmt = proto_comments && hide_it; p = declarator->params.first; if (hide_it && !do_cmt) { ; } else if (is_void_parameter(p)) { if (do_cmt) { if (!commented) put_string(outf, COMMENT_BEGIN); put_string(outf, "void"); if (!commented) put_string(outf, COMMENT_END); } else if (!hide_it) #if OPT_LINTLIBRARY if (!knrLintLibrary()) #endif put_string(outf, "void"); } else { f = (declarator == func_declarator) ? format : FMT_OTHER; #if OPT_LINTLIBRARY if (where == FUNC_PROTO && knrLintLibrary() && (func_declarator != declarator)) { do_cmt = TRUE; /* patch: shouldn't have gotten here at all */ } #endif if (where == FUNC_DEF && declarator->params.comment != NULL) put_string(outf, declarator->params.comment); else if (do_cmt && !commented) put_string(outf, COMMENT_BEGIN); put_string(outf, fmt[f].first_param_prefix); (void) putParameter(outf, p, knrLintLibrary(), ++count, commented); while (p->next != NULL) { #if OPT_LINTLIBRARY if (lint_ellipsis(p->next)) break; #endif put_char(outf, ','); if (where == FUNC_DEF && p->comment != NULL) put_string(outf, p->comment); p = p->next; put_string(outf, fmt[f].middle_param_prefix); (void) putParameter(outf, p, knrLintLibrary(), ++count, commented); } if (where == FUNC_DEF && p->comment != NULL) put_string(outf, p->comment); else if (do_cmt && !commented) put_string(outf, COMMENT_END); put_string(outf, fmt[f].last_param_suffix); } } /* Output function parameters. */ static void put_parameters(FILE *outf, Declarator * declarator, int commented) { Parameter *p; nestedParams++; if (where == FUNC_DEF && func_style == FUNC_TRADITIONAL) { /* Output parameter name list for traditional function definition. */ p = declarator->params.first; /* Output parameter name list only for head function declarator. */ if (!is_void_parameter(p) && declarator == func_declarator) { put_string(outf, fmt[format].first_param_prefix); put_string(outf, p->declarator->name); p = p->next; while (p != NULL && strcmp(p->declarator->text, ELLIPSIS) != 0) { put_char(outf, ','); put_string(outf, fmt[format].middle_param_prefix); put_string(outf, p->declarator->name); p = p->next; } put_string(outf, fmt[format].last_param_suffix); } } else { /* Output parameter type list. */ if (where == FUNC_PROTO && proto_style == PROTO_TRADITIONAL && declarator == func_declarator) { if (proto_comments) { int already = void_is_comment(declarator); if (!already) put_string(outf, COMMENT_BEGIN); put_param_list(outf, declarator, TRUE); if (!already) put_string(outf, COMMENT_END); } } else if (func_style != FUNC_NONE || proto_style != PROTO_NONE) { #if OPT_LINTLIBRARY if (!knrLintLibrary() || nestedParams <= 1) #endif put_param_list(outf, declarator, commented); } } nestedParams--; } /* Output a function declarator. */ static void put_func_declarator(FILE *outf, Declarator * declarator, int commented) { char *s, *t, *decl_text; int f; int saveNest = nestedParams; /* Output declarator text before function declarator place holder. */ if ((s = strstr(declarator->text, "%s")) == NULL) return; *s = '\0'; put_string(outf, declarator->text); /* Substitute place holder with function declarator. */ if (declarator->func_stack->func_def == FUNC_NONE) { decl_text = declarator->func_stack->text; if (declarator->name[0] == '\0') { put_string(outf, decl_text); } else { int star; /* Output the declarator text before the declarator name. */ if ((t = strstr(decl_text, declarator->name)) == NULL) return; *t = '\0'; star = ((t != decl_text) && (t[-1] == '*')); put_string(outf, decl_text); *t = declarator->name[0]; /* Output the declarator prefix before the name. */ f = (declarator == func_declarator) ? format : FMT_OTHER; if (strcmp(fmt[f].declarator_prefix, " ") != 0) put_string(outf, fmt[f].declarator_prefix); /* Output the declarator name. */ if (where == FUNC_PROTO && proto_style == PROTO_ABSTRACT && declarator != func_declarator) { if (proto_comments) { if (star) put_char(outf, ' '); put_string(outf, COMMENT_BEGIN); put_string(outf, declarator->name); put_string(outf, COMMENT_END); } } else { put_string(outf, declarator->name); } /* Output the remaining declarator text. */ put_string(outf, t + strlen(declarator->name)); /* Output the declarator suffix. */ put_string(outf, fmt[f].declarator_suffix); } } else { put_func_declarator(outf, declarator->func_stack, commented); nestedParams = 2; /* e.g., "void (*signal(p1, p2))()" */ } *s = '%'; s += 2; /* Output declarator text up to but before parameters place holder. */ if ((t = strstr(s, "()")) == NULL) return; *t = '\0'; put_string(outf, s); if (where == FUNC_PROTO && (func_declarator == declarator || func_declarator == declarator->head) && proto_macro) { fprintf(outf, " %s(", macro_name); } /* Substitute place holder with function parameters. */ put_char(outf, *t++ = PAREN_L); put_parameters(outf, declarator, commented); put_string(outf, t); if (where == FUNC_PROTO && (func_declarator == declarator || func_declarator == declarator->head) && proto_macro) { put_char(outf, PAREN_R); } nestedParams = saveNest; } /* Output a declarator. */ static void put_declarator(FILE *outf, Declarator * declarator, int commented) { char *s; if (declarator->func_def == FUNC_NONE) { if (where == FUNC_PROTO && proto_style == PROTO_ABSTRACT && declarator->name[0] != '\0') { if ((s = strstr(declarator->text, declarator->name)) == NULL) return; *s = '\0'; if (proto_comments) { fprintf(outf, "%s%s%s%s%s", declarator->text, COMMENT_BEGIN, declarator->name, COMMENT_END, s + strlen(declarator->name)); } else { fprintf(outf, "%s%s", declarator->text, s + strlen(declarator->name)); } *s = declarator->name[0]; } else { put_string(outf, declarator->text); } } else { put_func_declarator(outf, declarator, commented); } } /* Output a declaration specifier for an external declaration. */ static void put_decl_spec(FILE *outf, DeclSpec * decl_spec) { /* An "extern func()" is legal, but we want to be explicit for lint libs */ #if OPT_LINTLIBRARY if (decl_spec->text[0] == '\0') { free(decl_spec->text); decl_spec->text = xstrdup("int"); } #endif if (extern_out && !(decl_spec->flags & DS_STATIC) && strkey(decl_spec->text, "extern") == NULL) put_padded(outf, "extern"); put_padded(outf, decl_spec->text); } /* Output the list of parameters in K&R style, for lint-library */ #if OPT_LINTLIBRARY static void put_llib_params(Declarator * declarator, int commented) { Parameter *p; int count = 0; nestedParams++; p = (declarator->func_stack->func_def != FUNC_NONE) ? declarator->func_stack->params.first : declarator->params.first; while (p != 0) { if (lint_ellipsis(p)) break; if (putParameter(stdout, p, FALSE, ++count, commented)) putchar(';'); p = p->next; } nestedParams--; } #endif /* Generate variable declarations. */ void gen_declarations(DeclSpec * decl_spec, /* declaration specifier */ DeclaratorList * decl_list) /* list of declared variables */ { Declarator *d; int commented = FALSE; int saveNest = nestedParams; #if OPT_LINTLIBRARY boolean defines = (boolean) (strchr(decl_spec->text, CURL_L) != 0); int is_func; /* special treatment for -l, -T options */ if ((!variables_out && types_out && defines) || (decl_list == 0)) { strcut(decl_spec->text, "static"); strcut(decl_spec->text, "extern"); fmt_library((decl_list == 0) ? 1 : 2); if (decl_spec->text[0] != '\0') { put_string(stdout, decl_spec->text); put_string(stdout, ";\n"); } return; } #endif if (!variables_out || (decl_spec->flags & (DS_EXTERN | DS_INLINE | DS_JUNK))) { #if OPT_LINTLIBRARY if (in_include >= extern_in) /* -x option not set? */ #endif return; #if OPT_LINTLIBRARY strcut(decl_spec->text, "extern"); #endif } if (scope_out == SCOPE_EXTERN && (decl_spec->flags & DS_STATIC)) return; if (scope_out == SCOPE_STATIC && !(decl_spec->flags & DS_STATIC)) return; if (!inline_out && (decl_spec->flags & DS_INLINE)) return; check_untagged(decl_spec); func_declarator = NULL; where = FUNC_OTHER; format = FMT_OTHER; nestedParams = 0; for (d = decl_list->first; d != NULL; d = d->next) { if (d->func_def == FUNC_NONE || d->head->func_stack->pointer #if OPT_LINTLIBRARY || (in_include < extern_in) #endif ) { #if OPT_LINTLIBRARY if (already_declared(d->name)) { flush_varargs(); continue; } /* * Try to distinguish function declarations from function pointer * declarations, so that we don't unintentionally emit lint-library * arguments for function pointers. */ is_func = is_actual_func(d); if (is_func) { ellipsis_varargs(d); } else { nestedParams = 2; /* disable params altogether */ if (types_out) fmt_library(2); } if (lint_shadowed && lintLibrary()) printf("#undef %s\n", d->name); #endif put_string(stdout, fmt[FMT_PROTO].decl_spec_prefix); put_decl_spec(stdout, decl_spec); put_declarator(stdout, d, commented); #if OPT_LINTLIBRARY if (knrLintLibrary() && is_func) put_llib_params(d, commented); #endif put_body(stdout, decl_spec, d); nestedParams = saveNest; } #if OPT_LINTLIBRARY flush_varargs(); #endif } exitlike_func = FALSE; } /* Return TRUE if the function uses varargs. */ static int uses_varargs(Declarator * declarator) { Parameter *p; return (p = declarator->params.first) != NULL && (p->next == NULL) && (!strcmp(p->declarator->name, "va_alist")); } /* If the parameter list is empty, then replace it with "void". */ static void check_void_param(Declarator * declarator) { DeclSpec decl_spec; Parameter *p; if (declarator->params.first == NULL) { new_decl_spec(&decl_spec, void_name, 0L, DS_NONE); p = new_parameter(&decl_spec, (Declarator *) 0); new_param_list(&declarator->params, p); } } /* If a parameter name appears in the parameter list of a traditional style * function definition but is not declared in the parameter declarations, * then assign it the default type "int". */ static void set_param_decl_spec(Declarator * declarator) { Parameter *p; for (p = declarator->params.first; p != NULL; p = p->next) { if (p->decl_spec.text[0] == '\0' && strcmp(p->declarator->text, ELLIPSIS) != 0) { free(p->decl_spec.text); p->decl_spec.text = xstrdup("int"); } } } /* Generate a function prototype. */ void gen_prototype(DeclSpec * decl_spec, Declarator * declarator) { Parameter *p; int commented = FALSE; if (proto_style == PROTO_NONE || (decl_spec->flags & DS_JUNK)) return; if (scope_out == SCOPE_EXTERN && (decl_spec->flags & DS_STATIC)) return; if (scope_out == SCOPE_STATIC && !(decl_spec->flags & DS_STATIC)) return; if (!inline_out && (decl_spec->flags & DS_INLINE)) return; #if OPT_LINTLIBRARY if ((decl_spec->flags & DS_INLINE)) { if (in_include > extern_in) /* -x option not set? */ return; } #endif /* * Trim pathological keywords (which are legal, but unnecessary) from the * function and its parameters. */ strcut(decl_spec->text, "extern"); for (p = declarator->params.first; p != NULL; p = p->next) { strcut(p->decl_spec.text, "extern"); strcut(p->decl_spec.text, "auto"); } #if OPT_LINTLIBRARY if (lintLibrary()) ellipsis_varargs(declarator); else if (types_out) fmt_library(0); #endif func_declarator = declarator->head; if (uses_varargs(func_declarator)) { /* Generate a prototype for a function that uses varargs by replacing * the "va_alist" parameter with an empty parameter list. */ free_param_list(&func_declarator->params); func_declarator->params.first = NULL; } check_void_param(func_declarator); set_param_decl_spec(func_declarator); where = FUNC_PROTO; format = FMT_PROTO; nestedParams = 0; #if OPT_LINTLIBRARY if (lint_shadowed && lintLibrary()) printf("#undef %s\n", declarator->name); #endif put_string(stdout, fmt[format].decl_spec_prefix); put_decl_spec(stdout, decl_spec); put_func_declarator(stdout, declarator, commented); #if OPT_LINTLIBRARY if (knrLintLibrary()) put_llib_params(declarator, commented); #endif put_body(stdout, decl_spec, declarator); } /* Generate a declarator for a function pointer declarator or prototype. */ void gen_func_declarator(Declarator * declarator) { /* Go to the beginning of the function declarator in the temporary * file and overwrite it with the converted declarator. */ fseek(cur_tmp_file(), declarator->begin, 0); func_declarator = NULL; where = FUNC_DEF; format = FMT_FUNC; nestedParams = 0; put_func_declarator(cur_tmp_file(), declarator, FALSE); cur_file_changed(); } /* Output parameter declarations for old style function definition. */ static void put_param_decl(Declarator * declarator, int commented) { #if OPT_LINTLIBRARY int count = 0; #endif Parameter *p; p = declarator->params.first; if (!is_void_parameter(p)) { fputc('\n', cur_tmp_file()); (void) putParameter(cur_tmp_file(), p, knrLintLibrary(), ++count, commented); fputc(';', cur_tmp_file()); if (p->comment != 0) fputs(p->comment, cur_tmp_file()); p = p->next; while (p != NULL && strcmp(p->declarator->text, ELLIPSIS) != 0) { fputc('\n', cur_tmp_file()); (void) putParameter(cur_tmp_file(), p, knrLintLibrary(), ++count, commented); fputc(';', cur_tmp_file()); if (p->comment != 0) fputs(p->comment, cur_tmp_file()); p = p->next; } } } #define FileRead(buffer, length) \ if (fread(buffer, sizeof(char), length, cur_tmp_file()) != length) { \ perror("fread"); \ exit(EXIT_FAILURE); \ } /* Generate a function definition head. */ void gen_func_definition(DeclSpec * decl_spec, Declarator * declarator) { Parameter *p; ParameterList *params; char *comment = 0; int n; size_t comment_len; long diff; /* Do nothing if the function is already defined in the desired style * or if the function uses varargs. */ func_declarator = declarator->head; if (func_declarator->func_def == func_style || uses_varargs(func_declarator)) return; /* Save the text between the function head and the function body. * Read the temporary file from after the last ) or ; to the * end of the file. */ if ((diff = (ftell(cur_tmp_file()) - cur_begin_comment())) > 0) { comment_len = (size_t) diff; *(comment = (char *) xmalloc(comment_len)) = '\0'; fseek(cur_tmp_file(), cur_begin_comment(), 0); FileRead(comment, comment_len); } else { comment_len = 0; } format = FMT_FUNC; nestedParams = 0; if (func_declarator->func_def == FUNC_TRADITIONAL || func_declarator->func_def == FUNC_BOTH) { /* Save the text before the parameter declarations. */ params = &func_declarator->params; n = (int) (params->end_comment - params->begin_comment); if (n > 0) { *(params->comment = (char *) xmalloc((size_t) (n + 1))) = '\0'; fseek(cur_tmp_file(), params->begin_comment, 0); FileRead(params->comment, (size_t) n); params->comment[n] = '\0'; format = FMT_FUNC_COMMENT; } /* Get the parameter comments. */ for (p = func_declarator->params.first; p != NULL; p = p->next) { n = (int) (p->declarator->end_comment - p->declarator->begin_comment); if (n > 0) { *(p->comment = (char *) xmalloc((size_t) n + 1)) = '\0'; fseek(cur_tmp_file(), p->declarator->begin_comment, 0); FileRead(p->comment, (size_t) n); p->comment[n] = '\0'; format = FMT_FUNC_COMMENT; } } } check_void_param(func_declarator); set_param_decl_spec(func_declarator); /* Go to the beginning of the function head in the temporary file * and overwrite it with the converted function head. */ where = FUNC_DEF; fseek(cur_tmp_file(), decl_spec->begin, 0); if (func_style == FUNC_BOTH) { char *cur_func; size_t func_len; /* Save the current function definition head. */ if ((diff = (cur_begin_comment() - decl_spec->begin)) > 0) { func_len = (size_t) diff; cur_func = (char *) xmalloc(func_len); FileRead(cur_func, func_len); } else { cur_func = 0; func_len = 0; } fseek(cur_tmp_file(), decl_spec->begin, 0); fprintf(cur_tmp_file(), "%s\n\n", func_directive); /* Output new style function definition head. */ if (func_declarator->func_def == FUNC_ANSI) { if (cur_func != 0) fwrite(cur_func, sizeof(char), func_len, cur_tmp_file()); } else { fputs(fmt[format].decl_spec_prefix, cur_tmp_file()); fputs(decl_spec->text, cur_tmp_file()); fputc(' ', cur_tmp_file()); func_style = FUNC_ANSI; put_func_declarator(cur_tmp_file(), declarator, FALSE); } fputs("\n#else\n\n", cur_tmp_file()); /* Output old style function definition head. */ if (func_declarator->func_def == FUNC_TRADITIONAL || func_declarator->func_def == FUNC_BOTH) { if (cur_func != 0) fwrite(cur_func, sizeof(char), func_len, cur_tmp_file()); } else { fputs(fmt[format].decl_spec_prefix, cur_tmp_file()); fputs(decl_spec->text, cur_tmp_file()); fputc(' ', cur_tmp_file()); format = FMT_FUNC; func_style = FUNC_TRADITIONAL; put_func_declarator(cur_tmp_file(), declarator, FALSE); put_param_decl(func_declarator, FALSE); } fputs("\n#endif", cur_tmp_file()); if (comment != 0 && *comment != '\n') fputc('\n', cur_tmp_file()); func_style = FUNC_BOTH; if (cur_func != 0) free(cur_func); } else { /* Output declarator specifiers. */ fputs(fmt[format].decl_spec_prefix, cur_tmp_file()); fputs(decl_spec->text, cur_tmp_file()); fputc(' ', cur_tmp_file()); /* Output function declarator. */ put_func_declarator(cur_tmp_file(), declarator, FALSE); if (func_style == FUNC_TRADITIONAL) put_param_decl(func_declarator, FALSE); } /* Output text between function head and body. */ if (comment != 0) { fwrite(comment, sizeof(char), comment_len, cur_tmp_file()); free(comment); } cur_file_changed(); } cproto-4.7t/CHANGES0000644000175100001440000006453214150246211012576 0ustar tomusers-- $Id: CHANGES,v 4.65 2021/11/26 21:07:21 tom Exp $ 2021/11/26 (4.7t) - enable lint-library feature by default, rather than only if a lint program was found (report by Michael Zucchi). - updated configure macros - update config.guess, config.sub 2021/03/03 (4.7s) - ignore preprocessor output with zero line-numbers. - add some null-pointer checks in lintlibs.c, to work with compilers emitting unconventional proprocessor-lines. - add .c.i rule to makefile - updated configure macros 2021/01/10 (4.7r) - add -n and -N options (prompted by discussion with "Radisson97"). - ignore -f and -O options if their values are respectively non-numeric or numeric, e.g., when a user confuses CFLAGS with CPPFLAGS. - sort usage-message. - modify configure script to error out if lex/yacc are not found (report by "Radisson97"). - updated configure macros - update config.guess, config.sub 2020/10/11 (4.7q) - align manpage formatting with ded. - add configure-check for preprocessor -C option, absent in some c89/c99. - change lexer's keyword-matching to a lookup table, avoiding ambiguity. - drop Apollo extensions from lexer. - updated configure macros - update config.guess, config.sub 2020/07/16 (4.7p) - add keywords for gcc "additional floating types" (report by Aaron Sosnick). - modify testing makefile/scripts to support an external script which collects the warning messages from different implementations of yacc. - drop obsolete dist/MANIFEST rules from top-level makefile; the MANIFEST file has long been generated from an external script. - comment-out unterminated string example in testing/syntax.c, since newer gcc C preprocessor no longer ignores text which is ifdef'd out. - updated configure macros - update config.guess, config.sub 2018/05/25 (4.7o) - correct logic in CF_YACC_ERROR macro for clang. 2018/05/24 (4.7n) - add check_errors rule to show error messages from test-cases - correct logic in YACC_HAS_YYTOKS case for isascii(). - updated/improved test-packages. - updated configure macros - update config.guess 2015/07/05 (4.7m) - add --with-man2html option to configure script - update config.guess, config.sub 2014/01/01 (4.7l) - add "docs" rule to makefile. - correct configure check for yyname vs yytname, broken by 4.7i changes - update config.guess 2013/10/25 (4.7k) - modify configure script, etc., to support cross-compiles, e.g., to MinGW. - updated configure macros - support --datarootdir option - various portability fixes for CF_XOPEN_SOURCE - add checks for clang - improve macros for checking for standard C compiler - modified macros to support third parameter of AC_DEFINE used by autoheader - update config.guess, config.sub 2011/01/02 (4.7j) - amend a check for function name to allow cases such as this: int (foo)(); which is distinct from a function-pointer, e.g., int (*foo)(); - modified configure script to deprecate ${name-value} in favor of standard ${name:-value}. - update config.guess, config.sub 2010/07/14 (4.7i) - escape dashes used in manpage, to work with groff (patch by Kenneth Pronovici) - add RPM and Debian build scripts, for testing. - add configure checks for ctags and lint program. - fix strict compiler warnings, e.g., using const. - support DESTDIR variable in makefile. - drop mkdirs.sh, use "mkdir -p" - several improvements to configure macros - quoted ifelse() params - distinguish Darwin 9 from previous releases - ignore stderr in check for gcc version, to work with c89 wrapper. - use consistent date and formatting in the CHANGES file, for processing contributor's information using a script. - update config.guess, config.sub 2009/09/03 (4.7h) - updated configure macros CF_ADD_CFLAGS CF_GCC_ATTRIBUTES CF_GCC_WARNINGS CF_XOPEN_SOURCE - update config.guess, config.sub 2008/11/19 (4.7g) - modify cpp command to redirect stderr to /dev/null if -q option is given, for consistency with the non-cpp mode (report by Nicolas Limare, Ubuntu #275248). - add configure --disable-leaks option. - use configure macro CF_XOPEN_SOURCE macro to make mkstemp() prototyped on Linux. - remove isascii() usage. - code cleanup, to remove K&R relics. - update config.guess, config.sub 2008/01/01 (4.7f) - add symbol for __gnuc_va_list - add some data for c99 syntax to test-cases, e.g., long long. - review/fix some additional places where need_temp() call is needed. - fix a reference to unallocated storage when reading from standard input (Fedora #315061). - minor updates to configure script macros - update mkdirs.sh (for parallel makes) - update config.guess, config.sub - rename install.sh to install-sh 2005/12/08 (4.7e) - eliminate some fixed limits on buffer sizes (prompted by FreeBSD port). - eliminate fixed limit on include nesting. - use configure check for mkstemp(), use that function in preference to mktemp() if a working version is found. - move strstr.c into strkey.c to avoid zero-length object - improve configure check for gcc version, from ncurses. - update config.guess, config.sub 2005/08/21 (4.7d) - modified configure script and makefile to work with cygwin - fix configure check for yacc errors broken by 4.7c changes. - change fixed buf[] in grammar.y to an allocated buffer temp_buf[]. - eliminate fixed limit on number of -I options. - improve parsing for "asm", adding GCC's __asm__ keyword and modifying grammar to work with declarations such as extern int __asm__ (mkstemp, (char *__template), mkstemp64); - add config.guess, config.sub (needed for cross-compiling, etc). - add configure check for Intel compiler. - modify filename comparison for lint-library to ignore leading "./". 2004/03/25 (4.7c) - fix a couple of places where valgrind reported a sscanf's result was not always initialized. - modify behavior of "-X" option so it does not cause preprocessor lines to be written to the output. Preprocessor lines are needed for lint-library text, but are inconsistent with other uses of cproto (patch by Kenneth Pronovici). - add configure option "--enable-llib", which allows one to configure cproto without support for lint-library "llib" files. Since the "-X" option shares the include-file tracking, this option can also be enabled (or disabled) (discussion with Kenneth Pronovici, Bob Van der Poel). - require an ANSI C compiler for building. - updated configure script, using autoconf 2.52 + patch, along with macros from vile/lynx/etc. 2004/03/09 (4.7b) - added new -X option to limit the levels of include-files from which an extern can come (Debian #235824). - added new -i option to support inline function prototypes (Debian #228801, patch by Kenneth Pronovici). 2003/04/05 (4.7a) - add definition of YYFLAG, to enable the error-reporting code with bison 1.875 - add definition of YYSTYPE, to allow this to build with recent (aka "broken") versions of bison (Debian #166140, Lukas Geyer ). - add gcc-specific __builtin_va_arg keyword (Debian #175862, Kenneth Pronovici ). - modify syntax.c to change token after "#endif" to a comment, thereby avoiding deprecation warning from gcc 3.2, which would cause "make check" to show unexpected results. - resync with version 4.7 at http://cproto.sourceforge.net/ 2003/01/05 - add gcc-specific __builtin_va_list keyword. 2002/02/25 (4.6e) - correct length allocated for filename in include_file(), which was not big enough if the $CPROTO environment variable was corrupted. From report by , using sharefuzz: http://www.atstake.com/research/tools/sharefuzz1.0.tar.gz - update configure.in to generate config.h directly using autoconf patch from http://invisible-island.net/autoconf/ - remove makefile rules that attempt to recreate the configure script. As demonstrated in numerous packages, it always reflects poor design. - remove makefile rules to make shar files (comp.sources.misc is long gone). - stop using changequote(), workaround for bugs in autoconf 2.5x 2000/11/09 (4.7) - Report source file and line number in error messages in gcc-style format. 2000/08/10 (4.6d) - use newer versions of mkdirs.sh and install.sh - regenerate configure script with autoconf 2.13 - restructure aclocal.m4 - modify Makefile.in to allow $(bindir) and $(mandir) to be altered independently of $(prefix) and $(exec_prefix) (patch by Carsten Leonhardt ). 2000/07/08 (4.6c) - add a clause to handle "__extension__" before extern declarations. (report by Bob van der Poel ) 1999/12/27 (4.6b) - correct check for size of vec[] array in yaccExpected(), broken in 4.6a changes. (report by Wolfgang Wander) 1999/12/19 - add keywords "restrict", "_Bool", "_Complex", "_Imaginary" based on c9x draft. - add keywords "__restrict__" and "__restrict", for gcc. (report by Wolfgang Wander ) 1999/12/14 (4.6a) - change vec[] array in yaccExpected() to be dynamically allocated. It was a fixed-size (10 entries) array before. Also fix problem reported by Wolfgang Wander , which is that if the array were empty, it was passed to qsort() with a zero-size, causing a core dump. - add to syntax.c & corresponding test-cases the typedef/identifier example. 1999/10/21 - allow identifiers to be the same as typedef names, handle this case: typedef int badStyle; void badFunc(int *badStyle) { } (reported by Paul Haas ) 1999/01/03 - add '__extension__' keyword 1998/01/21 (4.6) - Since cproto is no longer being distributed on USENET in shar file format, the patchlev.h and MANIFEST files have been removed. The patchlevel number has been removed from the version number. - Moved files out of the porting directory into separate platform specific directories. The emx directory has files used to compile using EMX. The os2 directory has files used to compile on OS/2 using Watcom C/C++. The win32 directory has files to compile on Windows 95 and Windows NT using Watcom C/C++. - correct order of include-path to keep standard include (e.g., /usr/include) at the end of the search list. - modified lint-library include-stack recovery to work on OSF/1. - supply default initializer for lint-library const data - corrected reset of __attribute__((noreturn)) - added '__volatile', '__const__', '__inline' keywords to grammar to accommodate gcc. - modified configure script to add several development/debugging options (i.e., --with-trace, --with-dbmalloc, --with-dmalloc). - modified ifdefs to avoid using predefined 'unix' (not defined on AIX or CLIX) 1996/04/15 (Patchlevel 5) - corrected instance of fclose on a file pointer after pclose was done (found with Electric Fence). - corrected script make_bat.sh to prevent expansion of \n in argument-string. - Modified handling of lint library option to allow generation of lint libraries for ANSI compilers (set -a -l). - corrected a missing 'void' in parameter list - modified to allow compile/test with 'dmalloc' library in addition to 'dbmalloc'. - corrected memory leak in yyerror.c, and allocation-size for cpp command. - added keywords to work with gcc 2.7.0 - corrected unresolved references to flush_varargs() when OPT_LINTLIBRARY is not defined 1995/08/24 (Patchlevel 4) - Added -S option to only output static declarations. - Fix: The configure script didn't replace @CFLAGS@, @CPPFLAGS@ and @LDFLAGS@ in the makefile generated from makefile.in. - Fix: The -a option generated incorrect function definitions. - update test-cases for the -f2 fix in patch 3. - remove dependency on GNU-make from makefile.in - corrected configuration script that tests whether yyerror can be extended (had cached wrong flag, preventing some configurations from being recognized). - added calls for 'flush_varargs()' to correct situation in lint-library output where VARARGS comments were not reset properly when a function was skipped. - improved the logic of 'strip_name()' (used to compute include-directives for the lint-library option) so that it recognizes the conventional include directory created by a GCC install. 1995/01/06 (Patchlevel 3) - check for a special case in lint-library generation, i.e., prototype arguments of the form "*()", which need more parentheses for SunOS's lint. - modified configure.in, aclocal.m4, makefile.in to work with autoconf 2.1 (also added install.sh - note that "install-sh" is not an MS-DOS-compatible filename). - derive the program name from the argv[0] entry, in case it's installed under a different name. - Fix: The -f2 option generated incorrect prototypes for functions that take a variable argument list. - use 'sed' rather than 'flip' to apply trailing CR's to MS-DOS scripts. 1994/10/26 (Patchlevel 2) - modified grammar to recognize C++ ref-variables (i.e., '&' as a prefix to identifiers at the top lexical level). Lint libraries are formatted without this '&', since lint doesn't grok C++. This corrects an error in cproto 4.0 which caused '&' characters to be suppressed altogether, e.g., when filtering with the "-t" option. - modified rules that generate MANIFEST to put auto-generated scripts there also, if they've been created (e.g., cd testing; make scripts). - modified makefile.in to have shar target for both GNU shar and Rick Salz's cshar utility. - use 'const' in yyerror.c, otherwise the error-reporting auto-configuration does not work. - don't use "#elif" preprocessor control; not all systems support it. 1994/10/25 (Patchlevel 1) - Added testing scripts for MS-DOS and VMS. - Added makefile for Borland C++ for OS/2. - Fix: When the -a, -t or -b options were used, '&' characters were stripped from the output files. - Fix: The system.h file should define EXIT_SUCCESS and EXIT_FAILURE regardless of the presence of . 1994/09/24 (Patchlevel 0, dickey) - corrected two malloc-defects in lint library generation (one place where generated parameter name was copied rather than allocated, and another memory leak). - corrected generation of lint library function body, to handle function pointers. - changed the implicit lint library function type from "" to "void", to avoid special-cases in the function-body generation. - added logic using 'NestedParams' to suppress prototype-arguments in lint library function-pointer arguments. - corrected lint-library function parameter derived from prototype "char [2]" (parameter name wasn't supplied). - added PRINTFLIKE and SCANFLIKE to the comments interpreted for the lint library translation. - modified "LINT_PREPRO" comment to pass-thru all comment text if no count is given. - added new comment keyword "LINT_SHADOWED" to generate "#undef symbol" before each function template in lint libraries (useful for processing files that define both macros and functions with the same names). - interpret GCC's __attribute__ noreturn and format for lint-library text (GCC 2.5.8 preprocessor passes these macros through, GCC 2.6 apparently does not). - treat carriage-return (^M) as whitespace where appropriate. - added configuration-test to avoid conflict with prototype for 'popen()' - added several function-pointer regression test-cases Version 3 1994/08/31 (Patchlevel 9, dickey) - use 'autoconf' to make a UNIX configure-script. - recognize GCC extensions '__inline' and '__attribute__' - added ifdef OPT_LINTLIBRARY to allow compiling without the lint library code (saves about 4kb). - corrected some logic that made incorrect commenting for options -c -f1 (e.g., "void (*Sigdisp(int sig, void (*func)(int sig)))(int sig)"). - corrected logic that macroizes (e.g., with P_) functions like 'Sigdisp' (it wasn't doing anything about the trailing "(int sig)"). - corrected handling of K&R conversion of mixed-mode functions (K&R style with prototypes in arguments) to avoid losing comments. - modified logic for options -c -f2 so that cproto inserts a space before the beginning of a comment when it immediately follows an '*'. - enhanced error reporting with new module yyerror.c which (attempts to) report the expected token type/name when a syntax error is encountered. - modified the grammar.y file to try to recover from errors at the next semicolon (as well as the next right curly bracket). - modified to process lex/yacc files with gcc as C-preprocessor. - Added option "-O" to force redirection of errors without shell operations (useful for VAX/VMS and MS-DOS in particular). - added "\s" as a synonym for space in the format options (-P, -F, -C) - tested on Solaris with lex/yacc and flex 2.4.6 / bison 1.22 (SunOS explorer 5.3 Generic_101318-42 sun4m sparc; gcc 2.6.0) - tested on SunOS 4.1.1 with lex/yacc and flex 2.4.6 / bison 1.22 (SunOS calvin 4.1.1 1 sun4c) - tested on IRIX with lex/yacc (IRIX dbs3 5.2 02282015 IP19 mips) - tested on Linux 0.99.15 with lex/yacc and flex 2.4.6 / bison 1.22 / byacc 1.9 - tested on MS-DOS with flex 2.37 / byacc 1.9 (built with turboc.mak). (Bison uses too much stack space). - tested on VAX/VMS 6.1 with VAX-C 3.2 and flex 2.4.6 / bison 1.22. - moved non-UNIX files into 'porting' subdirectory. - added 'testing' subdirectory, for simple regression tests. - tested for memory leaks with dbmalloc (on Linux). 1993/06/09 (Patchlevel 8, internal: dickey/cthuang) - added files 'lintlibs.c' and 'strkey.c' - Allow dollar signs in identifiers - Defined FAIL, SUCCESS to use in 'exit()' calls (VMS is approximately the reverse of UNIX). - Added option "-o" to force redirection without shell operations (useful for VAX/VMS in particular). - Added options "-l" (lintlibrary format), "-T" (typedefs), "-x" (externs in include-files). - Added "-C" option to cpp-invocation (to support VARARGS-decoding for -l option). - Modified grammar.y so that if -T option is turned on, instances of untagged struct, union or enum are shown with the contents of the curly braces. - Modified lex.l so that it sets 'return_val' iff at least one return statement within curly braces returns an expression. Use this to support -l option. - Modified semantic.c (for -l option) to put tabs after short names for better readability. Also (only -l option), put a blank line before function definitions and typedefs. - Corrected lex.l so that it recognizes preprocessor lines within curly braces. - Modified 'gen_prototype()' to trim 'extern' and 'auto' keywords from the text (so that 'extern' is emitted in this function only if the -e option is specified). Do this to support -l option (and to correct normal usage, which implies that -e option is needed to put an 'extern' before declaration). - Corrected test in 'put_decl_spec()' by using 'strkey()' (which tests for a name, not simply a substring). - Modified semantic.c to use 'put_string()' and related procedures to simplify pretty-printing of lint-library text (mainly to control blank lines). (See 'fmt_library()'). - linted some xmalloc calls using ALLOC macro. 1993/06/01 (Patchlevel 7, cthuang) - Fix: The processing of string literals is now more robust. - Removed the -f4 option which generated prototypes like int main P_((int argc, char **argv)); Use the -m option now to put a guard macro around the prototype parameter list. Use the -m option together with -f3 (which is the default) to produce the same output as the old -f4 option. The option to set the guard macro name is now -M. - Comments in prototype parameter lists are now disabled by default. Use the -c option now to output these comments. - Can now process #include directives in which the file is specified with a #define macro. - Now does not convert function definitions that take the formal parameter va_alist from . - Now recognizes the GNU C modifiers __const and __inline__. Patchlevel 6 - Fix: A function in lex.l exploited the ANSI C feature of concatenating string literals. This prevented the module from being compiled with pre-ANSI C compilers. Patchlevel 5 - Fix: The -v option did not output declarations for function pointers. - Fix: String literals continued over more than one line messed up the line number count. - Fix: The program generated incorrect prototypes for functions that take a variable argument list using . - Fix: When converting functions from the standard input, cproto generated no output if no functions needed to be converted. - Fix: Now does not output a warning if an untagged struct is found in a typedef declaration. - Added the -b option which rewrites function definition heads to include both old style and new style declarations separated by a conditional compilation directive. For example, the program can generate #ifdef ANSI_FUNC int main (int argc, char *argv[]) #else int main (argc, argv) int argc; char *argv[] #endif { } Added the -B option to set the preprocessor directive that appears at the beginning of such definitions. - Added the keyword "interrupt" to the set of type qualifiers when compiled on a UNIX system. - The MS-DOS version now recognizes the type modifiers introduced by Microsoft C/C++ 7.00. - Now recognizes ANSI C trigraphs (yuck!). - Now use "#if __STDC__" instead of "#if defined(__STDC__)". - GNU bison orders the y.tab.c sections differently than yacc, which resulted in references to variables before they were declared. The grammar specification was modified to also be compatible with bison. Patchlevel 4 - Fix: A typedef name defined as a pointer to char, short or float was incorrectly promoted if it was used to specify a formal parameter. For example, for the definition typedef char *caddr_t; int strlen (s) caddr_t s; { } cproto generated the incorrect prototype int strlen(int s); - Added implementation of the ANSI function tmpfile() for systems that don't have it. - If compiled with Microsoft C, cproto preprocesses its input by running the command "cl /E". To eliminate the error messages when the file is included, the program now recognizes the specifier _based(void). Patchlevel 3 - Fix: The program didn't generate prototypes for functions defined with the extern specifier. - Fix: The -c option didn't output a space before parameter names in generated prototypes. - Added the -E option to specify a particular C preprocessor to run or to stop the program from running the C preprocessor. - Added the -q option to stop the program from outputting error messages when it cannot read the file specified in an #include directive. - Made the yacc specification compatible with UNIX SYSVR4 yacc. Patchlevel 2 - Fix: The function definition conversion may produce a mangled function definition if an #include directive appears before the function and no comments appear between the directive and the function. - Fix: The size of the buffer allocated for the C preprocessor command string did not include enough space for options set in the environment variable CPROTO. - Replaced the -n option with -c which disables all comments in the generated prototypes. - Replaced the enum's with #define constants to accommodate C compilers that don't like enumerators in constant expressions. Patchlevel 1 - Fix: The program was calling ftell() on an invalid FILE pointer. Patchlevel 0 - Added options to convert function definitions between the old style and ANSI C style. - Options can be specified from the environment variable CPROTO. - The MS-DOS version recognizes more Microsoft C and Borland C++ type modifiers (such as _cdecl, _far, _near). - Fix: Formal parameters specified with typedef names were not promoted. For example, for the definition typedef unsigned short ushort; void test (x) ushort x; { } cproto generated the incorrect prototype void test(ushort x); while the correct one is void test(int x); - Fix: Incorrect prototypes were generated for functions that returned function pointers. For example, cproto generated an incorrect prototype for the function definition void (*signal(int x, void (*func)(int y)))(int z) { } - Fix: Changed calls to memory allocation functions to abort the program if they fail. Version 2 Patchlevel 3 - Made cproto compatible with GNU flex. - After compiling with the preprocessor symbol TURBO_CPP defined, on MS-DOS systems, cproto will pipe its input through the Turbo C preprocessor. - Fix: Typedef names may now be omitted from typedef declarations. For example, every C compiler I tried accepts typedef int; and some even give warnings when encountering this statement. Patchlevel 2 - Cproto is now able to generate prototypes for functions defined in lex and yacc source files named on the command line. Lex and yacc source files are recognized by the .l or .y extension. - Fix: The memory allocated to the typedef symbol table was not being freed after scanning each source file. - Fix: Failure to reset a variable during error recovery caused segmentation faults. Patchlevel 1 - Fix: Cproto incorrectly generated the parameter "int ..." in prototypes of functions taking variable parameters. - Fix: Function definitions can now be followed by an optional semicolon. I found this feature in every C compiler I tried. Patchlevel 0 - Added formal parameter promotion. - Added prototype style that surrounds prototypes with a guard macro. - Handles C++ style comment //. - Nifty new way to set prototype output format. - Got rid of the shell wrapper used to pipe the input through the C preprocessor (cpp). - For the port to MS-DOS, I modified cproto to run without cpp, but since I didn't want to reimplement cpp, the program processes only the #include and #define directives and ignores all others. Macro names defined by the #define directive are treated like typedef names if they appear in declaration specifiers. Version 1 Patchlevel 3 - Fix: identical typedef names and struct tags should be allowed. For example: typedef struct egg_salad egg_salad; struct egg_salad { int mayo; }; void dine(egg_salad l) { } Patchlevel 2 - Fix: A typedef statement should allow a list of typedefs to be declared. Example: typedef int a, *b; - Fix: When run with the -v option on this input, cproto did not output a declaration for variable "b": char *a="one"; char *b="two"; - The options were renamed. Added new options that change the output format of the prototypes. Patchlevel 1 - Fix: Incorrect prototypes were produced for functions that take function pointer parameters or return a function pointer. For example, cproto produced an erroneous prototype for this function definition: void (*signal (sig, func))() int sig; void (*func)(); { /* stuff */ } - The lexical analyser now uses LEX. It should still be compatible with FLEX. cproto-4.7t/lex.l0000644000175100001440000005744214020026452012551 0ustar tomusers%p 3000 %{ /* $Id: lex.l,v 4.29 2021/03/04 00:43:22 tom Exp $ * * Lexical analyzer for C function prototype generator * * This is designed to parse lexically at the top level (e.g., of extern * objects such as procedures). The corresponding yacc-grammar expects * that curly-braces (for function bodies) are recognized as a single * token, BRACES. Similarly, square-brackets and their contents are * passed back as BRACKETS. * * Assignments at the top level are data-initialization statements. * These are returned as INITIALIZER. * * The logic here recognizes tokens inside curly-braces, but does not * pass them back to the grammar. * * VAX/VMS extensions: * Treat the keywords 'globalref', etc., as 'extern'. * * The keywords 'noshare' and 'readonly' are type-qualifiers. * * GCC extensions: * The keywords '__attribute__', '__inline', '__inline__', '__signed', * '__signed__'. and '__extension__' */ #define result(nn) count(); if (!brackets && unnested()) return(nn) #define is_IDENTIFIER save_text_offset();\ return type_of_name(yytext); #if !OPT_LINTLIBRARY #define gcc_attribute absorb_special /* otherwise, we don't care */ #endif char *varargs_str; /* save printflike/scanflike text */ int varargs_num; /* code to save "VARARGS" */ int debug_trace; /* true if we trace token-level stuff */ char base_file[BUFSIZ]; /* top-level file name */ static int asm_level; /* parenthesis level for "asm" parsing */ static int save_cpp; /* true if cpp-text within curly braces */ static int in_cpp; /* true while we are within cpp-text */ static int curly; /* number of curly brace nesting levels */ static int ly_count; /* number of occurrences of %% */ #ifdef FLEX_SCANNER /* flex scanner state */ static YY_BUFFER_STATE *buffer_stack; #ifdef __cplusplus #define LexInput() yyinput() #endif #endif /* FLEX_SCANNER */ #ifndef LexInput #define LexInput() input() #endif static unsigned inc_limit; /* stack size */ static int inc_depth; /* include nesting level */ static IncludeStack *inc_stack; /* stack of included files */ static SymbolTable *included_files; /* files already included */ static int type_of_name(char *name); static void startCpp(int level); static void finishCpp(void); #if !OPT_LINTLIBRARY static void absorb_special(void); #endif #if OPT_LINTLIBRARY static void gcc_attribute(void); #endif static void update_line_num(void); static void save_text(void); static void save_text_offset(void); static void get_quoted(void); static void get_comment(void); static void get_cpp_directive(int copy); static void parsing_file_name(unsigned need); static void do_include(char *f); static void include_file(char *name, int convert); static void put_file(FILE *outf); static void put_quoted(int c); #if OPT_LINTLIBRARY static int decipher_comment(char *keyword, int len); #endif %} WS [ \t] LETTER [A-Za-z$_] DIGIT [0-9] ID {LETTER}({LETTER}|{DIGIT})* QUOTE [\"\'] %s CPP1 INIT1 INIT2 CURLY LEXYACC ASM CPP_INLINE %% \n { save_text(); cur_file->line_num++; cur_declarator = NULL; } "/*" { save_text(); get_comment(); } "//".*$ save_text(); "&" { save_text(); return '&'; /* C++ ref-variable? */ } ^"%%" { save_text(); if (++ly_count >= 2) BEGIN INITIAL; } ^"%{" { save_text(); BEGIN INITIAL; } {QUOTE} get_quoted(); . save_text(); ^"%}" { save_text(); BEGIN LEXYACC; } #{WS}* { save_text(); startCpp(0); } "??="{WS}* { save_text(); startCpp(0); } [^;]* finishCpp(); define{WS}+{ID} { char *name; char *value; save_text(); *(name = (char *) xmalloc((size_t) (yyleng + 1))) = '\0'; sscanf(yytext, "define %s", name); get_cpp_directive(1); *(value = (char *) xmalloc(1 + strlen(temp_buf))) = '\0'; sscanf(temp_buf, "%s", value); new_symbol(define_names, name, value, DS_NONE); free(name); free(value); } include{WS}* { save_text(); get_cpp_directive(1); if (temp_buf[0] != '"' && temp_buf[0] != '<') { Symbol *sym = find_symbol(define_names, temp_buf); if (sym != NULL && sym->value != NULL) { need_temp(strlen(sym->value)); strcpy(temp_buf, sym->value); } else { temp_buf[0] = '\0'; } } if (temp_buf[0] != '\0') do_include(temp_buf); } line{WS}+[0-9]+{WS}+\".*$ { unsigned line_num; save_text(); parsing_file_name((unsigned) yyleng); sscanf(yytext, "line %u \"%[^\"]\"", &line_num, cur_file->file_name); if (line_num > 0) { cur_file->line_num = line_num - 1; track_in(); } finishCpp(); } [0-9]+{WS}+\".*$ { unsigned line_num; save_text(); parsing_file_name((unsigned) yyleng); sscanf(yytext, "%u \"%[^\"]\"", &line_num, cur_file->file_name); if (line_num > 0) { cur_file->line_num = line_num - 1; track_in(); } finishCpp(); } [0-9]+.*$ { unsigned line_num; save_text(); sscanf(yytext, "%u ", &line_num); if (line_num > 0) { cur_file->line_num = line_num - 1; track_in(); } finishCpp(); } . { save_text(); get_cpp_directive(0); } "(" { save_text_offset(); return '('; } ")" { save_text(); if (cur_file->convert) cur_file->begin_comment = ftell(cur_file->tmp_file); return ')'; } "*" { save_text_offset(); return '*'; } [,;] { save_text(); if (cur_file->convert) cur_file->begin_comment = ftell(cur_file->tmp_file); return yytext[0]; } "..." { save_text(); return T_ELLIPSIS; } \" { get_quoted(); return T_STRING_LITERAL; } "__asm__" { save_text(); BEGIN ASM; return T_ASM; } asm { save_text(); BEGIN ASM; return T_ASM; } "(" { ++asm_level; save_text(); } ")" { --asm_level; save_text(); if (asm_level <= 0) { asm_level = 0; BEGIN INITIAL; return T_ASMARG; } } {QUOTE} get_quoted(); . save_text(); __?based[^(]*\([^)]*\) { save_text_offset(); return T_TYPE_QUALIFIER; } {ID} { int code; save_text_offset(); switch (code = type_of_name(yytext)) { case T_ATTRIBUTE: gcc_attribute(); break; default: return code; } } \[[^\]]*\] { /* This can't handle the case where a comment * containing a ] appears between the brackets. */ save_text_offset(); update_line_num(); return T_BRACKETS; } "??("[^?]*"??)" { save_text_offset(); update_line_num(); return T_BRACKETS; } "=" { save_text(); BEGIN INIT1; return '='; } "{" { save_text(); curly = 1; BEGIN INIT2; } [,;] { unput(yytext[yyleng-1]); BEGIN INITIAL; return T_INITIALIZER; } {QUOTE} get_quoted(); . save_text(); "{" { save_text(); ++curly; } "}" { save_text(); if (--curly == 0) { BEGIN INITIAL; return T_INITIALIZER; } } {QUOTE} get_quoted(); . save_text(); "{" { save_text(); curly = 1; return_val = returned_at = FALSE; BEGIN CURLY; return T_LBRACE; } "{" { save_text(); ++curly; } "}" { save_text(); if (--curly == 0) { BEGIN INITIAL; return T_MATCHRBRACE; } } {QUOTE} get_quoted(); "return" { save_text(); returned_at = TRUE; } ";" { save_text(); returned_at = FALSE; } #{WS}* { save_text(); startCpp(1); } "??="{WS}* { save_text(); startCpp(1); } . { save_text(); return_val |= returned_at; } [ \r\t\f]+ save_text(); . { save_text(); put_error(); fprintf(stderr, "bad character '%c'\n", yytext[0]); } %% static void startCpp(int level) { save_cpp = level; in_cpp = TRUE; BEGIN CPP1; } static void finishCpp(void) { in_cpp = FALSE; if (save_cpp) BEGIN CURLY; else BEGIN INITIAL; } /* * Skip over embedded __attribute/__attribute_ syntax. */ #if !OPT_LINTLIBRARY static void absorb_special(void) { int c; int nest = 0; while ((c = input()) > 0) { if (c == '(') nest++; else if (c == ')') { if (--nest <= 0) break; } } } #endif #if OPT_LINTLIBRARY /* * This recognizes some of the special attribute macros defined by gcc: * noreturn * format(printf,n,m) * format(scanf,n,m) * and uses that information to construct equivalent lint-library text. * (It's a distinct piece of code from the 'absorb_special()' function to * avoid spurious matches with non-gcc compilers). */ static void gcc_attribute(void) { int c, num1, num2; int nest = 0; unsigned len = 0; char bfr[BUFSIZ]; while ((c = LexInput()) > 0) { if (len < sizeof(bfr) - 1 && !isspace(c)) bfr[len++] = (char) c; if (c == '(') nest++; else if (c == ')') { if (--nest <= 0) break; } } bfr[len] = '\0'; if (!strcmp(bfr, "((noreturn))")) { exitlike_func = TRUE; } else if (sscanf(bfr, "((format(printf,%d,%d)))", &num1, &num2) == 2) { (void) sprintf(bfr, "PRINTFLIKE%d", varargs_num = num1); varargs_str = xstrdup(bfr); } else if (sscanf(bfr, "((format(scanf,%d,%d)))", &num1, &num2) == 2) { (void) sprintf(bfr, "SCANFLIKE%d", varargs_num = num1); varargs_str = xstrdup(bfr); } } #endif /* Decode the current token according to the type-of-name */ static int type_of_name(char *name) { /* *INDENT-OFF* */ static const struct { const char *name; int code; } table[] = { { "auto", T_AUTO }, { "extern", T_EXTERN }, { "register", T_REGISTER }, { "static", T_STATIC }, { "typedef", T_TYPEDEF }, { "inline", T_INLINE }, { "_Bool", T_Bool }, { "_Complex", T_Complex }, { "_Imaginary", T_Imaginary }, { "char", T_CHAR }, { "double", T_DOUBLE }, { "float", T_FLOAT }, { "int", T_INT }, { "void", T_VOID }, { "long", T_LONG }, { "short", T_SHORT }, { "signed", T_SIGNED }, { "unsigned", T_UNSIGNED }, { "enum", T_ENUM }, { "struct", T_STRUCT }, { "union", T_UNION }, { "va_dcl", T_VA_DCL }, { "__signed", T_SIGNED }, { "__signed__", T_SIGNED }, { "__inline", T_INLINE }, { "__inline__", T_INLINE }, { "__extension__", T_EXTENSION }, { "__attribute__", T_ATTRIBUTE }, { "__ibm128", T_LONG_DOUBLE }, { "__float128", T_LONG_DOUBLE }, { "_Float128", T_LONG_DOUBLE }, #ifdef vms { "globalvalue", T_EXTERN }, { "globalref", T_EXTERN }, { "globaldef", T_EXTERN }, #endif }; /* *INDENT-ON* */ int result = T_IDENTIFIER; unsigned n; for (n = 0; n < sizeof(table) / sizeof(table[0]); ++n) { if (!strcmp(table[n].name, name)) { result = table[n].code; break; } } switch (result) { case T_IDENTIFIER: if (find_symbol(type_qualifiers, name) != NULL) result = T_TYPE_QUALIFIER; else if (find_symbol(typedef_names, name) != NULL) result = T_TYPEDEF_NAME; else if (find_symbol(define_names, name) != NULL) result = T_DEFINE_NAME; break; } return result; } boolean is_typedef_name(char *name) { return (boolean) (find_symbol(typedef_names, name) != NULL); } /* If the matched text contains any new line characters, then update the * current line number. */ static void update_line_num(void) { char *p = yytext; while (*p != '\0') { if (*p++ == '\n') cur_file->line_num++; } } /* Save the matched text in the temporary file. */ static void save_text(void) { #if OPT_LINTLIBRARY if (!in_cpp) copy_typedef(yytext); #endif if (cur_file->convert) { fputs(yytext, cur_file->tmp_file); } } /* Record the current position in the temporary file and write the matched text * to the file. */ static void save_text_offset(void) { (void) strcpy(yylval.text.text, yytext); #if OPT_LINTLIBRARY copy_typedef(yytext); #endif if (cur_file->convert) { yylval.text.begin = ftell(cur_file->tmp_file); fputs(yytext, cur_file->tmp_file); } else yylval.text.begin = 0; } #if OPT_LINTLIBRARY /* Decipher comments that are useful for lint (and making lint-libraries) */ static struct { int varText; int varargs; int externs; int preproz; } cmtVal; static int decipher_comment(char *keyword, int len) { if (len != 0) { int value; keyword[len] = '\0'; /* these are recognized by some lint-programs */ if (!strcmp(keyword, "VARARGS")) { cmtVal.varargs = -1; } else if (sscanf(keyword, "VARARGS%d", &value) == 1) { cmtVal.varargs = value; } else if (!strcmp(keyword, "PRINTFLIKE")) { cmtVal.varargs = 1; cmtVal.varText = TRUE; } else if (sscanf(keyword, "PRINTFLIKE%d", &value) == 1) { cmtVal.varargs = value; cmtVal.varText = TRUE; } else if (!strcmp(keyword, "SCANFLIKE")) { cmtVal.varargs = 2; cmtVal.varText = TRUE; } else if (sscanf(keyword, "SCANFLIKE%d", &value) == 1) { cmtVal.varargs = value; cmtVal.varText = TRUE; /* these are extensions added to simplify library-generation */ } else if (!strcmp(keyword, "LINT_EXTERN")) { cmtVal.externs = MAX_INC_DEPTH; } else if (sscanf(keyword, "LINT_EXTERN%d", &value) == 1) { cmtVal.externs = value; } else if (!strcmp(keyword, "LINT_PREPRO")) { cmtVal.preproz = -1; /* the whole comment */ } else if (sscanf(keyword, "LINT_PREPRO%d", &value) == 1) { cmtVal.preproz = value; } else if (!strcmp(keyword, "LINT_SHADOWED")) { lint_shadowed = TRUE; } } return 0; } #endif static void put_quoted(int c) { /* Modifying 'yytext[]' doesn't work well with FLEX, which simply * maintains 'yytext' as a pointer into its input buffer. LEX copies * characters into the 'yytext[]' array. */ #if defined(FLEX_SCANNER) || !defined(YYLMAX) if (c != 0) { static char temp[2]; temp[0] = (char) c; /* save_text */ # if OPT_LINTLIBRARY if (!in_cpp) copy_typedef(temp); # endif if (cur_file->convert) { fputs(temp, cur_file->tmp_file); } /* update_line_num */ if (c == '\n') cur_file->line_num++; } #else /* this works fine on LEX (e.g., on SunOS 4.x) */ if ((c == 0) || (yyleng + 1 >= YYLMAX)) { save_text(); update_line_num(); yyleng = 0; } if (c != 0) { yytext[yyleng++] = (char) c; yytext[yyleng] = 0; } #endif /* LEX/FLEX */ } /* * Scan past the characters in a backslash sequence */ /* Scan past quoted string. Note that some strings may overflow 'yytext[]', so * we don't try to eat them in the lexical rules. */ static void get_quoted(void) { int delim = *yytext; int c; #if defined(FLEX_SCANNER) || !defined(YYLMAX) put_quoted(delim); #endif while ((c = LexInput()) != 0) { if (c == '\\') { put_quoted(c); if ((c = LexInput()) == 0) break; put_quoted(c); } else { put_quoted(c); if (c == delim) break; if (c == '\n') { /* recover from unbalanced */ put_error(); fprintf(stderr, "unbalanced quote character '%c'\n", delim); break; } } } put_quoted(0); } /* Scan to end of comment. */ static void get_comment(void) { int c, lastc = '\0'; #if OPT_LINTLIBRARY unsigned len = 0; char keyword[BUFSIZ]; keyword[len] = '\0'; cmtVal.varText = 0; cmtVal.varargs = 0; cmtVal.externs = -1; cmtVal.preproz = 0; #endif while ((c = LexInput()) != 0) { if (cur_file->convert) fputc(c, cur_file->tmp_file); #if OPT_LINTLIBRARY if (!(isalnum(c) || c == '_' || c == '$')) { int flag = cmtVal.preproz; len = (unsigned) decipher_comment(keyword, (int) len); if (flag != cmtVal.preproz) lastc = '\0'; } else if (len + 1 < sizeof(keyword)) { keyword[len++] = (char) c; } #endif switch (c) { case '\n': cur_file->line_num++; #if OPT_LINTLIBRARY if (cmtVal.preproz != 0 && lastc != '\0') fputc(lastc, stdout); if (cmtVal.preproz > 0) /* if negative, we pass everything */ cmtVal.preproz -= 1; #endif break; case '/': if (lastc == '*') { if (cur_file->convert) { if (func_params && cur_declarator) { cur_declarator->begin_comment = cur_file->begin_comment; cur_file->begin_comment = ftell(cur_file->tmp_file); cur_declarator->end_comment = cur_file->begin_comment; cur_declarator = NULL; } else { cur_file->end_comment = ftell(cur_file->tmp_file); } } #if OPT_LINTLIBRARY (void) decipher_comment(keyword, (int) len); if (cmtVal.varargs != 0) { if ((varargs_num = cmtVal.varargs) != 0 && cmtVal.varText != 0) { if (varargs_str != 0) free(varargs_str); varargs_str = xstrdup(keyword); } } if (cmtVal.externs >= 0) extern_in = (unsigned) cmtVal.externs; if (cmtVal.preproz != 0) fputc('\n', stdout); #endif return; } /* FALLTHRU */ default: #if OPT_LINTLIBRARY if (cmtVal.preproz != 0 && lastc != '\0') fputc(lastc, stdout); #endif break; } lastc = c; } } /* Scan rest of preprocessor directive. If copy is true, then store the text * in temp_buf. */ static void get_cpp_directive(int copy) { unsigned used = 0; char c, lastc[4]; lastc[0] = lastc[1] = lastc[2] = lastc[3] = '\0'; if (copy) { need_temp((size_t) 2); *temp_buf = '\0'; } while ((c = (char) LexInput()) != 0) { if (cur_file->convert) fputc(c, cur_file->tmp_file); switch (c) { case '\n': cur_file->line_num++; if (lastc[2] != '\\' && strcmp(lastc, "?\?/") != 0) { finishCpp(); return; } break; case '*': if (lastc[2] == '/') get_comment(); break; } lastc[0] = lastc[1]; lastc[1] = lastc[2]; lastc[2] = c; if (copy) { if (used + 2 >= temp_len) need_temp(temp_len + MAX_TEXT_SIZE); temp_buf[used++] = c; temp_buf[used] = '\0'; } } } /* * Ensure that the filename buffer is large enough to hold yytext, e.g., if * the sscanf gave the whole buffer. */ static void parsing_file_name(unsigned need) { need += 2; if (cur_file->len_file_name < need) { cur_file->len_file_name += need; cur_file->file_name = (char *) xrealloc(cur_file->file_name, cur_file->len_file_name); } cur_file->file_name[0] = 0; } /* Return a pointer to the current file name. */ char * cur_file_name(void) { return cur_file->file_name; } /* Return the current line number. */ unsigned cur_line_num(void) { return cur_file->line_num; } /* Return the current temporary output file. */ FILE * cur_tmp_file(void) { return cur_file->tmp_file; } /* Set the modify flag for the current file. */ void cur_file_changed(void) { cur_file->changed = TRUE; } /* Return the temporary file offset of beginning of the current comment. */ long cur_begin_comment(void) { return cur_file->begin_comment; } /* Return the text of the current lexical token. */ char * cur_text(void) { return yytext; } #if !HAVE_TMPFILE /* * tmpfile() - return a FILE* for a temporary file that will be * removed automatically when the program exits. * * Not all systems have the ANSI tmpfile() function yet... * * David W. Sanderson (dws@cs.wisc.edu) * * note - this was in version 3.10 from 1993 - TD */ FILE * tmpfile(void) { char *name; char *tmpdir; FILE *f; if ((tmpdir = getenv("TMPDIR")) == (char *) 0) { tmpdir = "/tmp"; } name = xmalloc(strlen(tmpdir) + 20); sprintf(name, "%s/TfXXXXXX", tmpdir); if (call_mktemp(name)) { if ((f = fopen(name, "w+")) != 0) { if (unlink(name) == -1) { fclose(f); f = 0; } } free(name); } else { perror("tmpfile"); exit(EXIT_FAILURE); } return f; } #endif /* !HAVE_TMPFILE */ /* Push a file onto the include stack. The stream yyin must already * point to the file. */ static void include_file(char *name, /* file name */ int convert) /* if TRUE, convert function definitions */ { if (++inc_depth >= (int) inc_limit) { unsigned need = (inc_limit | 31) + 1; #ifdef FLEX_SCANNER buffer_stack = type_realloc(YY_BUFFER_STATE, buffer_stack, need); #endif inc_stack = type_realloc(IncludeStack, inc_stack, need); while (inc_limit < need) { #ifdef FLEX_SCANNER buffer_stack[inc_limit] = 0; #endif memset(inc_stack + inc_limit, 0, sizeof(*inc_stack)); ++inc_limit; } } cur_file = inc_stack + inc_depth; cur_file->file = yyin; cur_file->base_name = xstrdup(name); cur_file->len_file_name = strlen(name) + MAX_TEXT_SIZE; cur_file->file_name = strcpy((char *) xmalloc(cur_file->len_file_name), name); cur_file->line_num = 1; cur_file->convert = (boolean) convert; cur_file->changed = FALSE; #ifdef FLEX_SCANNER buffer_stack[inc_depth] = yy_create_buffer(yyin, YY_BUF_SIZE); yy_switch_to_buffer(buffer_stack[inc_depth]); #endif if (convert) { cur_file->begin_comment = cur_file->end_comment = 0; cur_file->tmp_file = tmpfile(); if (cur_file->tmp_file == NULL) { fprintf(stderr, "%s: cannot create temporary file\n", progname); cur_file->convert = FALSE; } } } #define BLOCK_SIZE 2048 /* Copy converted C source from the temporary file to the output stream. */ static void put_file(FILE *outf) { char block[BLOCK_SIZE]; long filesize; size_t nread, count; filesize = ftell(cur_file->tmp_file); fseek(cur_file->tmp_file, 0L, 0); while (filesize > 0) { count = (filesize < BLOCK_SIZE) ? (size_t) filesize : BLOCK_SIZE; nread = fread(block, sizeof(char), count, cur_file->tmp_file); if (nread == 0) break; fwrite(block, sizeof(char), nread, outf); filesize -= (long) nread; } } /* Remove the top of the include stack. */ void pop_file(int closed) { FILE *outf; if (!closed && (yyin != stdin)) fclose(yyin); if (cur_file->convert) { if (yyin == stdin) { put_file(stdout); } else if (cur_file->changed) { if ((outf = fopen(cur_file->base_name, "w")) != NULL) { put_file(outf); fclose(outf); } else { fprintf(stderr, "%s: cannot create file %s\n", progname, cur_file->base_name); } } fclose(cur_file->tmp_file); } free(cur_file->base_name); free(cur_file->file_name); #ifdef FLEX_SCANNER yy_delete_buffer(YY_CURRENT_BUFFER); #endif if (--inc_depth >= 0) { cur_file = inc_stack + inc_depth; yyin = cur_file->file; #ifdef FLEX_SCANNER yy_switch_to_buffer(buffer_stack[inc_depth]); #endif } } /* Process include directive. */ static void do_include(char *file_spec) /* path surrounded by "" or <> */ { unsigned stdinc; /* 1 = path surrounded by <> */ char *file; char *path; char match, *s; unsigned i; unsigned n; FILE *fp; if (file_spec[0] == '"') { match = '"'; stdinc = 0; } else if (file_spec[0] == '<') { match = '>'; stdinc = 1; } else { return; } s = (strchr) (file_spec + 1, match); n = (s != NULL) ? (unsigned) (s - file_spec - 1) : 0; file = xstrdup(file_spec + 1); file[n] = '\0'; /* Do nothing if the file was already included. */ path = (char *) xmalloc(strlen(file) + 3); sprintf(path, stdinc ? "<%s>" : "\"%s\"", file); if (find_symbol(included_files, path) == NULL) { new_symbol(included_files, path, NULL, DS_NONE); for (i = (unsigned) (stdinc != 0); i < num_inc_dir; ++i) { if (strlen(inc_dir[i]) == 0 || !strcmp(inc_dir[i], CURRENT_DIR)) { strcpy(path, file); } else { path = (char *) xrealloc(path, strlen(file) + strlen(inc_dir[i]) + 2); sprintf(path, "%s/%s", inc_dir[i], file); } if ((fp = fopen(path, "r")) != NULL) { yyin = fp; include_file(path, func_style != FUNC_NONE && !stdinc); free(file); free(path); return; } } if (!quiet) { put_error(); fprintf(stderr, "cannot read file %s\n", file_spec); } } free(file); free(path); } /* When the end of the current input file is reached, pop a * nested include file. */ int yywrap(void) { if (inc_depth > 0) { pop_file(FALSE); return 0; } else { return 1; } } #ifdef NO_LEAKS void free_lexer(void) { if (inc_limit != 0) { #ifdef FLEX_SCANNER free(buffer_stack); #endif free(inc_stack); } } #endif cproto-4.7t/dump.h0000644000175100001440000000053211510147077012716 0ustar tomusers/* $Id: dump.h,v 4.6 2011/01/02 19:13:03 tom Exp $ */ #ifndef DUMP_H #define DUMP_H #include extern void dump_parameter(Parameter *p, int level); extern void dump_param_list(ParameterList *p, int level); extern void dump_declarator(Declarator *d, int level); extern void dump_decl_spec(DeclSpec *d, int level); #endif /* DUMP_H */ cproto-4.7t/emx/0000755000175100001440000000000006461721320012367 5ustar tomuserscproto-4.7t/emx/Makefile0000644000175100001440000000152406461721320014031 0ustar tomusers# $Id: Makefile,v 4.3 1998/01/22 19:49:36 cthuang Exp $ # # EMX makefile for C prototype generator PROGRAM = cproto DEFINES = INCLUDES = -I.. LEX = lex YACC = yacc CC = gcc CFLAGS = $(DEFINES) $(INCLUDES) LIBS = VPATH = .. O = .o OBJECTS = \ cproto$(O) \ lintlibs$(O) \ semantic$(O) \ strkey$(O) \ symbol$(O) \ y_tab$(O) all: cproto.exe cproto.exe: $(OBJECTS) $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS) cproto.man: cproto.1 cawf -man $*.1 | bsfilt - >$*.man clean: -del $(PROGRAM).exe -del *$(O) -del *.bak -del *.log # DO NOT DELETE THIS LINE -- make depend depends on it. cproto.o: system.h cproto.h symbol.h lintlibs.o: system.h cproto.h symbol.h semantic.h semantic.o: system.h cproto.h symbol.h semantic.h strkey.o: cproto.h system.h symbol.o: system.h cproto.h symbol.h y_tab.o: lex_yy.c system.h cproto.h symbol.h semantic.h cproto-4.7t/emx/README0000644000175100001440000000012406461030620013240 0ustar tomusersThe files in this directory are used to build using EMX. Makefile makefile for EMX cproto-4.7t/os2/0000755000175100001440000000000006461721323012304 5ustar tomuserscproto-4.7t/os2/run_test.cmd0000644000175100001440000000136506461721322014640 0ustar tomusers/* REXX script to run cproto tests. */ /* $Id: run_test.cmd,v 4.2 1998/01/22 19:49:38 cthuang Exp $ */ "@echo off" testDir = "..\testing" casesFile = testDir||"\run_test.txt" sourceFile = testDir||"\syntax.c" logFile = "run_test.out" echo "Test log" ">" logFile linein(casesFile,1,0); do while lines(casesFile) > 0 parse value linein(casesFile) with caseID '=' platforms '=' options if left(caseID, 4) = "CASE" & pos("os2", platforms) > 0 then do say caseID baseName = "case"||substr(caseID, 6, 2) inputFile = baseName||".c" outputFile = baseName||".out" refFile = testDir||"\"||baseName||".ref" copy sourceFile inputFile ">nul" cproto options inputFile ">" outputFile echo n "|" comp outputFile refFile ">>" logFile end end cproto-4.7t/os2/README0000644000175100001440000000023406461035676013174 0ustar tomusersThe files in this directory are used to build and test on OS/2. watcom.mak makefile for Watcom C/C++ run_test.cmd REXX script to run the regression tests cproto-4.7t/os2/watcom.mak0000644000175100001440000000142406461721323014271 0ustar tomusers# $Id: watcom.mak,v 4.3 1998/01/22 19:49:39 cthuang Exp $ # # Watcom makefile for C prototype generator # To use this file, do # # wmake /u /f watcom.mak PROGRAM = cproto DEFINES = INCLUDES = -I.. -I..\porting LEX = lex YACC = yacc CC = wcl386 CFLAGS = $(DEFINES) $(INCLUDES) LIBS = .c: .. .c.obj: .AUTODEPEND $(CC) $(CFLAGS) /c $< O = .obj OBJECTS = \ cproto$(O) \ getopt$(O) \ lintlibs$(O) \ semantic$(O) \ strkey$(O) \ symbol$(O) \ y_tab$(O) all: $(PROGRAM).exe $(PROGRAM).exe: $(OBJECTS) $(CC) $(CFLAGS) /fe=$@ $(OBJECTS) $(LIBS) getopt$(O): ..\porting\getopt.c $(CC) $(CFLAGS) /c ..\porting\getopt.c cproto.man: cproto.1 cawf -man $*.1 | bsfilt - >$*.man clean: -del $(PROGRAM).exe -del *$(O) -del *.err -del *.log -del *.out -del case*.c test: run_test cproto-4.7t/vms/0000755000175100001440000000000010346114277012407 5ustar tomuserscproto-4.7t/vms/descrip.mms0000644000175100001440000000353010346114277014557 0ustar tomusers# $Id: descrip.mms,v 4.2 2005/12/08 20:34:07 tom Exp $ # VAX/VMS "mms" script for CPROTO THIS = cproto #### Start of system configuration section. #### LEX = flex #YACC = bison /fixed_outfiles YACC = bison DEFINES = /Define=(STDC_HEADERS) CFLAGS = /Include=([]) $(DEFINES) #### End of system configuration section. #### DOC_FILES = \ README \ CHANGES \ $(THIS).1 H_FILES = \ yyerror.c \ system.h \ $(THIS).h \ patchlev.h \ semantic.h \ symbol.h C_FILES = \ $(THIS).c \ lintlibs.c \ semantic.c \ strkey.c \ symbol.c \ getopt.c AUX_FILES = \ mkdirs.sh \ lex.l \ grammar.y LEX_YY = lexyy Y_TAB = y_tab JUNK = \ $(LEX_YY).c \ $(Y_TAB).c OBJECTS = \ $(THIS).obj, \ lintlibs.obj, \ semantic.obj, \ strkey.obj, \ symbol.obj, \ $(Y_TAB).obj, \ getopt.obj SOURCES = $(DOC_FILES) $(H_FILES) $(C_FILES) $(AUX_FILES) all : $(THIS).exe @ write sys$output "** produced $?" $(THIS).exe : $(OBJECTS) $(LINK)/exec=$(THIS) $(OBJECTS),sys$library:vaxcrtl/lib,tools$$library:alloca.obj $(Y_TAB).c : grammar.y $(YACC) grammar.y/fixed_outfiles $(LEX_YY).c : lex.l $(LEX) lex.l clean : - if f$search("*.obj").nes."" then dele/nolog *.obj;* - if f$search("*.lis").nes."" then dele/nolog *.lis;* - if f$search("*.log").nes."" then dele/nolog *.log;* - if f$search("*.map").nes."" then dele/nolog *.map;* - if f$search("$(Y_TAB).c").nes."" then dele/nolog $(Y_TAB).c;* - if f$search("$(LEX_YY).c").nes."" then dele/nolog $(LEX_YY).c;* clobber : clean - if f$search("$(THIS).exe").nes."" then dele/nolog $(THIS).exe;* cproto.obj : cproto.h system.h patchlev.h lintlibs.obj : cproto.h system.h semantic.h symbol.h semantic.obj : cproto.h system.h semantic.h strkey.obj : cproto.h system.h symbol.obj : cproto.h system.h symbol.h $(Y_TAB).obj : cproto.h system.h symbol.h semantic.h $(LEX_YY).c yyerror.c $(Y_TAB).c $(CC) $(CFLAGS) $(Y_TAB).c cproto-4.7t/vms/README0000644000175100001440000000012606461035676013276 0ustar tomusersThe files in this directory are used to build on VMS. descrip.mms makefile for VAX C cproto-4.7t/dump.c0000644000175100001440000000540011510147473012710 0ustar tomusers/* $Id: dump.c,v 4.5 2011/01/02 19:17:15 tom Exp $ * * useful dumps for cproto */ #include #include static char *whatFuncDefStyle(FuncDefStyle func_def); static char *flagsDeclSpec(int flags); #define PAD char pad[80]; sprintf(pad, "%-*s", level * 3, ".") #ifndef DEBUG #define DEBUG 0 #endif #if DEBUG > 1 #define SHOW_CMTS(p) Trace p; #else #define SHOW_CMTS(p) #endif static char * whatFuncDefStyle(FuncDefStyle func_def) /* style of function definition */ { switch (func_def) { case FUNC_NONE: return "FUNC_NONE"; case FUNC_TRADITIONAL: return "FUNC_TRADITIONAL"; case FUNC_ANSI: return "FUNC_ANSI"; case FUNC_BOTH: return "FUNC_BOTH"; } return "?"; } void dump_parameter(Parameter * p, int level) { dump_declarator(p->declarator, level + 1); dump_decl_spec(&(p->decl_spec), level + 1); } void dump_param_list(ParameterList * p, int level) { struct parameter *q; for (q = p->first; q != 0; q = q->next) { dump_parameter(q, level); } } void dump_declarator(Declarator * d, int level) { PAD; Trace("%sdeclarator %p\n", pad, d); Trace("%s name /%s/\n", pad, d->name); Trace("%s text /%s/\n", pad, d->text); SHOW_CMTS(("%s begin %ld\n", pad, d->begin)) SHOW_CMTS(("%s begin_comment %ld\n", pad, d->begin_comment)) SHOW_CMTS(("%s end_comment %ld\n", pad, d->end_comment)) Trace("%s func_def %s\n", pad, whatFuncDefStyle(d->func_def)); #if DEBUG > 1 if (d->func_def != FUNC_NONE) { Trace("%s >PARAMS of %p\n", pad, d); dump_param_list(&(d->params), level + 1); } #endif Trace("%s pointer %s\n", pad, d->pointer ? "YES" : "NO"); if (d->head != 0 && d != d->head) { Trace("%s >HEAD of %p\n", pad, d); dump_declarator(d->head, level + 1); } if (d->func_stack != 0) { Trace("%s >FUNC_STACK of %p\n", pad, d); dump_declarator(d->func_stack, level + 1); } if (d->next != 0) { Trace("%s >NEXT of %p\n", pad, d); dump_declarator(d->next, level + 1); } } static char * flagsDeclSpec(int flags) { static char temp[100]; static struct { int mask; char *text; } table[] = { { DS_EXTERN, "extern" }, { DS_STATIC, "static" }, { DS_CHAR, "char" }, { DS_SHORT, "short" }, { DS_FLOAT, "float" }, { DS_JUNK, "junk" }, }; unsigned j; *temp = 0; for (j = 0; j < sizeof(table) / sizeof(table[0]); j++) { if (flags & table[j].mask) { if (*temp) (void) strcat(temp, ","); (void) strcat(temp, table[j].text); } } return temp; } void dump_decl_spec(DeclSpec * d, int level) { PAD; Trace("%sdecl_spec %p\n", pad, d); Trace("%s flags %s\n", pad, flagsDeclSpec(d->flags)); Trace("%s text /%s/\n", pad, d->text); SHOW_CMTS(("%s begin %ld\n", pad, d->begin)) } cproto-4.7t/cproto.10000644000175100001440000002255514150117465013202 0ustar tomusers.\" $Id: cproto.1,v 4.14 2021/11/26 08:47:49 tom Exp $ .\" .de Ex .RS +7 .PP .nf .ft CW .. .de Ee .fi .ft R .RE .. .ie \n(.g .ds `` \(lq .el .ds `` `` .ie \n(.g .ds '' \(rq .el .ds '' '' .TH CPROTO 1 "2021-11-26" "Version 4.7t" "USER COMMANDS" . .SH NAME cproto \- generate C function prototypes and convert function definitions . .SH SYNOPSIS .B cproto [ .I option \fP...\fI ] [ .I file \fP...\fI ] . .SH DESCRIPTION .B Cproto generates function prototypes for functions defined in the specified C source files to the standard output. The function definitions may be in the old style or ANSI C style. Optionally, .B cproto also outputs declarations for variables defined in the files. If no .I file argument is given, .B cproto reads its input from the standard input. .LP By giving a command line option, .B cproto will also convert function definitions in the specified files from the old style to the ANSI C style. The original source files along with files specified by .Ex #include "file" .Ee .PP directives appearing in the source code will be overwritten with the converted code. If no file names are given on the command line, then the program reads the source code from the standard input and outputs the converted source to the standard output. .LP If any comments appear in the parameter declarations for a function definition, such as in the example, .Ex main (argc, argv) int argc; /* number of arguments */ char *argv[]; /* arguments */ { } .Ee .PP then the converted function definition will have the form .Ex int main ( int argc, /* number of arguments */ char *argv[] /* arguments */ ) { } .Ee .PP Otherwise, the converted function definition will look like .Ex int main (int argc, char *argv[]) { } .Ee .LP .B Cproto can optionally convert function definitions from the ANSI style to the old style. In this mode, the program also converts function declarators and prototypes that appear outside function bodies. This is not a complete ANSI C to old C conversion. The program does not change anything within function bodies. .LP .B Cproto can optionally generate source in lint\-library format. This is useful in environments where the \fBlint\fR utility is used to supplement prototype checking of your program. . .SH OPTIONS .TP .B \-e Output the keyword .B extern in front of every generated prototype or declaration that has global scope. .TP .BI \-f " n" Set the style of generated function prototypes where .I n is a number from 0 to 3. For example, consider the function definition .Ex main (argc, argv) int argc; char *argv[]; { } .Ee .IP If the value is 0, then no prototypes are generated. When set to 1, the output is: .Ex int main(/*int argc, char *argv[]*/); .Ee .IP For a value of 2, the output has the form: .Ex int main(int /*argc*/, char */*argv*/[]); .Ee .IP The default value is 3. It produces the full function prototype: .Ex int main(int argc, char *argv[]); .Ee .TP .B \-l Generate text for a lint\-library (overrides the \*(``\fB\-f\fR\*('' option). The output includes the comment .Ex /* LINTLIBRARY */ .Ee .IP Special comments LINT_EXTERN and LINT_PREPRO (a la \*(``VARARGS\*('') respectively turn on the \*(``\-x\*('' option and copy comment\-text to the output (for preprocessing in \fBlint\fR). Use the comment .Ex /* LINT_EXTERN2 */ .Ee .IP to include externs defined in the first level of include\-files. Use the comment .Ex /* LINT_SHADOWED */ .Ee .IP to cause .B cproto to put \*(``#undef\*('' directives before each lint library declaration (i.e., to avoid conflicts with macros that happen to have to have the same name as the functions, thus causing syntax errors). .IP Note that these special comments are not supported under VAX/VMS, since there is no equivalent for the \*(``\-C\*('' option of cpp with VAX\-C. .TP .B \-c The parameter comments in the prototypes generated by the \-f1 and \-f2 options are omitted by default. Use this option to enable the output of these comments. .TP .B \-m Put a macro around the parameter list of every generated prototype. For example: .Ex int main P_((int argc, char *argv[])); .Ee .TP .BI \-M " name" Set the name of the macro used to surround prototype parameter lists when option \-m is selected. The default is \*(``P_\*(''. .TP .B \-n Rather than filling in \*(``void\*('' for functions without parameters, use a comment \*(``/*empty*/\*(''. .TP .BI \-N " name" Rather than filling in \*(``void\*('' for functions without parameters, use the given \fIname\fP. .TP .B \-d Omit the definition of the prototype macro used by the \-m option. .TP .BI \-o " file" Specify the name of the output file (default: standard output). .TP .BI \-O " file" Specify the name of the error file (default: standard error). .TP .B \-p Disable promotion of formal parameters in old style function definitions. By default, parameters of type .B char or .B short in old style function definitions are promoted to type .B int in the function prototype or converted ANSI C function definition. Parameters of type .B float get promoted to .B double as well. .TP .B \-q Do not output any error messages when the program cannot read the file specified in an .I #include directive. .TP .B \-s By default, .B cproto only generates declarations for functions and variables having global scope. This option will output .B static declarations as well. .TP .B \-S Output only static declarations. .TP .B \-i By default, .B cproto only generates declarations for functions and variables having global scope. This option will output .B inline declarations as well. .TP .B \-T Copy type definitions from each file. (Definitions in included\-files are copied, unlike the \*(``\-l\*('' option). .TP .B \-v Also output declarations for variables defined in the source. .TP .B \-x This option causes procedures and variables which are declared \*(``extern\*('' to be included in the output. .TP .BI \-X " level" This option limits the include\-file level from which declarations are extracted by examining the preprocessor output. .TP .B \-a Convert function definitions from the old style to the ANSI C style. .TP .B \-t Convert function definitions from the ANSI C style to the traditional style. .TP .B \-b Rewrite function definition heads to include both old style and new style declarations separated by a conditional compilation directive. For example, the program can generate this function definition: .Ex #ifdef ANSI_FUNC int main (int argc, char *argv[]) #else int main (argc, argv) int argc; char *argv[] #endif { } .Ee .TP .BI \-B " directive" Set the conditional compilation directive to output at the beginning of function definitions generated by the \-b option. The default is .Ex #ifdef ANSI_FUNC .Ee .LP .nf .BI \-P " template" .BI \-F " template" .BI \-C " template" .fi .in +7n Set the output format for generated prototypes, function definitions, and function definitions with parameter comments respectively. The format is specified by a template in the form .Ex " int f ( a, b )" .Ee .IP but you may replace each space in this string with any number of whitespace characters. For example, the option .Ex \-F"int f(\\n\\ta,\\n\\tb\\n\\t)" .Ee .IP will produce .Ex int main( int argc, char *argv[] ) .Ee .TP .BI \-D " name[=value]" This option is passed through to the preprocessor and is used to define symbols for use with conditionals such as .I #ifdef. .TP .BI \-U " name" This option is passed through to the preprocessor and is used to remove any definitions of this symbol. .TP .BI \-I " directory" This option is passed through to the preprocessor and is used to specify a directory to search for files that are referenced with .I #include. .TP .BI \-E " cpp" Pipe the input files through the specified C preprocessor command when generating prototypes. By default, the program uses /lib/cpp. .TP .BI \-E " 0" Do not run the C preprocessor. .TP .B \-V Print version information. . .SH ENVIRONMENT The environment variable CPROTO is scanned for a list of options in the same format as the command line options. Options given on the command line override any corresponding environment option. . .SH BUGS If an un\-tagged struct, union or enum declaration appears in a generated function prototype or converted function definition, the content of the declaration between the braces is empty. .LP The program does not pipe the source files through the C preprocessor when it is converting function definitions. Instead, it tries to handle preprocessor directives and macros itself and can be confused by tricky macro expansions. The conversion also discards some comments in the function definition head. .LP The \-v option does not generate declarations for variables defined with the .B extern specifier. This doesn't strictly conform to the C language standard but this rule was implemented because include files commonly declare variables this way. .LP When the program encounters an error, it usually outputs the not very descriptive message \*(``syntax error\*(''. (Your configuration may allow the extended error reporting in yyerror.c). .LP Options that take string arguments only interpret the following character escape sequences: .Ex \\n newline \\s space \\t tab .Ee .LP VARARGS comments don't get passed through on systems whose C preprocessors don't support this (e.g., VAX/VMS, MS\-DOS). . .SH AUTHOR .nf Chin Huang cthuang@vex.net cthuang@interlog.com .sp Thomas E. Dickey dickey@invisible\-island.net modifications to support lint library, type\-copying, and port to VAX/VMS. .fi . .SH "SEE ALSO" cc(1), cpp(1) cproto-4.7t/win32/0000755000175100001440000000000006461721330012541 5ustar tomuserscproto-4.7t/win32/README0000644000175100001440000000016206461037060013420 0ustar tomusersThe files in this directory are used to build on Windows 95 and Windows NT. watcom.mak makefile for Watcom C/C++ cproto-4.7t/win32/watcom.mak0000644000175100001440000000140306461721330014523 0ustar tomusers# $Id: watcom.mak,v 4.3 1998/01/22 19:49:44 cthuang Exp $ # # Watcom makefile for C prototype generator # To use this file, do # # wmake /u /f watcom.mak PROGRAM = cproto DEFINES = INCLUDES = -I.. -I..\porting LEX = lex YACC = yacc CC = wcl386 CFLAGS = $(DEFINES) $(INCLUDES) LIBS = .c: .. .c.obj: .AUTODEPEND $(CC) $(CFLAGS) /c $< O = .obj OBJECTS = \ cproto$(O) \ getopt$(O) \ lintlibs$(O) \ semantic$(O) \ strkey$(O) \ symbol$(O) \ y_tab$(O) all: $(PROGRAM).exe $(PROGRAM).exe: $(OBJECTS) $(CC) $(CFLAGS) /fe=$@ $(OBJECTS) $(LIBS) getopt$(O): ..\porting\getopt.c $(CC) $(CFLAGS) /c ..\porting\getopt.c cproto.man: cproto.1 cawf -man $*.1 | bsfilt - >$*.man clean: -del $(PROGRAM).exe -del *$(O) -del *.err -del *.log -del *.out -del case*.c cproto-4.7t/testing/0000755000175100001440000000000013704153601013252 5ustar tomuserscproto-4.7t/testing/case06.ref0000644000175100001440000000247410736541443015047 0ustar tomusers/* case06.c */ char x6; short x7; int x8; long x9; float x10; double x11; signed x12; unsigned x13; x4t x17; const x18; volatile x19; void badFunc(int *badStyle); _FIRST first; _FIRST last; _FIRST first_last[]; struct _second _SECOND; int i[]; float f[]; int array[][10][20]; int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int p1, char p2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *p1, int p2[], float p); int *(func_func)(void); bool a1; struct zip2 z2; struct {} z3; enum zap1 what; enum zap2 what2; enum {} what3; int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); long long xxx; char *xxs; cproto-4.7t/testing/case24.ref0000644000175100001440000000212710023451631015026 0ustar tomusers/* case24.c */ void badFunc(int *badStyle); int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int p1, char p2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *p1, int p2[], float p); int *(func_func)(void); int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); static void_junk *foo_void2(void); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); int inline inline_func(double x); static int inline local_inline_func(double x); cproto-4.7t/testing/case15.ref0000644000175100001440000006236105405406620015042 0ustar tomusers/* LINTLIBRARY */ /* apollo.c */ #undef COMPLETE_SR10_2 #ifdef __STDC__ #ident Standard LLIB #else #ident Traditional LLIB #include short pm_$errout; uid_$t uid_$nil; void lib_$init_set(set, size) void *set; short size; { /* void */ } void lib_$add_to_set(set, size, element) void *set; short size; short element; { /* void */ } void lib_$clr_from_set(set, size, element) void *set; short size; short element; { /* void */ } boolean lib_$member_of_set(set, size, element) void *set; short size; short element; { return(*(boolean *)0); } #include void aclm_$up() { /* void */ } void aclm_$down() { /* void */ } #include void cal_$decode_ascii_time(string, string_length, hour, minute, second, status) char *string; short string_length; short *hour; short *minute; short *second; status_$t *status; { /* void */ } void cal_$decode_ascii_date(string, string_length, year, month, day, status) char *string; short string_length; short *year; short *month; short *day; status_$t *status; { /* void */ } void cal_$decode_ascii_tzdif(string, string_length, tz_dif, tz_name, status) char *string; short string_length; short *tz_dif; cal_$tz_name_t tz_name; status_$t *status; { /* void */ } void cal_$decode_time(clock, decoded_clock) time_$clock_t clock; cal_$timedate_rec_t *decoded_clock; { /* void */ } void cal_$encode_time(decoded_clock, clock) cal_$timedate_rec_t decoded_clock; time_$clock_t *clock; { /* void */ } void cal_$decode_local_time(decoded_clock) cal_$timedate_rec_t *decoded_clock; { /* void */ } cal_$weekday_t cal_$weekday(year, month, day) short year; short month; short day; { return(*(cal_$weekday_t *)0); } void cal_$apply_local_offset(clock) time_$clock_t *clock; { /* void */ } void cal_$remove_local_offset(clock) time_$clock_t *clock; { /* void */ } void cal_$get_local_time(clock) time_$clock_t *clock; { /* void */ } void cal_$write_timezone(timezone_info, status) cal_$timezone_rec_t timezone_info; status_$t *status; { /* void */ } void cal_$sec_to_clock(seconds, clock) unsigned long seconds; time_$clock_t *clock; { /* void */ } unsigned long cal_$clock_to_sec(clock) time_$clock_t clock; { return(*(unsigned long *)0); } void cal_$get_info(timezone_info) cal_$timezone_rec_t *timezone_info; { /* void */ } void cal_$float_clock(clock, float_seconds) time_$clock_t clock; double *float_seconds; { /* void */ } void cal_$add_clock(clock1, clock2) time_$clock_t *clock1; time_$clock_t clock2; { /* void */ } boolean cal_$sub_clock(clock1, clock2) time_$clock_t *clock1; time_$clock_t clock2; { return(*(boolean *)0); } short cal_$cmp_clock(clock1, clock2) time_$clock_t clock1; time_$clock_t clock2; { return(*(short *)0); } #include void error_$find_text(status, sub_np, sub_nl, mod_np, mod_nl, err_p, err_l) status_$t status; char **sub_np; short *sub_nl; char **mod_np; short *mod_nl; char **err_p; short *err_l; { /* void */ } void error_$get_text(status, sub_n, sub_nl, mod_n, mod_nl, err_t, err_l) status_$t status; error_$string_t sub_n; short *sub_nl; error_$string_t mod_n; short *mod_nl; error_$string_t err_t; short *err_l; { /* void */ } void error_$print(status) status_$t status; { /* void */ } void error_$print_name(status, name, namelen) status_$t status; char *name; pinteger namelen; { /* void */ } /* VARARGS6 */ void error_$print_format(status, strm, prechr, command, commlen, str) status_$t status; stream_$id_t strm; char prechr; error_$string_t command; short commlen; char *str; { /* void */ } void error_$init_std_format(strm, prechr, command, commlen) stream_$id_t strm; char prechr; char *command; short commlen; { /* void */ } /* VARARGS2 */ void error_$std_format(status, str) status_$t status; char *str; { /* void */ } boolean error_$fail(status) status_$t status; { return(*(boolean *)0); } short error_$subsys(status) status_$t status; { return(*(short *)0); } short error_$module(status) status_$t status; { return(*(short *)0); } short error_$code(status) status_$t status; { return(*(short *)0); } #include boolean ev_$set_var(name, namelen, value, valuelen) char *name; short namelen; char *value; short valuelen; { return(*(boolean *)0); } boolean ev_$get_var(name, namelen, value_ptr, valuelen) char *name; short namelen; char **value_ptr; short *valuelen; { return(*(boolean *)0); } boolean ev_$exist_var(name, namelen) char *name; short namelen; { return(*(boolean *)0); } boolean ev_$delete_var(name, namelen) char *name; short namelen; { return(*(boolean *)0); } boolean ev_$read_var_entry(ix, name_ptr, namelen, value_ptr, valuelen) short *ix; char **name_ptr; short *namelen; char **value_ptr; short *valuelen; { return(*(boolean *)0); } #include xoid_$t xoid_$nil; ios_$id_t ios_$open(n, l, opts, st) char *n; short l; ios_$open_options_t opts; status_$t *st; { return(*(ios_$id_t *)0); } void ios_$create(name, name_len, type_uid, cmode, oopts, id, status) char *name; short name_len; uid_$t type_uid; ios_$create_mode_t cmode; ios_$open_options_t oopts; ios_$id_t *id; status_$t *status; { /* void */ } void ios_$close(id, st) ios_$id_t id; status_$t *st; { /* void */ } void ios_$get_ec(id, key, ecp, st) ios_$id_t id; ios_$ec_key_t key; ec2_$ptr_t *ecp; status_$t *st; { /* void */ } void ios_$delete(id, st) ios_$id_t id; status_$t *st; { /* void */ } void ios_$truncate(id, st) ios_$id_t id; status_$t *st; { /* void */ } long ios_$get(id, opt, b, l, st) ios_$id_t id; ios_$put_get_opts_t opt; char *b; long l; status_$t *st; { return(*(long *)0); } long ios_$locate(id, opt, b, l, st) ios_$id_t id; ios_$put_get_opts_t opt; char **b; long l; status_$t *st; { return(*(long *)0); } void ios_$put(id, opt, b, l, st) ios_$id_t id; ios_$put_get_opts_t opt; char *b; long l; status_$t *st; { /* void */ } long ios_$putp(id, opt, b, l, st) ios_$id_t id; ios_$put_get_opts_t opt; char *b; long l; status_$t *st; { return(*(long *)0); } long ios_$inq_rec_remainder(id, st) ios_$id_t id; status_$t *st; { return(*(long *)0); } ios_$mgr_flag_set ios_$inq_mgr_flags(id, st) ios_$id_t id; status_$t *st; { return(*(ios_$mgr_flag_set *)0); } ios_$obj_flag_set ios_$inq_obj_flags(id, st) ios_$id_t id; status_$t *st; { return(*(ios_$obj_flag_set *)0); } void ios_$set_obj_flag(id, f, on_off, st) ios_$id_t id; ios_$obj_flag_t f; boolean on_off; status_$t *st; { /* void */ } ios_$conn_flag_set ios_$inq_conn_flags(id, st) ios_$id_t id; status_$t *st; { return(*(ios_$conn_flag_set *)0); } void ios_$set_conn_flag(id, f, on_off, st) ios_$id_t id; ios_$conn_flag_t f; boolean on_off; status_$t *st; { /* void */ } void ios_$seek(id, abs_rel, seek_type, key, st) ios_$id_t id; ios_$abs_rel_t abs_rel; ios_$seek_type_t seek_type; long key; status_$t *st; { /* void */ } void ios_$seek_full_key(id, key, status) ios_$id_t id; ios_$seek_key_t key; status_$t *status; { /* void */ } void ios_$seek_short_key(id, key, status) ios_$id_t id; long key; status_$t *status; { /* void */ } void ios_$seek_to_bof(id, status) ios_$id_t id; status_$t *status; { /* void */ } void ios_$seek_to_eof(id, status) ios_$id_t id; status_$t *status; { /* void */ } long ios_$inq_short_key(id, pos_opt, status) ios_$id_t id; ios_$pos_opt_t pos_opt; status_$t *status; { return(*(long *)0); } void ios_$inq_full_key(id, pos_opt, key, status) ios_$id_t id; ios_$pos_opt_t pos_opt; ios_$seek_key_t *key; status_$t *status; { /* void */ } long ios_$inq_rec_pos(id, pos_opt, st) ios_$id_t id; ios_$pos_opt_t pos_opt; status_$t *st; { return(*(long *)0); } long ios_$inq_byte_pos(id, pos_opt, status) ios_$id_t id; ios_$pos_opt_t pos_opt; status_$t *status; { return(*(long *)0); } long ios_$inq_cur_rec_len(id, status) ios_$id_t id; status_$t *status; { return(*(long *)0); } ios_$rtype_t ios_$inq_rec_type(id, status) ios_$id_t id; status_$t *status; { return(*(ios_$rtype_t *)0); } void ios_$set_rec_type(id, rec_type, rec_len, status) ios_$id_t id; ios_$rtype_t rec_type; long rec_len; status_$t *status; { /* void */ } void ios_$force_write_file(id, status) ios_$id_t id; status_$t *status; { /* void */ } void ios_$inq_file_attr(id, dtc, dtm, dtu, blks, status) ios_$id_t id; time_$clockh_t *dtc; time_$clockh_t *dtm; time_$clockh_t *dtu; long *blks; status_$t *status; { /* void */ } void ios_$inq_path_name_lc(strid, ntype, max_nl, name, nl, status) ios_$id_t strid; ios_$name_type_t ntype; short max_nl; char *name; short *nl; status_$t *status; { /* void */ } void ios_$change_path_name(strid, new_name, new_nl, status) ios_$id_t strid; char *new_name; short new_nl; status_$t *status; { /* void */ } void ios_$inq_type_uid(strid, type_uid, status) ios_$id_t strid; uid_$t *type_uid; status_$t *status; { /* void */ } void *ios_$get_handle(strid, type_uid, status) ios_$id_t strid; uid_$t type_uid; status_$t *status; { /* void */ } void ios_$set_locate_buffer_size(id, size, status) ios_$id_t id; short size; status_$t *status; { /* void */ } ios_$id_t ios_$switch(strid1, strid2, status) ios_$id_t strid1; ios_$id_t strid2; status_$t *status; { return(*(ios_$id_t *)0); } ios_$id_t ios_$replicate(strid1, strid2, status) ios_$id_t strid1; ios_$id_t strid2; status_$t *status; { return(*(ios_$id_t *)0); } ios_$id_t ios_$dup(strid1, strid2, status) ios_$id_t strid1; ios_$id_t strid2; status_$t *status; { return(*(ios_$id_t *)0); } boolean ios_$equal(strid1, strid2, status) ios_$id_t strid1; ios_$id_t strid2; status_$t *status; { return(*(boolean *)0); } void ios_$set_dir(pname, plen, dir, status) char *pname; pinteger plen; ios_$dir_type_t dir; status_$t *status; { /* void */ } void ios_$get_dir_lc(dir, max_plen, pname, plen, status) ios_$dir_type_t dir; short max_plen; char *pname; short *plen; status_$t *status; { /* void */ } void ios_$inq_path_name(strid, ntype, name, nl, status) ios_$id_t strid; ios_$name_type_t ntype; char *name; short *nl; status_$t *status; { /* void */ } void ios_$get_dir(dir, pname, plen, status) ios_$dir_type_t dir; char *pname; short *plen; status_$t *status; { /* void */ } #include void name_$get_wdir_lc(maxpathlen, pathname, name_length, status) unsigned short maxpathlen; char *pathname; unsigned short *name_length; status_$t *status; { /* void */ } void name_$get_ndir_lc(maxpathlen, pathname, name_length, status) unsigned short maxpathlen; char *pathname; unsigned short *name_length; status_$t *status; { /* void */ } void name_$create_file(filename, name_length, status) char *filename; unsigned short name_length; status_$t *status; { /* void */ } void name_$delete_file(filename, name_length, status) char *filename; unsigned short name_length; status_$t *status; { /* void */ } void name_$create_directory(directory_name, name_length, status) char *directory_name; unsigned short name_length; status_$t *status; { /* void */ } void name_$delete_directory(directory_name, name_length, status) char *directory_name; unsigned short name_length; status_$t *status; { /* void */ } void name_$read_dir_lc(dir_name, name_length, seek_to_bof, cursor, max_count, dirlistsize, dirlist, read_count, status) char *dir_name; unsigned short name_length; boolean *seek_to_bof; name_$cursor_t *cursor; unsigned short max_count; unsigned long dirlistsize; char *dirlist; unsigned short *read_count; status_$t *status; { /* void */ } void name_$add_link(linkname, name_length, link_text, text_length, status) char *linkname; unsigned short name_length; char *link_text; unsigned short text_length; status_$t *status; { /* void */ } void name_$read_link_lc(linkname, name_length, maxlinklen, link_text, text_length, status) char *linkname; unsigned short name_length; unsigned short maxlinklen; char *link_text; unsigned short *text_length; status_$t *status; { /* void */ } void name_$drop_link(linkname, name_length, status) char *linkname; unsigned short name_length; status_$t *status; { /* void */ } void name_$extract_data_lc(dir_entry, entry_type, entry_length, max_entry_length, entry_name, status) name_$canonical_dir_entry_t dir_entry; short *entry_type; unsigned short *entry_length; unsigned short max_entry_length; char *entry_name; status_$t *status; { /* void */ } void name_$get_path_lc(in_name, in_len, maxpnamelen, out_name, out_len, status) char *in_name; unsigned short in_len; unsigned short maxpnamelen; char *out_name; unsigned short *out_len; status_$t *status; { /* void */ } void name_$cname(old_pathname, old_length, new_leaf, leaf_length, status) char *old_pathname; unsigned short old_length; char *new_leaf; unsigned short leaf_length; status_$t *status; { /* void */ } void name_$set_wdir(name, name_length, status) char *name; unsigned short name_length; status_$t *status; { /* void */ } void name_$get_wdir(name, name_length, status) char *name; unsigned short *name_length; status_$t *status; { /* void */ } void name_$get_wdir_cc(name, name_length, status) char *name; unsigned short *name_length; status_$t *status; { /* void */ } void name_$set_ndir(name, name_length, status) char *name; unsigned short name_length; status_$t *status; { /* void */ } void name_$get_ndir(name, name_length, status) char *name; unsigned short *name_length; status_$t *status; { /* void */ } void name_$get_ndir_cc(name, name_length, status) char *name; unsigned short *name_length; status_$t *status; { /* void */ } void name_$read_dir(dir_name, name_length, dirlist, index, max_count, read_count, status) char *dir_name; unsigned short name_length; name_$dir_entry_t *dirlist; unsigned short *index; unsigned short max_count; unsigned short *read_count; status_$t *status; { /* void */ } void name_$read_dir_cc(dir_name, name_length, dirlist, index, max_count, read_count, status) char *dir_name; unsigned short name_length; name_$dir_entry_t *dirlist; unsigned short *index; unsigned short max_count; unsigned short *read_count; status_$t *status; { /* void */ } void name_$read_link(linkname, name_length, link_text, text_length, status) char *linkname; unsigned short name_length; char *link_text; unsigned short *text_length; status_$t *status; { /* void */ } void name_$extract_data(dir_entry, entry_type, entry_length, entry_name) name_$dir_entry_t dir_entry; unsigned short *entry_type; unsigned short *entry_length; char *entry_name; { /* void */ } void name_$get_path(in_name, in_len, out_name, out_len, status) char *in_name; unsigned short in_len; char *out_name; unsigned short *out_len; status_$t *status; { /* void */ } void name_$get_path_cc(in_name, in_len, out_name, out_len, status) char *in_name; unsigned short in_len; char *out_name; unsigned short *out_len; status_$t *status; { /* void */ } #include void pad_$raw(sid, sts) short sid; status_$t *sts; { /* void */ } void pad_$cooked(sid, sts) short sid; status_$t *sts; { /* void */ } void pad_$create(n, l, ptype, rel_pad, side, options, size, rslt_stream, s) char *n; unsigned short l; pad_$type_t ptype; stream_$id_t rel_pad; pad_$side_t side; pad_$cre_opt_t options; short size; stream_$id_t *rslt_stream; status_$t *s; { /* void */ } void pad_$create_window(n, l, ptype, unit, window, rslt_stream, s) char *n; unsigned short l; pad_$type_t ptype; short unit; pad_$window_desc_t window; stream_$id_t *rslt_stream; status_$t *s; { /* void */ } void pad_$create_frame(sid, width, height, sts) stream_$id_t sid; short width; short height; status_$t *sts; { /* void */ } void pad_$delete_frame(sid, sts) stream_$id_t sid; status_$t *sts; { /* void */ } void pad_$clear_frame(sid, clr_key, sts) stream_$id_t sid; stream_$sk_t clr_key; status_$t *sts; { /* void */ } void pad_$close_frame(sid, sts) stream_$id_t sid; status_$t *sts; { /* void */ } void pad_$move(sid, rel_abs, x, y, sts) stream_$id_t sid; pad_$rel_abs_t rel_abs; short x; short y; status_$t *sts; { /* void */ } void pad_$set_scale(sid, xs, ys, sts) stream_$id_t sid; short xs; short ys; status_$t *sts; { /* void */ } void pad_$load_font(sid, fname, fnl, fontx, sts) stream_$id_t sid; char *fname; short fnl; short *fontx; status_$t *sts; { /* void */ } void pad_$use_font(sid, fontx, sts) stream_$id_t sid; short fontx; status_$t *sts; { /* void */ } void pad_$inq_font(sid, fwidth, fhite, fname, fnsize, fnlen, sts) stream_$id_t sid; short *fwidth; short *fhite; char *fname; short fnsize; short *fnlen; status_$t *sts; { /* void */ } void pad_$inq_windows(sid, wlist, wlsize, wcnt, sts) stream_$id_t sid; pad_$window_desc_t *wlist; short wlsize; short *wcnt; status_$t *sts; { /* void */ } void pad_$inq_position(sid, y, x, sts) stream_$id_t sid; short *y; short *x; status_$t *sts; { /* void */ } void pad_$set_tabs(sid, tsb, cnt, sts) stream_$id_t sid; short *tsb; short cnt; status_$t *sts; { /* void */ } void pad_$cpr_enable(sid, cpr_type, sts) stream_$id_t sid; short cpr_type; status_$t *sts; { /* void */ } void pad_$locate(sid, x, y, c, sts) stream_$id_t sid; short *x; short *y; char *c; status_$t *sts; { /* void */ } void pad_$dm_cmd(sid, cmd, cmd_len, sts) stream_$id_t sid; char *cmd; short cmd_len; status_$t *sts; { /* void */ } void pad_$def_pfk(sid, key_name, def, def_len, sts) stream_$id_t sid; char *key_name; char *def; short def_len; status_$t *sts; { /* void */ } void pad_$edit_wait(sid, sts) stream_$id_t sid; status_$t *sts; { /* void */ } void pad_$inq_disp_type(sid, dtype, unit, sts) stream_$id_t sid; pad_$display_type_t *dtype; short *unit; status_$t *sts; { /* void */ } void pad_$inq_view(sid, window_no, line, eof_lnum, x_offset, y_offset, sts) stream_$id_t sid; short window_no; long *line; long *eof_lnum; short *x_offset; short *y_offset; status_$t *sts; { /* void */ } void pad_$set_view(sid, window_no, line, x_offset, y_offset, sts) stream_$id_t sid; short window_no; long line; short x_offset; short y_offset; status_$t *sts; { /* void */ } void pad_$inq_kbd(sid, buf_size, kbd_suffix, len, sts) stream_$id_t sid; short buf_size; char *kbd_suffix; short *len; status_$t *sts; { /* void */ } void pad_$pop_push_window(sid, window_no, pop_push, sts) stream_$id_t sid; short window_no; boolean pop_push; status_$t *sts; { /* void */ } void pad_$set_border(sid, window_no, border, sts) stream_$id_t sid; short window_no; boolean border; status_$t *sts; { /* void */ } void pad_$create_icon(n, l, ptype, unit, icon_pos, icon_font_char, window, rslt_stream, s) char *n; unsigned short l; pad_$type_t ptype; short unit; pad_$position_t icon_pos; char icon_font_char; pad_$window_desc_t *window; stream_$id_t *rslt_stream; status_$t *s; { /* void */ } void pad_$make_icon(sid, window_no, font_char, sts) stream_$id_t sid; short window_no; char font_char; status_$t *sts; { /* void */ } void pad_$icon_wait(sid, window_no, icon_moved, icon_pos_if_moved, sts) stream_$id_t sid; short window_no; boolean *icon_moved; pad_$position_t *icon_pos_if_moved; status_$t *sts; { /* void */ } void pad_$set_full_window(sid, window_no, window, sts) stream_$id_t sid; short window_no; pad_$window_desc_t *window; status_$t *sts; { /* void */ } void pad_$inq_full_window(sid, window_no, window, sts) stream_$id_t sid; short window_no; pad_$window_desc_t *window; status_$t *sts; { /* void */ } void pad_$set_icon_pos(sid, window_no, icon_pos, font_char, sts) stream_$id_t sid; short window_no; pad_$position_t icon_pos; char font_char; status_$t *sts; { /* void */ } void pad_$inq_icon(sid, window_no, icon_pos, font_char, sts) stream_$id_t sid; short window_no; pad_$position_t *icon_pos; char *font_char; status_$t *sts; { /* void */ } void pad_$make_invisible(sid, window_no, sts) stream_$id_t sid; short window_no; status_$t *sts; { /* void */ } void pad_$select_window(sid, window_no, sts) stream_$id_t sid; short window_no; status_$t *sts; { /* void */ } void pad_$set_auto_close(sid, window_no, auto_close, sts) stream_$id_t sid; short window_no; boolean auto_close; status_$t *sts; { /* void */ } void pad_$inq_icon_font(sid, window_no, font_name, fnbs, fnlen, sts) stream_$id_t sid; short window_no; char *font_name; short fnbs; short *fnlen; status_$t *sts; { /* void */ } void pad_$set_icon_font(sid, window_no, font_name, fnlen, sts) stream_$id_t sid; short window_no; char *font_name; short fnlen; status_$t *sts; { /* void */ } boolean pad_$is_icon(sid, window_no, sts) stream_$id_t sid; short window_no; status_$t *sts; { return(*(boolean *)0); } void pad_$force_prompt(sid, sts) stream_$id_t sid; status_$t *sts; { /* void */ } void pad_$isa(sid, sts) stream_$id_t sid; status_$t *sts; { /* void */ } void pad_$isa_dm_pad(sid, sts) stream_$id_t sid; status_$t *sts; { /* void */ } void pad_$set_erase(sid, window_no, erase, sts) stream_$id_t sid; short window_no; boolean erase; status_$t *sts; { /* void */ } #include void tty_$isa(id, st) ios_$id_t id; status_$t *st; { /* void */ } void tty_$inq_size(id, height, width, st) ios_$id_t id; pinteger *height; pinteger *width; status_$t *st; { /* void */ } void tty_$set_size(id, height, width, st) ios_$id_t id; pinteger height; pinteger width; status_$t *st; { /* void */ } void tty_$set_input_flag(id, flag, val, st) ios_$id_t id; tty_$input_flag_t flag; boolean val; status_$t *st; { /* void */ } tty_$input_flag_set_t tty_$inq_input_flags(id, st) ios_$id_t id; status_$t *st; { return(*(tty_$input_flag_set_t *)0); } void tty_$set_output_flag(id, flag, val, st) ios_$id_t id; tty_$output_flag_t flag; boolean val; status_$t *st; { /* void */ } tty_$output_flag_set_t tty_$inq_output_flags(id, st) ios_$id_t id; status_$t *st; { return(*(tty_$output_flag_set_t *)0); } void tty_$set_echo_flag(id, flag, val, st) ios_$id_t id; tty_$echo_flag_t flag; boolean val; status_$t *st; { /* void */ } tty_$echo_flag_set_t tty_$inq_echo_flags(id, st) ios_$id_t id; status_$t *st; { return(*(tty_$echo_flag_set_t *)0); } void tty_$set_func_char(id, func, ch, st) ios_$id_t id; tty_$func_t func; char ch; status_$t *st; { /* void */ } void tty_$inq_func_char(id, func, ch, st) ios_$id_t id; tty_$func_t func; char *ch; status_$t *st; { /* void */ } void tty_$enable_func(id, func, val, st) ios_$id_t id; tty_$func_t func; boolean val; status_$t *st; { /* void */ } tty_$func_set_t tty_$inq_func_enabled(id, st) ios_$id_t id; status_$t *st; { return(*(tty_$func_set_t *)0); } void tty_$set_process_group(id, uid, st) ios_$id_t id; uid_$t uid; status_$t *st; { /* void */ } void tty_$inq_process_group(id, uid, st) ios_$id_t id; uid_$t *uid; status_$t *st; { /* void */ } void tty_$set_input_break_mode(id, mode, st) ios_$id_t id; tty_$input_break_mode_t *mode; status_$t *st; { /* void */ } void tty_$inq_input_break_mode(id, mode, st) ios_$id_t id; tty_$input_break_mode_t *mode; status_$t *st; { /* void */ } void tty_$drain_output(id, st) ios_$id_t id; status_$t *st; { /* void */ } void tty_$discard_input(id, st) ios_$id_t id; status_$t *st; { /* void */ } void tty_$discard_output(id, st) ios_$id_t id; status_$t *st; { /* void */ } void tty_$simulate_input(id, ch, st) ios_$id_t id; char ch; status_$t *st; { /* void */ } void tty_$set_delay(id, delay, val, st) ios_$id_t id; tty_$delay_t delay; pinteger val; status_$t *st; { /* void */ } pinteger tty_$inq_delay(id, delay, st) ios_$id_t id; tty_$delay_t delay; status_$t *st; { return(*(pinteger *)0); } void tty_$set_unix_mode(id, mode, val, st) ios_$id_t id; tty_$unix_mode_t mode; boolean val; status_$t *st; { /* void */ } tty_$unix_mode_set_t tty_$inq_unix_modes(id, st) ios_$id_t id; status_$t *st; { return(*(tty_$unix_mode_set_t *)0); } void tty_$set_raw(id, val, st) ios_$id_t id; boolean val; status_$t *st; { /* void */ } boolean tty_$inq_raw(id, st) ios_$id_t id; status_$t *st; { return(*(boolean *)0); } void tty_$set_non_canon_break_mode(id, mode, st) ios_$id_t id; tty_$input_break_mode_t *mode; status_$t *st; { /* void */ } #include uid_$t case_hm_$uid; uid_$t cmpexe_$uid; uid_$t coff_$uid; uid_$t d3m_area_$uid; uid_$t d3m_sch_$uid; uid_$t directory_$uid; uid_$t dm_edit_$uid; uid_$t hdr_undef_$uid; uid_$t input_pad_$uid; uid_$t mbx_$uid; uid_$t mt_$uid; uid_$t nulldev_$uid; uid_$t object_file_$uid; uid_$t pad_$uid; uid_$t pty_$slave_uid; uid_$t pty_$uid; uid_$t records_$uid; uid_$t sio_$uid; uid_$t tcp_$uid; uid_$t uasc_$uid; uid_$t unstruct_$uid; cproto-4.7t/testing/case10.ref0000644000175100001440000000337707177074203015045 0ustar tomusers/* case10.c */ typedef int x4t; struct x14; union x15; enum x16; x4t; typedef struct _first { int a:5; struct { int a,b; } b_struct; char b:16, b1:1; long c:16, c1; short d:16, d1:8, d2; unsigned e:16; float f; double g; struct _first *link; } _FIRST; typedef int badStyle; void badFunc(int *badStyle); struct _second { enum {true, false} bool; enum {wrong=1, right=3} values; }; int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int p1, char p2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *p1, int p2[], float p); int *(func_func)(void); typedef int bool; struct ZIP1 { int x1, y1; }; struct zip2 { int x2, y2; }; struct { int x3, y3; }; struct ZIP4 { int x4, y4; }; struct zip5 { int x5, y5; }; struct zip6 { int x6, y6; }; struct { int x7, y7; }; struct { int x8, y8; }; enum zap1 { a,b,c,d }; enum {a9,b9,c9,d9}; typedef struct bong { int (*func)(); } BONG; typedef char *string; int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha { int x,z; } y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); typedef int extern_junk; extern_junk *foo(void); typedef int void_junk; void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); cproto-4.7t/testing/case16.ref0000644000175100001440000001603713703675605015055 0ustar tomusers/* case16.c */ void badFunc(int *badStyle); int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int P1, char P2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *P1 , int P2 [], float p); int *(func_func)(int p1, int p2, int p3); int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); ... edited case16.c ... /* * Define: * ERR_YACC to force yacc error reporting * ERR_LEX to force lex error reporting * ERR_CHECK to force compiler error reporting */ /* use one item from type-specifiers */ #ifdef ERR_YACC auto x; register x1; #endif /* ERR_YACC */ static x2; extern x3; #ifdef ERR_CC typedef x4; #endif typedef int x4t; #ifdef ERR_YACC void x5; #endif /* ERR_YACC */ char x6; short x7; int x8; long x9; float x10; double x11; signed x12; unsigned x13; struct x14; #ifdef ERR_CHECK struct x14a {}; struct {}; #endif /* ERR_CHECK */ union x15; enum x16; x4t; x4t x17; const x18; volatile x19; #ifdef ERR_CHECK junk x20; #endif /* ERR_CHECK */ extern int *asm (fopen, (__const char *__restrict __filename, __const char *__restrict __modes), fopen64); extern int __asm__ (mkstemp, (char *__template), mkstemp64); int __asm__ (mkstemp, (char *__template), mkstemp64); asm("something"); asm("something", "else"); asm("something", (this and that)); int asm(first, "something"); static int asm(first, "something"); extern int asm(first, "something"); typedef struct _first { int a:5; struct { int a,b; } b_struct; char b:16, b1:1; /* comment with };};}; */ long c:16, c1; short d:16, d1:8, d2; unsigned e:16; float f; double g; #ifdef ERR_CHECK long float f2; long double g2; #endif /* ERR_CHECK */ struct _first *link; } _FIRST; typedef int badStyle; void badFunc(int *badStyle) { } _FIRST first, last={0}, first_last[] = {{0},{1},{2},{3,{4}}}; struct _second { enum {true, false} bool; enum {wrong=1, right=3} values; } _SECOND; int i[] = {1, '\002', 03, 0x4, 0X5, 0x6a, 0X7b, 0x8aBcD, 9l, 10l, 11L}; float f[] = {5, #ifdef ERR_CHECK .5e, .5e+, 5e-, 5e, .34P1, 0x1.2.34, /* error */ #endif .5, 5.5, 5e5, 5e0, 5e-1, 5e+5 #ifdef __STDC_VERSION__ /* ( C9X supports hexadecimal floating point ;-) */ 0x12.34+1, 0x12.34P1, .34e1, 0.34e1, 0x.34P1, #endif .0e-1 }; int array[][10][20]; /* * This grammar can accept some illegal stuff too, in particular it will * permit some instances of parameter-names to be dropped. */ #ifdef ERR_CHECK #define P1 #define P2 #define P3 #else #define P1 p1 #define P2 p2 #define P3 p3 #endif /* ellipsis is legal, except in K&R style declaration */ int dots_0 (int p1) { return(1); } dots_1(int p1, ...) { return(1); } #ifdef ERR_CHECK dots_2(p1, ...) { return(1); } #endif /* ERR_CHECK */ dots_3(int P1,char P2, ...) { return(1); } int dots_4(int,char, char *); char * dots_5(int,char, char *, ...); char * (dots_6)(int,char, char *, ...); extern _FIRST *xdots_0(p1); extern char *xdots_1(int p1, ...); #ifdef ERR_CHECK extern xdots_2(p1, ...); #endif /* ERR_CHECK */ extern xdots_3(int P1,char P2, ...); _FIRST * func1 (void) { } _FIRST *func2(_FIRST *P1,int P2[],float p) { } int *( func_func) (int p1, int p2, int p3) { return(0); } extern float efunc0(p1,p2,p3); extern _FIRST efunc1(int p1, float p2,long P3); #ifdef ERR_CHECK extern _FIRST efunc1(int p1, float p2,p3); #endif /* ERR_CHECK */ typedef int bool; bool a1; static bool a2; extern bool a3; struct ZIP1 { int x1, y1; }; struct zip2 { int x2, y2; } z2; struct { int x3, y3; } z3; /* not ANSI, but mostly accepted */ static struct ZIP4 { int x4, y4; }; static struct zip5 { int x5, y5; } z5; static struct zip6 { int x6, y6; } z6, w6; static struct { int x7, y7; } z7; static struct { int x8, y8; } z8, w8; enum zap1 { a,b,c,d } what; enum zap2 what2; enum {a9,b9,c9,d9} what3; static char *zap = "alphabet/\ first/\ last"; typedef struct bong { int (*func)(); } BONG; typedef char *string; #ifdef ERR_LEX /* string s = "aaa\0000\ */ /* */ /* bbb"; */ #endif /* ERR_LEX */ extern int junk; int main (register argc, extern char **argv) { } /*VARARGS*/ /* some other comment */ int veryfunny (char *a, long b, long c) { return 0; } /*VARARGS3*/ int program ( string argv[], /* first argument */ struct alpha y, /* second argument */ int zz, int z1, int z2, int z3 ) { return(0); } int junk0 (void) { if(junk != 6) return; else junk++; } int junk1 (void) { return (0); } int junk2 (void) { } int junk3 (void) { return 1; } BONG * junk4 (void) { } typedef int extern_junk; extern_junk * foo (void) { } typedef int void_junk; extern void_junk * foo2a (void) { } extern void_junk *foo2a(); void_junk * foo2 (void) { } void_junk *foo_void(void_junk void_int) { } static void_junk * foo_void2 (void) { } extern void (*sigdisp(int sig, void (*func)(int sig)))(int sig); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1) { /* nothing */ } void (* sigdisp2 ( int sig, /* the signal value */ void (*func)(int sig) /* the function pointer */ ))(int sig2) { /* nothing again! */ } int (* K_R_INT_ptr (long *p1, int p2))(void) { return (*(int(*)())0); } int (*STD_INT_ptr(long* , int))(); void (* K_R_VOID_ptr (long *p1, int p2))(void) { return (*(void(*)())0); } void (*STD_VOID_ptr(long* , int))(); int * K_R_int_ptr (long *p1, int p2) { return (*(int **)0); } int **STD_int2_ptr(long* , int); int *STD_int_ptr(long* , int); void * K_R_void_ptr (long *p1, int p2) { return (*(void **)0); } void *STD_void_ptr(long* , int); int K_R_int_val (long *p1, int p2) { return (*(int *)0); } int K_R_int_val2 (long *p1, int p2) { return (*(int *)0); } int STD_int_val(long*, int); void K_R_void_val (long *p1, int p2) { /*void*/ } int K_R_void_val2 ( long *p1, int p2 { /*void*/ ) } void STD_void_val(long* , int); extern xdots_3(int P1,char P2, ...); extern int (*XSetAfterFunction(long* , int (*) ( long*)))(); extern XQueryKeymap(long*, char [32]); extern Another(long*, int (*)()); extern GenFunc(int *, int *()); /* these are pointers, not actual functions */ extern void * (*__glob_opendir_hook) (const char *__directory); extern const char *(*__glob_readdir_hook) (void * __stream); extern void (*__glob_closedir_hook) (void * __stream); /* inline function */ int inline inline_func(double x) { return(0); } static int inline local_inline_func(double x) { return(0); } /* c99 types */ long long xxx = 1; char *xxs = "\x1234\?\u1234"; cproto-4.7t/testing/case21.ref0000644000175100001440000000263710736541444015046 0ustar tomusers/* case21.c */ char x6; short x7; int x8; long x9; float x10; double x11; signed x12; unsigned x13; x4t x17; const x18; volatile x19; void badFunc( int *badStyle ); _FIRST first; _FIRST last; _FIRST first_last[]; struct _second _SECOND; int i[]; float f[]; int array[][10][20]; int dots_0( int p1 ); int dots_1( int p1, ... ); int dots_3( int p1, char p2, ... ); _FIRST *func1(void); _FIRST *func2( _FIRST *p1, int p2[], float p ); int *(func_func)(void); bool a1; struct zip2 z2; struct {} z3; enum zap1 what; enum zap2 what2; enum {} what3; int main( register argc, char **argv ); int veryfunny( char *a, long b, long c ); int program( string argv[], struct alpha y, int zz, int z1, int z2, int z3 ); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void( void_junk void_int ); void (*Sigdisp( int sig, void (*func)(int sig) ))(int sig1); void (*sigdisp2( int sig, void (*func)(int sig) ))(int sig2); int (*K_R_INT_ptr( long *p1, int p2 ))(void); void (*K_R_VOID_ptr( long *p1, int p2 ))(void); int *K_R_int_ptr( long *p1, int p2 ); void *K_R_void_ptr( long *p1, int p2 ); int K_R_int_val( long *p1, int p2 ); int K_R_int_val2( long *p1, int p2 ); void K_R_void_val( long *p1, int p2 ); int K_R_void_val2( long *p1, int p2 ); long long xxx; char *xxs; cproto-4.7t/testing/case19.ref0000644000175100001440000000152607177074203015050 0ustar tomusers/* case19.c */ void badFunc(int *); int dots_0(int); int dots_1(int, ...); int dots_3(int, char, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *, int [], float); int *(func_func)(void); int main(register, char **); int veryfunny(char *, long, long); int program(string [], struct alpha, int, int, int, int); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk); void (*Sigdisp(int, void (*)(int)))(int); void (*sigdisp2(int, void (*)(int)))(int); int (*K_R_INT_ptr(long *, int))(void); void (*K_R_VOID_ptr(long *, int))(void); int *K_R_int_ptr(long *, int); void *K_R_void_ptr(long *, int); int K_R_int_val(long *, int); int K_R_int_val2(long *, int); void K_R_void_val(long *, int); int K_R_void_val2(long *, int); cproto-4.7t/testing/case09.ref0000644000175100001440000000263710736541443015053 0ustar tomusers/* case09.c */ char x6; short x7; int x8; long x9; float x10; double x11; signed x12; unsigned x13; x4t x17; const x18; volatile x19; void badFunc( int *badStyle ); _FIRST first; _FIRST last; _FIRST first_last[]; struct _second _SECOND; int i[]; float f[]; int array[][10][20]; int dots_0( int p1 ); int dots_1( int p1, ... ); int dots_3( int p1, char p2, ... ); _FIRST *func1(void); _FIRST *func2( _FIRST *p1, int p2[], float p ); int *(func_func)(void); bool a1; struct zip2 z2; struct {} z3; enum zap1 what; enum zap2 what2; enum {} what3; int main( register argc, char **argv ); int veryfunny( char *a, long b, long c ); int program( string argv[], struct alpha y, int zz, int z1, int z2, int z3 ); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void( void_junk void_int ); void (*Sigdisp( int sig, void (*func)(int sig) ))(int sig1); void (*sigdisp2( int sig, void (*func)(int sig) ))(int sig2); int (*K_R_INT_ptr( long *p1, int p2 ))(void); void (*K_R_VOID_ptr( long *p1, int p2 ))(void); int *K_R_int_ptr( long *p1, int p2 ); void *K_R_void_ptr( long *p1, int p2 ); int K_R_int_val( long *p1, int p2 ); int K_R_int_val2( long *p1, int p2 ); void K_R_void_val( long *p1, int p2 ); int K_R_void_val2( long *p1, int p2 ); long long xxx; char *xxs; cproto-4.7t/testing/case17.ref0000644000175100001440000001526713703675462015063 0ustar tomusers/* case17.c */ void badFunc(int *badStyle); int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int P1, char P2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *P1 , int P2 [], float p); int *(func_func)(int p1, int p2, int p3); int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); ... edited case17.c ... /* * Define: * ERR_YACC to force yacc error reporting * ERR_LEX to force lex error reporting * ERR_CHECK to force compiler error reporting */ /* use one item from type-specifiers */ #ifdef ERR_YACC auto x; register x1; #endif /* ERR_YACC */ static x2; extern x3; #ifdef ERR_CC typedef x4; #endif typedef int x4t; #ifdef ERR_YACC void x5; #endif /* ERR_YACC */ char x6; short x7; int x8; long x9; float x10; double x11; signed x12; unsigned x13; struct x14; #ifdef ERR_CHECK struct x14a {}; struct {}; #endif /* ERR_CHECK */ union x15; enum x16; x4t; x4t x17; const x18; volatile x19; #ifdef ERR_CHECK junk x20; #endif /* ERR_CHECK */ extern int *asm (fopen, (__const char *__restrict __filename, __const char *__restrict __modes), fopen64); extern int __asm__ (mkstemp, (char *__template), mkstemp64); int __asm__ (mkstemp, (char *__template), mkstemp64); asm("something"); asm("something", "else"); asm("something", (this and that)); int asm(first, "something"); static int asm(first, "something"); extern int asm(first, "something"); typedef struct _first { int a:5; struct { int a,b; } b_struct; char b:16, b1:1; /* comment with };};}; */ long c:16, c1; short d:16, d1:8, d2; unsigned e:16; float f; double g; #ifdef ERR_CHECK long float f2; long double g2; #endif /* ERR_CHECK */ struct _first *link; } _FIRST; typedef int badStyle; void badFunc (badStyle) int *badStyle; { } _FIRST first, last={0}, first_last[] = {{0},{1},{2},{3,{4}}}; struct _second { enum {true, false} bool; enum {wrong=1, right=3} values; } _SECOND; int i[] = {1, '\002', 03, 0x4, 0X5, 0x6a, 0X7b, 0x8aBcD, 9l, 10l, 11L}; float f[] = {5, #ifdef ERR_CHECK .5e, .5e+, 5e-, 5e, .34P1, 0x1.2.34, /* error */ #endif .5, 5.5, 5e5, 5e0, 5e-1, 5e+5 #ifdef __STDC_VERSION__ /* ( C9X supports hexadecimal floating point ;-) */ 0x12.34+1, 0x12.34P1, .34e1, 0.34e1, 0x.34P1, #endif .0e-1 }; int array[][10][20]; /* * This grammar can accept some illegal stuff too, in particular it will * permit some instances of parameter-names to be dropped. */ #ifdef ERR_CHECK #define P1 #define P2 #define P3 #else #define P1 p1 #define P2 p2 #define P3 p3 #endif /* ellipsis is legal, except in K&R style declaration */ dots_0(p1) { return(1); } int dots_1 (p1) int p1; { return(1); } #ifdef ERR_CHECK dots_2(p1, ...) { return(1); } #endif /* ERR_CHECK */ int dots_3 (, ) int P1; char P2; { return(1); } int dots_4(); char *dots_5(); char *(dots_6)(); extern _FIRST *xdots_0(); extern char *xdots_1(); #ifdef ERR_CHECK extern xdots_2(p1, ...); #endif /* ERR_CHECK */ extern xdots_3(); _FIRST *func1() { } _FIRST * func2 (, , p) _FIRST *P1 ; int P2 []; float p; { } int *(func_func)( #ifdef ERR_CHECK p1,p2,p3 #endif /* ERR_CHECK */ ) { return(0); } extern float efunc0(); extern _FIRST efunc1(); #ifdef ERR_CHECK extern _FIRST efunc1(int p1, float p2,p3); #endif /* ERR_CHECK */ typedef int bool; bool a1; static bool a2; extern bool a3; struct ZIP1 { int x1, y1; }; struct zip2 { int x2, y2; } z2; struct { int x3, y3; } z3; /* not ANSI, but mostly accepted */ static struct ZIP4 { int x4, y4; }; static struct zip5 { int x5, y5; } z5; static struct zip6 { int x6, y6; } z6, w6; static struct { int x7, y7; } z7; static struct { int x8, y8; } z8, w8; enum zap1 { a,b,c,d } what; enum zap2 what2; enum {a9,b9,c9,d9} what3; static char *zap = "alphabet/\ first/\ last"; typedef struct bong { int (*func)(); } BONG; typedef char *string; #ifdef ERR_LEX /* string s = "aaa\0000\ */ /* */ /* bbb"; */ #endif /* ERR_LEX */ extern int junk; main(argc, argv) register argc; #ifdef ERR_CHECK extern #endif /* ERR_CHECK */ char **argv; { } /*VARARGS*/ /* some other comment */ veryfunny(a,b,c) char *a; long b, c; { return 0; } /*VARARGS3*/ program(argv, y, zz, z1, z2, z3) string argv[]; /* first argument */ struct alpha { int x,z; } y; /* second argument */ { return(0); } junk0() { if(junk != 6) return; else junk++; } junk1() { return (0); } junk2() { } junk3() { return 1; } BONG *junk4() { } typedef int extern_junk; extern_junk *foo() { } typedef int void_junk; extern void_junk *foo2a() { } extern void_junk *foo2a(); void_junk *foo2() { } void_junk * foo_void (void_int) void_junk void_int; { } static void_junk *foo_void2() { } extern void (*sigdisp())(); void (* Sigdisp (sig, func))() int sig; void (*func)(); { /* nothing */ } void (* sigdisp2 ( sig, func ))() int sig; /* the signal value */ void (*func)(); /* the function pointer */ { /* nothing again! */ } int (*K_R_INT_ptr(p1, p2))() long *p1; int p2; { return (*(int(*)())0); } int (*STD_INT_ptr())(); void (*K_R_VOID_ptr(p1,p2))() long *p1; int p2; { return (*(void(*)())0); } void (*STD_VOID_ptr())(); int *K_R_int_ptr(p1,p2) long *p1; int p2; { return (*(int **)0); } int **STD_int2_ptr(); int *STD_int_ptr(); void *K_R_void_ptr(p1,p2) long *p1; int p2; { return (*(void **)0); } void *STD_void_ptr(); int K_R_int_val(p1,p2) long *p1; int p2; { return (*(int *)0); } K_R_int_val2(p1,p2) long *p1; int p2; { return (*(int *)0); } int STD_int_val(); void K_R_void_val(p1,p2) long *p1; int p2; { /*void*/ } K_R_void_val2(p1,p2) long *p1; int p2; { /*void*/ } void STD_void_val(); extern xdots_3(); extern int (*XSetAfterFunction())(); extern XQueryKeymap(); extern Another(); extern GenFunc(); /* these are pointers, not actual functions */ extern void *(*__glob_opendir_hook)(); extern const char *(*__glob_readdir_hook)(); extern void (*__glob_closedir_hook)(); /* inline function */ int inline inline_func (x) double x; { return(0); } static int inline local_inline_func (x) double x; { return(0); } /* c99 types */ long long xxx = 1; char *xxs = "\x1234\?\u1234"; cproto-4.7t/testing/case23.ref0000644000175100001440000000200510023217651015022 0ustar tomusers/* case23.c */ void badFunc(int *badStyle); int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int p1, char p2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *p1, int p2[], float p); int *(func_func)(void); int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); int inline inline_func(double x); cproto-4.7t/testing/case05.ref0000644000175100001440000000174307177074203015044 0ustar tomusers/* case05.c */ void badFunc(int *badStyle); int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int p1, char p2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *p1, int p2[], float p); int *(func_func)(void); int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); cproto-4.7t/testing/run_test.sh0000755000175100001440000000053213704140117015452 0ustar tomusers#!/bin/sh # $Id: run_test.sh,v 4.6 2020/07/16 21:02:07 tom Exp $ # # This test-script assumes that we can reproduce (except for minor whitespace) # the reference files listed in run_test.txt # echo "** `date`" grep 'CASE.*unix' run_test.txt | sed -e 's/^[^0-9]*//' -e 's/[ ].*//' | while read -r item do $SHELL ./testunix.sh "$@" "$item" done cproto-4.7t/testing/run_test.com0000644000175100001440000000502506455013727015630 0ustar tomusers$! $Id: run_test.com,v 4.3 1998/01/08 00:03:35 cthuang Exp $ $! Perform all regression-tests for CPROTO on VAX/VMS $ $ verify = F$VERIFY(0) $ path := 'F$ENVIRONMENT("DEFAULT") $ path := "''F$EXTRACT(0,F$LENGTH(path)-1,path)'.-]" $ CPROTO :== "$''path'cproto.exe" $ CPROTO1 :== "$''path'cproto1.exe" $ $ caselist="" $ open/read input_file run_test.txt $ read_loop: $ read/end=read_exit input_file sometext $ if f$locate("vms",sometext) .ne. f$length(sometext) $ then $ sometext = f$edit(sometext,"collapse,lowercase") $ sometext = f$extract(0, f$locate("=", sometext), sometext) $ caselist = "''caselist'/''sometext'" $ endif $ goto read_loop $ read_exit: $ close input_file $ caselist = "''caselist'/" $ $ $ if "''p1'" .eqs. "" $ then $ cases = "*" $ else $ cases = "''p1'" $ endif $ $ old_name = "" $ test_loop: $ ref_name = F$SEARCH("''cases'.ref;",1) $ if ref_name .eqs. "" $ then $ verify = F$VERIFY(verify) $ exit $ endif $ if "''old_name'" .eqs. "''ref_name'" then exit $ old_name = ref_name $ $ com_name = F$EXTRACT(0, F$LOCATE(".REF;", ref_name), ref_name) $ casename = F$PARSE(ref_name,,, "NAME", "SYNTAX_ONLY") $ casename = F$EDIT(casename,"LOWERCASE") $ case_num = F$EXTRACT(4, F$LENGTH(casename), casename) $ $ write sys$output "** ",ref_name $ if f$locate("/''casename'/", caselist) .eq. f$length(caselist) $ then $ write sys$output "...skipped" $ goto test_loop $ endif $ $ if F$SEARCH("''com_name'.dcl;", 2) .eqs. "" $ then $ write sys$output "?? no script for ", ref_name $ else $ if F$SEARCH("''com_name'.out") .nes. "" then delete 'com_name.out;* $ if F$SEARCH("''com_name'.err") .nes. "" then delete 'com_name.err;* $ if F$SEARCH("''casename'.c") .nes. "" then delete 'casename.c;* $ copy syntax.c 'casename.c; $ set noon $ define/user_mode sys$error 'casename.err $ @'com_name.dcl $ set on $ if F$SEARCH("''com_name'.out") .eqs. "" $ then $ write sys$output "?? no output from test" $ else $ if f$search("''casename'.c;-1") .nes. "" $ then $ diff/out='com_name 'casename.c $ if $severity .ne. 1 $ then $ open/append output_file 'com_name.out $ write output_file "... edited ''casename'.c ..." $ close output_file $ append 'casename.c 'com_name.out $ endif $ endif $ diff/out='com_name 'com_name.out 'ref_name $ if $severity .ne. 1 $ then $ write sys$output "?? test failed" $ type 'com_name.dif $ else $ delete 'com_name.dif;* $ if F$SEARCH("''com_name'.err") .nes. "" then delete 'com_name.err;* $ endif $ delete 'casename.c;*, 'com_name.out;* $ endif $ endif $ goto test_loop cproto-4.7t/testing/makefile0000644000175100001440000000227213704153601014755 0ustar tomusers# $Id: makefile,v 4.9 2020/07/16 22:41:05 tom Exp $ # make-file for CPROTO test directory THIS = cproto B = .. SHELL = /bin/sh ####### (Standard Lists) ####################################################### TEST_REF=. REF_FILES=\ case01.ref case02.ref case03.ref case04.ref\ case05.ref case06.ref case07.ref case08.ref\ case09.ref case10.ref case11.ref case12.ref\ case13.ref case14.ref case15.ref case16.ref\ case17.ref case18.ref case19.ref case20.ref\ case21.ref TESTDATA=\ run_test.txt\ syntax.c\ $(COM_FILES)\ $(REF_FILES) SCRIPTS =\ make_dcl.sh\ testunix.sh\ run_test.sh run_test.com SOURCES = makefile descrip.mms $(SCRIPTS) $(TESTDATA) ####### (Standard Productions) ################################################# all: $(SOURCES) $B/$(THIS) @echo 'Type "make run_test"' scripts : $(SOURCES) make_bat.sh `fgrep dos run_test.txt |sed -e 's/=.*//'` make_dcl.sh `fgrep unix run_test.txt |sed -e 's/=.*//'` clean: - rm -f *.log *.out *.err *.tmp case*.c *.dcl distclean: clean realclean: distclean - rm -f *.dcl case*.bat check \ check_errors: $(SOURCES) date >>$@.out $(SHELL) -c '(SHELL="$(SHELL)" TEST_REF="$(TEST_REF)" $(SHELL) ./run_test.sh $@ 2>&1)' |tee -a $@.out cproto-4.7t/testing/case20.ref0000644000175100001440000000174307177074203015041 0ustar tomusers/* case20.c */ void badFunc(int *badStyle); int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int p1, char p2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *p1, int p2[], float p); int *(func_func)(void); int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); cproto-4.7t/testing/case02.ref0000644000175100001440000000001705616547732015042 0ustar tomusers/* case02.c */ cproto-4.7t/testing/turboc.c0000644000175100001440000000224605644113152014721 0ustar tomusers/*LINT_EXTERN*/ #include #include #include #include #include /* C++ only #include */ #include /* C++ only #include */ #include /* C++ only #include */ #include #include #include #include #include #include #include #include /* C++ only #include */ /* C++ only #include */ #include #include /* C++ only #include */ /* C++ only #include */ #include #include #include #include #include #include #include /* C++ only #include */ #include #include #include #include #include #include /* ? #include */ #include #include /* C++ only #include */ #include #include /* C++ only #include */ #include #include #include #include #include /* ? #include */ cproto-4.7t/testing/case01.ref0000644000175100001440000000174307177074203015040 0ustar tomusers/* case01.c */ void badFunc(int *badStyle); int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int p1, char p2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *p1, int p2[], float p); int *(func_func)(void); int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); cproto-4.7t/testing/case08.ref0000644000175100001440000000370110736541443015043 0ustar tomusers#if __STDC__ || defined(__cplusplus) #define P_(s) s #else #define P_(s) () #endif /* case08.c */ extern char x6; extern short x7; extern int x8; extern long x9; extern float x10; extern double x11; extern signed x12; extern unsigned x13; extern x4t x17; extern const x18; extern volatile x19; extern void badFunc P_((int *badStyle)); extern _FIRST first; extern _FIRST last; extern _FIRST first_last[]; extern struct _second _SECOND; extern int i[]; extern float f[]; extern int array[][10][20]; extern int dots_0 P_((int p1)); extern int dots_1 P_((int p1, ...)); extern int dots_3 P_((int p1, char p2, ...)); extern _FIRST *func1 P_((void)); extern _FIRST *func2 P_((_FIRST *p1, int p2[], float p)); extern int *(func_func) P_((void)); extern bool a1; extern struct zip2 z2; extern struct {} z3; extern enum zap1 what; extern enum zap2 what2; extern enum {} what3; extern int main P_((register argc, char **argv)); extern int veryfunny P_((char *a, long b, long c)); extern int program P_((string argv[], struct alpha y, int zz, int z1, int z2, int z3)); extern int junk0 P_((void)); extern int junk1 P_((void)); extern int junk2 P_((void)); extern int junk3 P_((void)); extern BONG *junk4 P_((void)); extern extern_junk *foo P_((void)); extern void_junk *foo2a P_((void)); extern void_junk *foo2 P_((void)); extern void_junk *foo_void P_((void_junk void_int)); extern void (*Sigdisp P_((int sig, void (*func)(int sig)))) P_((int sig1)); extern void (*sigdisp2 P_((int sig, void (*func)(int sig)))) P_((int sig2)); extern int (*K_R_INT_ptr P_((long *p1, int p2))) P_((void)); extern void (*K_R_VOID_ptr P_((long *p1, int p2))) P_((void)); extern int *K_R_int_ptr P_((long *p1, int p2)); extern void *K_R_void_ptr P_((long *p1, int p2)); extern int K_R_int_val P_((long *p1, int p2)); extern int K_R_int_val2 P_((long *p1, int p2)); extern void K_R_void_val P_((long *p1, int p2)); extern int K_R_void_val2 P_((long *p1, int p2)); extern long long xxx; extern char *xxs; #undef P_ cproto-4.7t/testing/run_test.txt0000644000175100001440000000166510023451603015660 0ustar tomusers$Id: run_test.txt,v 4.5 2004/03/09 23:30:11 tom Exp $ CASE 01 = unix, vms, dos, os2 = CASE 02 = unix, vms, dos, os2 = -f0 CASE 03 = unix, vms, dos, os2 = -c -f1 CASE 04 = unix, vms, dos, os2 = -c -f2 CASE 05 = unix, vms, dos, os2 = -c -f3 CASE 06 = unix, vms, dos = -c -f3 -v CASE 07 = unix, vms, dos = -c -f3 -v -e CASE 08 = unix, vms, dos = -c -f3 -v -e -m CASE 09 = unix, vms, dos = -c -f3 -v -"Pint\sfunc(\n\ta,\n\tb\n\t)" CASE 10 = unix = -"T" CASE 11 = unix = -l CASE 12 = unix, vms, dos, os2 = -s CASE 13 = unix = -l -s CASE 14 = unix = -l -x CASE 15 = apollo = -D__STDC__ -D__attribute='#attributes' -l apollo.c CASE 16 = unix, vms, dos = -a CASE 17 = unix, vms, dos = -t CASE 18 = unix, vms, dos, os2 = -f1 CASE 19 = unix, vms, dos, os2 = -f2 CASE 20 = unix, vms, dos, os2 = -f3 CASE 21 = unix, vms, dos = -f3 -v -"Pint\sfunc(\n\ta,\n\tb\n\t)" CASE 22 = unix = -l -a CASE 23 = unix, vms, dos, os2 = -i CASE 24 = unix, vms, dos, os2 = -i -s cproto-4.7t/testing/linux.c0000644000175100001440000000343006455013722014561 0ustar tomusers/* $Id: linux.c,v 4.2 1998/01/08 00:03:30 cthuang Exp $ */ /* LINT_EXTERN */ /* LINT_SHADOWED */ #include #include #include #include #include #include #include #include #include #include #include #include #include /* #include */ #include #include #include #include #include #include #include #include /* #include */ #include #include #include #include #include #include #include /* #include */ #include #include #include #include #include #include #include #include #include #include /* #include */ #include #include #include #include #include #include #include #include #include #include /* #include */ #include #include #include #include #include /* #include */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include cproto-4.7t/testing/case04.ref0000644000175100001440000000222507177074203015037 0ustar tomusers/* case04.c */ void badFunc(int */*badStyle*/); int dots_0(int /*p1*/); int dots_1(int /*p1*/, ...); int dots_3(int /*p1*/, char /*p2*/, ...); _FIRST *func1(void); _FIRST *func2(_FIRST */*p1*/, int /*p2*/[], float /*p*/); int *(func_func)(void); int main(register /*argc*/, char **/*argv*/); int veryfunny(char */*a*/, long /*b*/, long /*c*/); int program(string /*argv*/[], struct alpha /*y*/, int /*zz*/, int /*z1*/, int /*z2*/, int /*z3*/); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk /*void_int*/); void (*Sigdisp(int /*sig*/, void (* /*func*/)(int /*sig*/)))(int /*sig1*/); void (*sigdisp2(int /*sig*/, void (* /*func*/)(int /*sig*/)))(int /*sig2*/); int (*K_R_INT_ptr(long */*p1*/, int /*p2*/))(void); void (*K_R_VOID_ptr(long */*p1*/, int /*p2*/))(void); int *K_R_int_ptr(long */*p1*/, int /*p2*/); void *K_R_void_ptr(long */*p1*/, int /*p2*/); int K_R_int_val(long */*p1*/, int /*p2*/); int K_R_int_val2(long */*p1*/, int /*p2*/); void K_R_void_val(long */*p1*/, int /*p2*/); int K_R_void_val2(long */*p1*/, int /*p2*/); cproto-4.7t/testing/solaris.c0000644000175100001440000000537505646767340015125 0ustar tomusers/* $Id: solaris.c,v 4.1 1994/10/12 14:12:48 cthuang Exp $ */ /*LINTLIBRARY*/ /*LINT_EXTERN*/ /*LINT_SHADOWED*/ #include #include /*LINT_PREPRO2 #define MAXDNAME 10 */ #define MAXDNAME 10 #include #include #include #include #include #include #include #include #include #include #include /*#include -- true redef */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*#include */ #include #include #include #include #include #include #include #include #include /*#include */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* #include conflict with search.h */ #include /* #include conflict with termcap.h */ /*LINT_PREPRO2 #undef PC */ #undef PC #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* #include - gcc prefers to give its own include-pathname here */ #include #include #include #include cproto-4.7t/testing/apollo.c0000644000175100001440000000452005405406244014710 0ustar tomusers#define const /* LINT_PREPRO6 #undef COMPLETE_SR10_2 #ifdef __STDC__ #ident Standard LLIB #else #ident Traditional LLIB #endif */ /* LINT_EXTERN */ #include /* */ #include /* */ /* */ /* */ #include /* (see below) */ /* (separate) */ /* (separate) */ #ifdef COMPLETE_SR10_2 #include #include #include #endif #include #include /* */ /* */ #ifdef COMPLETE_SR10_2 #include #include #include #include #endif /* (missing?) */ /* (lint can't eat prototype-in!) */ /* (missing?) */ /* */ #ifdef COMPLETE_SR10_2 #include #endif #include #ifdef COMPLETE_SR10_2 #include #include #include /* */ /* */ #include #include /* */ #include #include #include #endif #include /* */ #ifdef COMPLETE_SR10_2 #include #include #endif #include #ifdef COMPLETE_SR10_2 #include #include #include #include #include #include #include #include /* */ #include /* */ /* */ #include #include #include #include #include #include /* */ #include /* */ #include #include #include #include #include #endif /* patch:#include */ #include #include #ifdef COMPLETE_SR10_2 /* */ #include #include #include #endif cproto-4.7t/testing/syntax.c0000644000175100001440000001376413703675452014773 0ustar tomusers/* * Define: * ERR_YACC to force yacc error reporting * ERR_LEX to force lex error reporting * ERR_CHECK to force compiler error reporting */ /* use one item from type-specifiers */ #ifdef ERR_YACC auto x; register x1; #endif /* ERR_YACC */ static x2; extern x3; #ifdef ERR_CC typedef x4; #endif typedef int x4t; #ifdef ERR_YACC void x5; #endif /* ERR_YACC */ char x6; short x7; int x8; long x9; float x10; double x11; signed x12; unsigned x13; struct x14; #ifdef ERR_CHECK struct x14a {}; struct {}; #endif /* ERR_CHECK */ union x15; enum x16; x4t; x4t x17; const x18; volatile x19; #ifdef ERR_CHECK junk x20; #endif /* ERR_CHECK */ extern int *asm (fopen, (__const char *__restrict __filename, __const char *__restrict __modes), fopen64); extern int __asm__ (mkstemp, (char *__template), mkstemp64); int __asm__ (mkstemp, (char *__template), mkstemp64); asm("something"); asm("something", "else"); asm("something", (this and that)); int asm(first, "something"); static int asm(first, "something"); extern int asm(first, "something"); typedef struct _first { int a:5; struct { int a,b; } b_struct; char b:16, b1:1; /* comment with };};}; */ long c:16, c1; short d:16, d1:8, d2; unsigned e:16; float f; double g; #ifdef ERR_CHECK long float f2; long double g2; #endif /* ERR_CHECK */ struct _first *link; } _FIRST; typedef int badStyle; void badFunc(int *badStyle) { } _FIRST first, last={0}, first_last[] = {{0},{1},{2},{3,{4}}}; struct _second { enum {true, false} bool; enum {wrong=1, right=3} values; } _SECOND; int i[] = {1, '\002', 03, 0x4, 0X5, 0x6a, 0X7b, 0x8aBcD, 9l, 10l, 11L}; float f[] = {5, #ifdef ERR_CHECK .5e, .5e+, 5e-, 5e, .34P1, 0x1.2.34, /* error */ #endif .5, 5.5, 5e5, 5e0, 5e-1, 5e+5 #ifdef __STDC_VERSION__ /* ( C9X supports hexadecimal floating point ;-) */ 0x12.34+1, 0x12.34P1, .34e1, 0.34e1, 0x.34P1, #endif .0e-1 }; int array[][10][20]; /* * This grammar can accept some illegal stuff too, in particular it will * permit some instances of parameter-names to be dropped. */ #ifdef ERR_CHECK #define P1 #define P2 #define P3 #else #define P1 p1 #define P2 p2 #define P3 p3 #endif /* ellipsis is legal, except in K&R style declaration */ dots_0(p1) { return(1); } dots_1(int p1, ...) { return(1); } #ifdef ERR_CHECK dots_2(p1, ...) { return(1); } #endif /* ERR_CHECK */ dots_3(int P1,char P2, ...) { return(1); } int dots_4(int,char, char *); char * dots_5(int,char, char *, ...); char * (dots_6)(int,char, char *, ...); extern _FIRST *xdots_0(p1); extern char *xdots_1(int p1, ...); #ifdef ERR_CHECK extern xdots_2(p1, ...); #endif /* ERR_CHECK */ extern xdots_3(int P1,char P2, ...); _FIRST *func1() { } _FIRST *func2(_FIRST *P1,int P2[],float p) { } int *(func_func)( #ifdef ERR_CHECK p1,p2,p3 #endif /* ERR_CHECK */ ) { return(0); } extern float efunc0(p1,p2,p3); extern _FIRST efunc1(int p1, float p2,long P3); #ifdef ERR_CHECK extern _FIRST efunc1(int p1, float p2,p3); #endif /* ERR_CHECK */ typedef int bool; bool a1; static bool a2; extern bool a3; struct ZIP1 { int x1, y1; }; struct zip2 { int x2, y2; } z2; struct { int x3, y3; } z3; /* not ANSI, but mostly accepted */ static struct ZIP4 { int x4, y4; }; static struct zip5 { int x5, y5; } z5; static struct zip6 { int x6, y6; } z6, w6; static struct { int x7, y7; } z7; static struct { int x8, y8; } z8, w8; enum zap1 { a,b,c,d } what; enum zap2 what2; enum {a9,b9,c9,d9} what3; static char *zap = "alphabet/\ first/\ last"; typedef struct bong { int (*func)(); } BONG; typedef char *string; #ifdef ERR_LEX /* string s = "aaa\0000\ */ /* */ /* bbb"; */ #endif /* ERR_LEX */ extern int junk; main(argc, argv) register argc; #ifdef ERR_CHECK extern #endif /* ERR_CHECK */ char **argv; { } /*VARARGS*/ /* some other comment */ veryfunny(a,b,c) char *a; long b, c; { return 0; } /*VARARGS3*/ program(argv, y, zz, z1, z2, z3) string argv[]; /* first argument */ struct alpha { int x,z; } y; /* second argument */ { return(0); } junk0() { if(junk != 6) return; else junk++; } junk1() { return (0); } junk2() { } junk3() { return 1; } BONG *junk4() { } typedef int extern_junk; extern_junk *foo() { } typedef int void_junk; extern void_junk *foo2a() { } extern void_junk *foo2a(); void_junk *foo2() { } void_junk *foo_void(void_junk void_int) { } static void_junk *foo_void2() { } extern void (*sigdisp(int sig, void (*func)(int sig)))(int sig); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1) { /* nothing */ } void (*sigdisp2(sig, func))(int sig2) int sig; /* the signal value */ void (*func)(int sig); /* the function pointer */ { /* nothing again! */ } int (*K_R_INT_ptr(p1, p2))() long *p1; int p2; { return (*(int(*)())0); } int (*STD_INT_ptr(long* , int))(); void (*K_R_VOID_ptr(p1,p2))() long *p1; int p2; { return (*(void(*)())0); } void (*STD_VOID_ptr(long* , int))(); int *K_R_int_ptr(p1,p2) long *p1; int p2; { return (*(int **)0); } int **STD_int2_ptr(long* , int); int *STD_int_ptr(long* , int); void *K_R_void_ptr(p1,p2) long *p1; int p2; { return (*(void **)0); } void *STD_void_ptr(long* , int); int K_R_int_val(p1,p2) long *p1; int p2; { return (*(int *)0); } K_R_int_val2(p1,p2) long *p1; int p2; { return (*(int *)0); } int STD_int_val(long*, int); void K_R_void_val(p1,p2) long *p1; int p2; { /*void*/ } K_R_void_val2(p1,p2) long *p1; int p2; { /*void*/ } void STD_void_val(long* , int); extern xdots_3(int P1,char P2, ...); extern int (*XSetAfterFunction(long* , int (*) ( long*)))(); extern XQueryKeymap(long*, char [32]); extern Another(long*, int (*)()); extern GenFunc(int *, int *()); /* these are pointers, not actual functions */ extern void * (*__glob_opendir_hook) (const char *__directory); extern const char *(*__glob_readdir_hook) (void * __stream); extern void (*__glob_closedir_hook) (void * __stream); /* inline function */ int inline inline_func(double x) { return(0); } static int inline local_inline_func(double x) { return(0); } /* c99 types */ long long xxx = 1; char *xxs = "\x1234\?\u1234"; cproto-4.7t/testing/make_bat.sh0000755000175100001440000000255306462243365015373 0ustar tomusers#!/bin/sh # $Id: make_bat.sh,v 4.3 1998/01/24 01:42:13 cthuang Exp $ # # This makes a special ".bat" file for testing CPROTO on MSDOS. # It won't work properly if /bin/echo tries to expand the backslash sequences. # (This is the case on SunOS 4.1.x). # # The MSDOS 'fc' program doesn't return an exit code for differing files. # We have to examine the output log... TMP=make$$ rm -f $TMP trap "rm -f $TMP" 0 1 2 5 15 if [ -f /bin/echo ] then ECHO=/bin/echo else ECHO=echo fi for i in $* do i="`echo $i | sed -e 's/[A-Za-z_.]//g'`" I="case$i" if [ -n "$i" -a ! -f $I.bat ] then echo '** making '$I.bat cat >$I.bat <>run_test.out if exist $I.out erase $I.out if exist $I.dif erase $I.dif copy syntax.c $I.c EOF grep 'CASE[ ]'$i run_test.txt >$TMP OPTS=`sed -e 's/^.*=/CPROTO/' $TMP` TEST=`sed -e 's/^.*=/CPROTO/' -e 's/-[at]//' $TMP` sed -e 's/^.*=/CPROTO/' $TMP | \ sed -e 's/^/..\\/' \ -e s/\$/\ -o$I.out\ -O$I.err\ $I.c/ \ -e s/\"//g >>$I.bat if [ ".$OPTS" != ".$TEST" ] then cat >>$I.bat <>$I.out type $I.c >>$I.out EOF fi cat >>$I.bat <>run_test.out if exist $I.out erase $I.out if exist $I.err erase $I.err goto end :saveit ren $I.out $I.ref :end erase $I.c EOF fi done cproto-4.7t/testing/case18.ref0000644000175100001440000000103007177074203015035 0ustar tomusers/* case18.c */ void badFunc(); int dots_0(); int dots_1(); int dots_3(); _FIRST *func1(); _FIRST *func2(); int *(func_func)(); int main(); int veryfunny(); int program(); int junk0(); int junk1(); int junk2(); int junk3(); BONG *junk4(); extern_junk *foo(); void_junk *foo2a(); void_junk *foo2(); void_junk *foo_void(); void (*Sigdisp())(); void (*sigdisp2())(); int (*K_R_INT_ptr())(); void (*K_R_VOID_ptr())(); int *K_R_int_ptr(); void *K_R_void_ptr(); int K_R_int_val(); int K_R_int_val2(); void K_R_void_val(); int K_R_void_val2(); cproto-4.7t/testing/case07.ref0000644000175100001440000000327510736541443015050 0ustar tomusers/* case07.c */ extern char x6; extern short x7; extern int x8; extern long x9; extern float x10; extern double x11; extern signed x12; extern unsigned x13; extern x4t x17; extern const x18; extern volatile x19; extern void badFunc(int *badStyle); extern _FIRST first; extern _FIRST last; extern _FIRST first_last[]; extern struct _second _SECOND; extern int i[]; extern float f[]; extern int array[][10][20]; extern int dots_0(int p1); extern int dots_1(int p1, ...); extern int dots_3(int p1, char p2, ...); extern _FIRST *func1(void); extern _FIRST *func2(_FIRST *p1, int p2[], float p); extern int *(func_func)(void); extern bool a1; extern struct zip2 z2; extern struct {} z3; extern enum zap1 what; extern enum zap2 what2; extern enum {} what3; extern int main(register argc, char **argv); extern int veryfunny(char *a, long b, long c); extern int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); extern int junk0(void); extern int junk1(void); extern int junk2(void); extern int junk3(void); extern BONG *junk4(void); extern extern_junk *foo(void); extern void_junk *foo2a(void); extern void_junk *foo2(void); extern void_junk *foo_void(void_junk void_int); extern void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); extern void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); extern int (*K_R_INT_ptr(long *p1, int p2))(void); extern void (*K_R_VOID_ptr(long *p1, int p2))(void); extern int *K_R_int_ptr(long *p1, int p2); extern void *K_R_void_ptr(long *p1, int p2); extern int K_R_int_val(long *p1, int p2); extern int K_R_int_val2(long *p1, int p2); extern void K_R_void_val(long *p1, int p2); extern int K_R_void_val2(long *p1, int p2); extern long long xxx; extern char *xxs; cproto-4.7t/testing/case11.ref0000644000175100001440000000561011510146523015025 0ustar tomusers/* LINTLIBRARY */ /* case11.c */ typedef int x4t; char x6; short x7; int x8; long x9; float x10; double x11; signed x12; unsigned x13; struct x14; union x15; enum x16; x4t; x4t x17; const x18 = {0}; volatile x19; typedef struct _first { int a:5; struct { int a,b; } b_struct; char b:16, b1:1; long c:16, c1; short d:16, d1:8, d2; unsigned e:16; float f; double g; struct _first *link; } _FIRST; typedef int badStyle; void badFunc(badStyle) int *badStyle; { /* void */ } _FIRST first; _FIRST last; _FIRST first_last[]; struct _second { enum {true, false} bool; enum {wrong=1, right=3} values; } _SECOND; int i[]; float f[]; int array[][10][20]; int dots_0(p1) int p1; { return(*(int *)0); } /* VARARGS1 */ int dots_1(p1) int p1; { return(*(int *)0); } /* VARARGS2 */ int dots_3(p1, p2) int p1; char p2; { return(*(int *)0); } _FIRST *func1() { return(*(_FIRST **)0); } _FIRST *func2(p1, p2, p) _FIRST *p1; int p2[]; float p; { return(*(_FIRST **)0); } int *(func_func)() { return(*(int **)0); } typedef int bool; bool a1; struct ZIP1 { int x1, y1; }; struct zip2 { int x2, y2; } z2; struct { int x3, y3; } z3; struct ZIP4 { int x4, y4; }; enum zap1 { a,b,c,d } what; enum zap2 what2; enum {a9,b9,c9,d9} what3; typedef struct bong { int (*func)(); } BONG; typedef char *string; void main(argc, argv) int argc; char **argv; { /* void */ } /* VARARGS */ int veryfunny(a, b, c) char *a; long b; long c; { return(*(int *)0); } /* VARARGS3 */ int program(argv, y, zz, z1, z2, z3) string argv[]; struct alpha { int x,z; } y; int zz; int z1; int z2; int z3; { return(*(int *)0); } void junk0() { /* void */ } int junk1() { return(*(int *)0); } void junk2() { /* void */ } int junk3() { return(*(int *)0); } BONG *junk4() { return(*(BONG **)0); } typedef int extern_junk; extern_junk *foo() { return(*(extern_junk **)0); } typedef int void_junk; void_junk *foo2a() { return(*(void_junk **)0); } void_junk *foo2() { return(*(void_junk **)0); } void_junk *foo_void(void_int) void_junk void_int; { return(*(void_junk **)0); } void (*Sigdisp(sig, func))() int sig; void (*func)(); { return(*(void(*)())0); } void (*sigdisp2(sig, func))() int sig; void (*func)(); { return(*(void(*)())0); } int (*K_R_INT_ptr(p1, p2))() long *p1; int p2; { return(*(int(*)())0); } void (*K_R_VOID_ptr(p1, p2))() long *p1; int p2; { return(*(void(*)())0); } int *K_R_int_ptr(p1, p2) long *p1; int p2; { return(*(int **)0); } void *K_R_void_ptr(p1, p2) long *p1; int p2; { return(*(void **)0); } int K_R_int_val(p1, p2) long *p1; int p2; { return(*(int *)0); } int K_R_int_val2(p1, p2) long *p1; int p2; { return(*(int *)0); } void K_R_void_val(p1, p2) long *p1; int p2; { /* void */ } void K_R_void_val2(p1, p2) long *p1; int p2; { /* void */ } long long xxx; char *xxs; cproto-4.7t/testing/make_dcl.sh0000755000175100001440000000106013704047374015356 0ustar tomusers#!/bin/sh # $Id: make_dcl.sh,v 4.2 2020/07/16 12:58:36 tom Exp $ # # This makes a special ".dcl" file that can be executed from either UNIX or # VMS. We auto-generate the script (with this name) to avoid confusion on # MSDOS, which thinks ".com" files are even more special. # for i in "$@" do i="`echo "$i" | sed -e 's/[A-Za-z_.]//g'`" I="case$i" if [ -n "$i" ] && [ ! -f "$I.dcl" ] then echo "** making $I.dcl" grep "CASE[ ]$i" run_test.txt | \ sed -e 's/^.*=/$CPROTO /' \ -e "s/\$/\ -o$I.out\ $I.c/" >"$I.dcl" chmod 755 "$I.dcl" fi done cproto-4.7t/testing/descrip.mms0000644000175100001440000000260706460773377015451 0ustar tomusers# $Id: descrip.mms,v 4.1 1998/01/20 00:59:43 cthuang Exp $ # VMS make-file for CPROTO test directory # ####### (Development) ########################################################## ####### (Command-line Options) ################################################# ####### (Standard Lists) ####################################################### REF_FILES=\ case1.ref case2.ref case3.ref case4.ref\ case5.ref case6.ref case7.ref case8.ref\ case9.ref case10.ref case11.ref case12.ref\ case13.ref case14.ref case15.ref\ case17.ref case18.ref case19.ref case20.ref\ case21.ref COM_FILES=\ case1.dcl case2.dcl case3.dcl case4.dcl\ case5.dcl case6.dcl case7.dcl case8.dcl\ case9.dcl case10.dcl case11.dcl case12.dcl\ case13.dcl case14.dcl case15.dcl\ case17.dcl case18.dcl case19.dcl case20.dcl\ case21.dcl TESTDATA=\ syntax.c\ $(COM_FILES)\ $(REF_FILES) SCRIPTS =\ run_tests.sh run_tests.com SOURCES = makefile descrip.mms $(SCRIPTS) $(TESTDATA) ALL = $(SCRIPTS) ####### (Standard Productions) ################################################# all : $(ALL) [-.bin]$(THIS).exe [-.bin]$(THIS)1.exe @ write sys$output "Type ""mms run_tests"" clean : @- write sys$output "** made $@" clobber : clean @- write sys$output "** made $@" destroy : @- remove -vf *.*;* run_tests : $(SCRIPTS) $(TESTDATA) @run_tests ####### (Details of Productions) ############################################### cproto-4.7t/testing/case12.ref0000644000175100001440000000200607177074203015033 0ustar tomusers/* case12.c */ void badFunc(int *badStyle); int dots_0(int p1); int dots_1(int p1, ...); int dots_3(int p1, char p2, ...); _FIRST *func1(void); _FIRST *func2(_FIRST *p1, int p2[], float p); int *(func_func)(void); int main(register argc, char **argv); int veryfunny(char *a, long b, long c); int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3); int junk0(void); int junk1(void); int junk2(void); int junk3(void); BONG *junk4(void); extern_junk *foo(void); void_junk *foo2a(void); void_junk *foo2(void); void_junk *foo_void(void_junk void_int); static void_junk *foo_void2(void); void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1); void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2); int (*K_R_INT_ptr(long *p1, int p2))(void); void (*K_R_VOID_ptr(long *p1, int p2))(void); int *K_R_int_ptr(long *p1, int p2); void *K_R_void_ptr(long *p1, int p2); int K_R_int_val(long *p1, int p2); int K_R_int_val2(long *p1, int p2); void K_R_void_val(long *p1, int p2); int K_R_void_val2(long *p1, int p2); cproto-4.7t/testing/case22.ref0000644000175100001440000000706111510146524015032 0ustar tomusers/* LINTLIBRARY */ /* case22.c */ typedef int x4t; #undef x6 char x6; #undef x7 short x7; #undef x8 int x8; #undef x9 long x9; #undef x10 float x10; #undef x11 double x11; #undef x12 signed x12; #undef x13 unsigned x13; struct x14; union x15; enum x16; x4t; #undef x17 x4t x17; #undef x18 const x18 = {0}; #undef x19 volatile x19; typedef struct _first { int a:5; struct { int a,b; } b_struct; char b:16, b1:1; long c:16, c1; short d:16, d1:8, d2; unsigned e:16; float f; double g; struct _first *link; } _FIRST; typedef int badStyle; #undef badFunc void badFunc( int *badStyle) { /* void */ } #undef first _FIRST first; #undef last _FIRST last; #undef first_last _FIRST first_last[]; #undef _SECOND struct _second { enum {true, false} bool; enum {wrong=1, right=3} values; } _SECOND; #undef i int i[]; #undef f float f[]; #undef array int array[][10][20]; #undef dots_0 int dots_0( int p1) { return(*(int *)0); } #undef dots_1 int dots_1( int p1, ...) { return(*(int *)0); } #undef dots_3 int dots_3( int p1, char p2, ...) { return(*(int *)0); } #undef func1 _FIRST *func1(void) { return(*(_FIRST **)0); } #undef func2 _FIRST *func2( _FIRST *p1, int p2[], float p) { return(*(_FIRST **)0); } #undef func_func int *(func_func)(void) { return(*(int **)0); } typedef int bool; #undef a1 bool a1; struct ZIP1 { int x1, y1; }; #undef z2 struct zip2 { int x2, y2; } z2; #undef z3 struct { int x3, y3; } z3; struct ZIP4 { int x4, y4; }; #undef what enum zap1 { a,b,c,d } what; #undef what2 enum zap2 what2; #undef what3 enum {a9,b9,c9,d9} what3; typedef struct bong { int (*func)(); } BONG; typedef char *string; #undef main void main( int argc, char **argv) { /* void */ } /* VARARGS */ #undef veryfunny int veryfunny( char *a, long b, long c) { return(*(int *)0); } /* VARARGS3 */ #undef program int program( string argv[], struct alpha { int x,z; } y, int zz, int z1, int z2, int z3) { return(*(int *)0); } #undef junk0 void junk0(void) { /* void */ } #undef junk1 int junk1(void) { return(*(int *)0); } #undef junk2 void junk2(void) { /* void */ } #undef junk3 int junk3(void) { return(*(int *)0); } #undef junk4 BONG *junk4(void) { return(*(BONG **)0); } typedef int extern_junk; #undef foo extern_junk *foo(void) { return(*(extern_junk **)0); } typedef int void_junk; #undef foo2a void_junk *foo2a(void) { return(*(void_junk **)0); } #undef foo2 void_junk *foo2(void) { return(*(void_junk **)0); } #undef foo_void void_junk *foo_void( void_junk void_int) { return(*(void_junk **)0); } #undef Sigdisp void (*Sigdisp( int sig, void (*func)( int sig)))( int sig1) { return(*(void(*)())0); } #undef sigdisp2 void (*sigdisp2( int sig, void (*func)( int sig)))( int sig2) { return(*(void(*)())0); } #undef K_R_INT_ptr int (*K_R_INT_ptr( long *p1, int p2))(void) { return(*(int(*)())0); } #undef K_R_VOID_ptr void (*K_R_VOID_ptr( long *p1, int p2))(void) { return(*(void(*)())0); } #undef K_R_int_ptr int *K_R_int_ptr( long *p1, int p2) { return(*(int **)0); } #undef K_R_void_ptr void *K_R_void_ptr( long *p1, int p2) { return(*(void **)0); } #undef K_R_int_val int K_R_int_val( long *p1, int p2) { return(*(int *)0); } #undef K_R_int_val2 int K_R_int_val2( long *p1, int p2) { return(*(int *)0); } #undef K_R_void_val void K_R_void_val( long *p1, int p2) { /* void */ } #undef K_R_void_val2 void K_R_void_val2( long *p1, int p2) { /* void */ } #undef xxx long long xxx; #undef xxs char *xxs; cproto-4.7t/testing/case03.ref0000644000175100001440000000214707177074203015041 0ustar tomusers/* case03.c */ void badFunc(/*int *badStyle*/); int dots_0(/*int p1*/); int dots_1(/*int p1, ...*/); int dots_3(/*int p1, char p2, ...*/); _FIRST *func1(/*void*/); _FIRST *func2(/*_FIRST *p1, int p2[], float p*/); int *(func_func)(/*void*/); int main(/*register argc, char **argv*/); int veryfunny(/*char *a, long b, long c*/); int program(/*string argv[], struct alpha y, int zz, int z1, int z2, int z3*/); int junk0(/*void*/); int junk1(/*void*/); int junk2(/*void*/); int junk3(/*void*/); BONG *junk4(/*void*/); extern_junk *foo(/*void*/); void_junk *foo2a(/*void*/); void_junk *foo2(/*void*/); void_junk *foo_void(/*void_junk void_int*/); void (*Sigdisp(/*int sig, void (*func)(int sig)*/))(/*int sig1*/); void (*sigdisp2(/*int sig, void (*func)(int sig)*/))(/*int sig2*/); int (*K_R_INT_ptr(/*long *p1, int p2*/))(/*void*/); void (*K_R_VOID_ptr(/*long *p1, int p2*/))(/*void*/); int *K_R_int_ptr(/*long *p1, int p2*/); void *K_R_void_ptr(/*long *p1, int p2*/); int K_R_int_val(/*long *p1, int p2*/); int K_R_int_val2(/*long *p1, int p2*/); void K_R_void_val(/*long *p1, int p2*/); int K_R_void_val2(/*long *p1, int p2*/); cproto-4.7t/testing/README0000644000175100001440000000256005703352526014144 0ustar tomusers$Id: README,v 4.3 1995/01/06 23:42:14 tom Exp $ CPROTO/TESTING There's several types of files in this directory, distinguished by their suffixes. makefile a UNIX makefile used to coordinate files and to invoke the UNIX master test script 'run_test.sh'. case*.bat MSDOS scripts automatically generated to run test cases. test_dos.bat The master MSDOS test script. syntax.c The test data (contains some intentional errors, and all of the interesting tests that can be made portable across all platforms). apollo.c linux.c solaris.c turboc.c These are lint library templates, used for exercising cproto. They include as many of the system's include files as possible, in an attempt to find lexical/grammar problems with cproto. run_test.com The VMS master test script. case*.dcl UNIX+VMS scripts automatically generated to run test cases. (They don't have a ".com" suffix because that would create problems on MSDOS). descrip.mms The VMS equivalent of 'makefile'. case*.ref Reference files obtained by running the test scripts. make_bat.sh The script that generates case*.bat make_dcl.sh The script that generates case*.dcl run_test.sh The master UNIX test script testunix.sh The UNIX test script that actually does all of the work run_test.txt The test list, from which the case*.dcl, case*.bat files are generated. cproto-4.7t/testing/case14.ref0000644000175100001440000001121211510146523015023 0ustar tomusers/* LINTLIBRARY */ /* case14.c */ int x3; typedef int x4t; char x6; short x7; int x8; long x9; float x10; double x11; signed x12; unsigned x13; struct x14; union x15; enum x16; x4t; x4t x17; const x18 = {0}; volatile x19; typedef struct _first { int a:5; struct { int a,b; } b_struct; char b:16, b1:1; long c:16, c1; short d:16, d1:8, d2; unsigned e:16; float f; double g; struct _first *link; } _FIRST; typedef int badStyle; void badFunc(badStyle) int *badStyle; { /* void */ } _FIRST first; _FIRST last; _FIRST first_last[]; struct _second { enum {true, false} bool; enum {wrong=1, right=3} values; } _SECOND; int i[]; float f[]; int array[][10][20]; int dots_0(p1) int p1; { return(*(int *)0); } /* VARARGS1 */ int dots_1(p1) int p1; { return(*(int *)0); } /* VARARGS2 */ int dots_3(p1, p2) int p1; char p2; { return(*(int *)0); } int dots_4(p1, p2, p3) int p1; char p2; char *p3; { return(*(int *)0); } /* VARARGS3 */ char *dots_5(p1, p2, p3) int p1; char p2; char *p3; { return(*(char **)0); } /* VARARGS3 */ char *(dots_6)(p1, p2, p3) int p1; char p2; char *p3; { return(*(char **)0); } _FIRST *xdots_0(p1) int p1; { return(*(_FIRST **)0); } /* VARARGS1 */ char *xdots_1(p1) int p1; { return(*(char **)0); } /* VARARGS2 */ int xdots_3(p1, p2) int p1; char p2; { return(*(int *)0); } _FIRST *func1() { return(*(_FIRST **)0); } _FIRST *func2(p1, p2, p) _FIRST *p1; int p2[]; float p; { return(*(_FIRST **)0); } int *(func_func)() { return(*(int **)0); } float efunc0(p1, p2, p3) int p1; int p2; int p3; { return(*(float *)0); } _FIRST efunc1(p1, p2, p3) int p1; float p2; long p3; { return(*(_FIRST *)0); } typedef int bool; bool a1; bool a3; struct ZIP1 { int x1, y1; }; struct zip2 { int x2, y2; } z2; struct { int x3, y3; } z3; struct ZIP4 { int x4, y4; }; enum zap1 { a,b,c,d } what; enum zap2 what2; enum {a9,b9,c9,d9} what3; typedef struct bong { int (*func)(); } BONG; typedef char *string; int junk; void main(argc, argv) int argc; char **argv; { /* void */ } /* VARARGS */ int veryfunny(a, b, c) char *a; long b; long c; { return(*(int *)0); } /* VARARGS3 */ int program(argv, y, zz, z1, z2, z3) string argv[]; struct alpha { int x,z; } y; int zz; int z1; int z2; int z3; { return(*(int *)0); } void junk0() { /* void */ } int junk1() { return(*(int *)0); } void junk2() { /* void */ } int junk3() { return(*(int *)0); } BONG *junk4() { return(*(BONG **)0); } typedef int extern_junk; extern_junk *foo() { return(*(extern_junk **)0); } typedef int void_junk; void_junk *foo2a() { return(*(void_junk **)0); } void_junk *foo2a() { return(*(void_junk **)0); } void_junk *foo2() { return(*(void_junk **)0); } void_junk *foo_void(void_int) void_junk void_int; { return(*(void_junk **)0); } void (*sigdisp(sig, func))() int sig; void (*func)(); { return(*(void(*)())0); } void (*Sigdisp(sig, func))() int sig; void (*func)(); { return(*(void(*)())0); } void (*sigdisp2(sig, func))() int sig; void (*func)(); { return(*(void(*)())0); } int (*K_R_INT_ptr(p1, p2))() long *p1; int p2; { return(*(int(*)())0); } int (*STD_INT_ptr(p1, p2))() long *p1; int p2; { return(*(int(*)())0); } void (*K_R_VOID_ptr(p1, p2))() long *p1; int p2; { return(*(void(*)())0); } void (*STD_VOID_ptr(p1, p2))() long *p1; int p2; { return(*(void(*)())0); } int *K_R_int_ptr(p1, p2) long *p1; int p2; { return(*(int **)0); } int **STD_int2_ptr(p1, p2) long *p1; int p2; { return(*(int ***)0); } int *STD_int_ptr(p1, p2) long *p1; int p2; { return(*(int **)0); } void *K_R_void_ptr(p1, p2) long *p1; int p2; { return(*(void **)0); } void *STD_void_ptr(p1, p2) long *p1; int p2; { return(*(void **)0); } int K_R_int_val(p1, p2) long *p1; int p2; { return(*(int *)0); } int K_R_int_val2(p1, p2) long *p1; int p2; { return(*(int *)0); } int STD_int_val(p1, p2) long *p1; int p2; { return(*(int *)0); } void K_R_void_val(p1, p2) long *p1; int p2; { /* void */ } void K_R_void_val2(p1, p2) long *p1; int p2; { /* void */ } void STD_void_val(p1, p2) long *p1; int p2; { /* void */ } int (*XSetAfterFunction(p1, p2))() long *p1; int (*p2)(); { return(*(int(*)())0); } int XQueryKeymap(p1, p2) long *p1; char p2[32]; { return(*(int *)0); } int Another(p1, p2) long *p1; int (*p2)(); { return(*(int *)0); } int GenFunc(p1, p2) int *p1; int (*p2()); { return(*(int *)0); } void *(*__glob_opendir_hook)(); const char *(*__glob_readdir_hook)() = {0}; void (*__glob_closedir_hook)(); long long xxx; char *xxs; cproto-4.7t/testing/case13.ref0000644000175100001440000000632011510146523015026 0ustar tomusers/* LINTLIBRARY */ /* case13.c */ static x2; typedef int x4t; char x6; short x7; int x8; long x9; float x10; double x11; signed x12; unsigned x13; struct x14; union x15; enum x16; x4t; x4t x17; const x18 = {0}; volatile x19; typedef struct _first { int a:5; struct { int a,b; } b_struct; char b:16, b1:1; long c:16, c1; short d:16, d1:8, d2; unsigned e:16; float f; double g; struct _first *link; } _FIRST; typedef int badStyle; void badFunc(badStyle) int *badStyle; { /* void */ } _FIRST first; _FIRST last; _FIRST first_last[]; struct _second { enum {true, false} bool; enum {wrong=1, right=3} values; } _SECOND; int i[]; float f[]; int array[][10][20]; int dots_0(p1) int p1; { return(*(int *)0); } /* VARARGS1 */ int dots_1(p1) int p1; { return(*(int *)0); } /* VARARGS2 */ int dots_3(p1, p2) int p1; char p2; { return(*(int *)0); } _FIRST *func1() { return(*(_FIRST **)0); } _FIRST *func2(p1, p2, p) _FIRST *p1; int p2[]; float p; { return(*(_FIRST **)0); } int *(func_func)() { return(*(int **)0); } typedef int bool; bool a1; static bool a2; struct ZIP1 { int x1, y1; }; struct zip2 { int x2, y2; } z2; struct { int x3, y3; } z3; struct ZIP4 { int x4, y4; }; static struct zip5 { int x5, y5; } z5; static struct zip6 { int x6, y6; } z6; static struct zip6 { int x6, y6; } w6; static struct { int x7, y7; } z7; static struct { int x8, y8; } z8; static struct { int x8, y8; } w8; enum zap1 { a,b,c,d } what; enum zap2 what2; enum {a9,b9,c9,d9} what3; static char *zap; typedef struct bong { int (*func)(); } BONG; typedef char *string; void main(argc, argv) int argc; char **argv; { /* void */ } /* VARARGS */ int veryfunny(a, b, c) char *a; long b; long c; { return(*(int *)0); } /* VARARGS3 */ int program(argv, y, zz, z1, z2, z3) string argv[]; struct alpha { int x,z; } y; int zz; int z1; int z2; int z3; { return(*(int *)0); } void junk0() { /* void */ } int junk1() { return(*(int *)0); } void junk2() { /* void */ } int junk3() { return(*(int *)0); } BONG *junk4() { return(*(BONG **)0); } typedef int extern_junk; extern_junk *foo() { return(*(extern_junk **)0); } typedef int void_junk; void_junk *foo2a() { return(*(void_junk **)0); } void_junk *foo2() { return(*(void_junk **)0); } void_junk *foo_void(void_int) void_junk void_int; { return(*(void_junk **)0); } static void_junk *foo_void2() { return(*(void_junk **)0); } void (*Sigdisp(sig, func))() int sig; void (*func)(); { return(*(void(*)())0); } void (*sigdisp2(sig, func))() int sig; void (*func)(); { return(*(void(*)())0); } int (*K_R_INT_ptr(p1, p2))() long *p1; int p2; { return(*(int(*)())0); } void (*K_R_VOID_ptr(p1, p2))() long *p1; int p2; { return(*(void(*)())0); } int *K_R_int_ptr(p1, p2) long *p1; int p2; { return(*(int **)0); } void *K_R_void_ptr(p1, p2) long *p1; int p2; { return(*(void **)0); } int K_R_int_val(p1, p2) long *p1; int p2; { return(*(int *)0); } int K_R_int_val2(p1, p2) long *p1; int p2; { return(*(int *)0); } void K_R_void_val(p1, p2) long *p1; int p2; { /* void */ } void K_R_void_val2(p1, p2) long *p1; int p2; { /* void */ } long long xxx; char *xxs; cproto-4.7t/testing/test_dos.bat0000644000175100001440000000020006455015617015567 0ustar tomusers@echo off rem $Id: test_dos.bat,v 4.1 1998/01/08 00:19:27 cthuang Exp $ erase run_test.out for %%n in ( case*.bat ) do call %%n cproto-4.7t/testing/testunix.sh0000755000175100001440000000351313704070264015501 0ustar tomusers#!/bin/sh # $Id: testunix.sh,v 4.4 2020/07/16 15:22:28 tom Exp $ # # Test one or more given cases by number, creating the VMS test script # as a side-effect. # CPROTO=../cproto errors= [ -z "$TEST_REF" ] && TEST_REF=. mkdir -p $TEST_REF save_errs() { if [ "$TEST_REF" != . ] then cp "$ERR_FILE" "$TEST_REF/" fi rm -f "$ERR_FILE" } for i in "$@" do case $i in check) continue ;; check_errors) errors=yes continue ;; esac echo "** Case $i" I="case$i" ./make_dcl.sh "$i" TST_FILE="$I.c" OUT_FILE="$I.out" ERR_FILE="$I.err" REF_FILE="$TEST_REF/$I.ref" TMP_FILE="$I.tmp" rm -f "$TST_FILE" "$OUT_FILE" "$ERR_FILE" "$TMP_FILE" cp syntax.c "$TST_FILE" chmod +w "$TST_FILE" . "./$I.dcl" 2>"$ERR_FILE" # When we select either the -a or -t options, CPROTO will edit # the input file. It also writes to the standard output the # prototypes that it is extracting. Since there's only one # reference for each test, I simply concatenate the edited file # after the test output, for use as a combined reference. if ! cmp -s "$TST_FILE" syntax.c then echo "... edited $TST_FILE ..." >>"$OUT_FILE" cat "$TST_FILE" >>"$OUT_FILE" fi rm -f "$TST_FILE" if [ -f "$REF_FILE" ] then if [ -f "$OUT_FILE" ] then diff -b -c "$REF_FILE" "$OUT_FILE" |fgrep -v 'No diff' >"$TMP_FILE" if [ -s "$TMP_FILE" ] then echo '... error' cat "$ERR_FILE" cat "$TMP_FILE" else echo '... ok' if [ -n "$errors" ] then if [ "$TEST_REF" != "." ] then cmp -s "$ERR_FILE" "$TEST_REF/$ERR_FILE" || cat "$ERR_FILE" else cat "$ERR_FILE" fi fi rm -f "$OUT_FILE" "$TMP_FILE" "$ERR_FILE" fi else echo "? no output $I" fi else echo "...saving reference for $i" mv "$OUT_FILE" "$REF_FILE" save_errs rm -f "$OUT_FILE" "$TMP_FILE" "$ERR_FILE" fi done # vile: ts=4 sw=4 cproto-4.7t/aclocal.m40000644000175100001440000016604614115232724013453 0ustar tomusersdnl $Id: aclocal.m4,v 4.36 2021/09/05 21:25:40 tom Exp $ dnl dnl Macros for cproto configure script dnl --------------------------------------------------------------------------- dnl Copyright 1994-2020,2021 Thomas E. Dickey dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), dnl to deal in the Software without restriction, including without limitation dnl the rights to use, copy, modify, merge, publish, distribute, distribute dnl with modifications, sublicense, and/or sell copies of the Software, and to dnl permit persons to whom the Software is furnished to do so, subject to the dnl following conditions: dnl dnl The above copyright notice and this permission notice shall be included in dnl all copies or substantial portions of the Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL dnl THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER dnl DEALINGS IN THE SOFTWARE. dnl dnl Except as contained in this notice, the name(s) of the above copyright dnl holders shall not be used in advertising or otherwise to promote the sale, dnl use or other dealings in this Software without prior written authorization. dnl dnl --------------------------------------------------------------------------- dnl See dnl https://invisible-island.net/autoconf/autoconf.html dnl https://invisible-island.net/autoconf/my-autoconf.html dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 dnl ------------------ dnl Conditionally generate script according to whether we're using a given autoconf. dnl dnl $1 = version to compare against dnl $2 = code to use if AC_ACVERSION is at least as high as $1. dnl $3 = code to use if AC_ACVERSION is older than $1. define([CF_ACVERSION_CHECK], [ ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl ifdef([m4_version_compare], [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], [CF_ACVERSION_COMPARE( AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl dnl --------------------------------------------------------------------------- dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 dnl -------------------- dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, dnl MAJOR2, MINOR2, TERNARY2, dnl PRINTABLE2, not FOUND, FOUND) define([CF_ACVERSION_COMPARE], [ifelse(builtin([eval], [$2 < $5]), 1, [ifelse([$8], , ,[$8])], [ifelse([$9], , ,[$9])])])dnl dnl --------------------------------------------------------------------------- dnl CF_ADD_CFLAGS version: 15 updated: 2020/12/31 10:54:15 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS dnl $1 = flags to add dnl $2 = if given makes this macro verbose. dnl dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily dnl confused by the quotes (which require backslashes to keep them usable). AC_DEFUN([CF_ADD_CFLAGS], [ cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $1 do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) continue elif test "${cf_tst_cflags}" = "\"'" ; then CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) ;; esac CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) ;; esac ;; (*) CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) ;; esac ;; (yes) CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) fi if test -n "$cf_new_cppflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) fi if test -n "$cf_new_extra_cppflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) fi AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_APPEND_CFLAGS version: 3 updated: 2021/09/05 17:25:40 dnl ---------------- dnl Use CF_ADD_CFLAGS after first checking for potential redefinitions. dnl $1 = flags to add dnl $2 = if given makes this macro verbose. define([CF_APPEND_CFLAGS], [ for cf_add_cflags in $1 do case "x$cf_add_cflags" in (x-[[DU]]*) CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2]) CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2]) ;; esac CF_ADD_CFLAGS([$cf_add_cflags],[$2]) done ])dnl dnl --------------------------------------------------------------------------- dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 dnl -------------- dnl use this macro for appending text without introducing an extra blank at dnl the beginning define([CF_APPEND_TEXT], [ test -n "[$]$1" && $1="[$]$1 " $1="[$]{$1}$2" ])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 dnl -------------- dnl Allow user to disable a normally-on option. AC_DEFUN([CF_ARG_DISABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 dnl ------------- dnl Allow user to enable a normally-off option. AC_DEFUN([CF_ARG_ENABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 dnl ------------- dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus dnl values. dnl dnl Parameters: dnl $1 = option name dnl $2 = help-string dnl $3 = action to perform if option is not default dnl $4 = action if perform if option is default dnl $5 = default option value (either 'yes' or 'no') AC_DEFUN([CF_ARG_OPTION], [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) if test "$enableval" != "$5" ; then ifelse([$3],,[ :]dnl ,[ $3]) ifelse([$4],,,[ else $4]) fi],[enableval=$5 ifelse([$4],,,[ $4 ])dnl ])])dnl dnl --------------------------------------------------------------------------- dnl CF_C11_NORETURN version: 3 updated: 2021/03/28 11:36:23 dnl --------------- AC_DEFUN([CF_C11_NORETURN], [ AC_MSG_CHECKING(if you want to use C11 _Noreturn feature) CF_ARG_ENABLE(stdnoreturn, [ --enable-stdnoreturn enable C11 _Noreturn feature for diagnostics], [enable_stdnoreturn=yes], [enable_stdnoreturn=no]) AC_MSG_RESULT($enable_stdnoreturn) if test $enable_stdnoreturn = yes; then AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn, [AC_TRY_COMPILE([ #include #include #include static _Noreturn void giveup(void) { exit(0); } ], [if (feof(stdin)) giveup()], cf_cv_c11_noreturn=yes, cf_cv_c11_noreturn=no) ]) else cf_cv_c11_noreturn=no, fi if test "$cf_cv_c11_noreturn" = yes; then AC_DEFINE(HAVE_STDNORETURN_H, 1,[Define if header is available and working]) AC_DEFINE_UNQUOTED(STDC_NORETURN,_Noreturn,[Define if C11 _Noreturn keyword is supported]) HAVE_STDNORETURN_H=1 else HAVE_STDNORETURN_H=0 fi AC_SUBST(HAVE_STDNORETURN_H) AC_SUBST(STDC_NORETURN) ])dnl dnl --------------------------------------------------------------------------- dnl CF_CC_ENV_FLAGS version: 10 updated: 2020/12/31 18:40:20 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content dnl into CC. This will not help with broken scripts that wrap the compiler dnl with options, but eliminates a more common category of user confusion. dnl dnl In particular, it addresses the problem of being able to run the C dnl preprocessor in a consistent manner. dnl dnl Caveat: this also disallows blanks in the pathname for the compiler, but dnl the nuisance of having inconsistent settings for compiler and preprocessor dnl outweighs that limitation. AC_DEFUN([CF_CC_ENV_FLAGS], [ # This should have been defined by AC_PROG_CC : "${CC:=cc}" AC_MSG_CHECKING(\$CFLAGS variable) case "x$CFLAGS" in (*-[[IUD]]*) AC_MSG_RESULT(broken) AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) cf_flags="$CFLAGS" CFLAGS= for cf_arg in $cf_flags do CF_ADD_CFLAGS($cf_arg) done ;; (*) AC_MSG_RESULT(ok) ;; esac AC_MSG_CHECKING(\$CC variable) case "$CC" in (*[[\ \ ]]-*) AC_MSG_RESULT(broken) AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) # humor him... cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'` CC="$cf_prog" for cf_arg in $cf_flags do case "x$cf_arg" in (x-[[IUDfgOW]]*) CF_ADD_CFLAGS($cf_arg) ;; (*) CC="$CC $cf_arg" ;; esac done CF_VERBOSE(resulting CC: '$CC') CF_VERBOSE(resulting CFLAGS: '$CFLAGS') CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') ;; (*) AC_MSG_RESULT(ok) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_CHECK_CACHE version: 13 updated: 2020/12/31 10:54:15 dnl -------------- dnl Check if we're accidentally using a cache from a different machine. dnl Derive the system name, as a check for reusing the autoconf cache. dnl dnl If we've packaged config.guess and config.sub, run that (since it does a dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM dnl which is useful in cross-compiles. dnl dnl Note: we would use $ac_config_sub, but that is one of the places where dnl autoconf 2.5x broke compatibility with autoconf 2.13 AC_DEFUN([CF_CHECK_CACHE], [ if test -f "$srcdir/config.guess" || test -f "$ac_aux_dir/config.guess" ; then ifelse([$1],,[AC_CANONICAL_HOST],[$1]) system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) if test ".$system_name" != ".$cf_cv_system_name" ; then AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) AC_MSG_ERROR("Please remove config.cache and try again.") fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_CLANG_COMPILER version: 8 updated: 2021/01/01 13:31:04 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does dnl not ignore some gcc options. dnl dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from dnl the wrappers for gcc and g++ warnings. dnl dnl $1 = GCC (default) or GXX dnl $2 = CLANG_COMPILER (default) dnl $3 = CFLAGS (default) or CXXFLAGS AC_DEFUN([CF_CLANG_COMPILER],[ ifelse([$2],,CLANG_COMPILER,[$2])=no if test "$ifelse([$1],,[$1],GCC)" = yes ; then AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" AC_TRY_COMPILE([],[ #ifdef __clang__ #else make an error #endif ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) fi CLANG_VERSION=none if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then case "$CC" in (c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]]) AC_MSG_WARN(replacing broken compiler alias $CC) CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" CC=clang ;; esac AC_MSG_CHECKING(version of $CC) CLANG_VERSION="`$CC --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(CLANG[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$CLANG_VERSION" && CLANG_VERSION=unknown AC_MSG_RESULT($CLANG_VERSION) for cf_clang_opt in \ -Qunused-arguments \ -Wno-error=implicit-function-declaration do AC_MSG_CHECKING(if option $cf_clang_opt works) cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cf_clang_opt" AC_TRY_LINK([ #include ],[ printf("hello!\\n");],[ cf_clang_optok=yes],[ cf_clang_optok=no]) AC_MSG_RESULT($cf_clang_optok) CFLAGS="$cf_save_CFLAGS" if test "$cf_clang_optok" = yes; then CF_VERBOSE(adding option $cf_clang_opt) CF_APPEND_TEXT(CFLAGS,$cf_clang_opt) fi done fi ]) dnl --------------------------------------------------------------------------- dnl CF_CPP_DOES_COMMENTS version: 2 updated: 2020/10/11 15:32:45 dnl -------------------- dnl Check if the C preprocessor accepts a "-C" option for passing-through dnl comments. AC_DEFUN([CF_CPP_DOES_COMMENTS], [ AC_CACHE_CHECK(if preprocessor ($CPP) has -C comment-option,cf_cv_cpp_does_comments,[ cf_cv_cpp_does_comments=no cat >conftest.c <conftest.i 2>/dev/null if grep "HELLO WORLD" conftest.i >/dev/null then cf_cv_cpp_does_comments=yes fi ]) test "$cf_cv_cpp_does_comments" = yes && AC_DEFINE(CPP_DOES_COMMENTS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_DISABLE_ECHO version: 14 updated: 2021/09/04 06:35:04 dnl --------------- dnl You can always use "make -n" to see the actual options, but it is hard to dnl pick out/analyze warning messages when the compile-line is long. dnl dnl Sets: dnl ECHO_LT - symbol to control if libtool is verbose dnl ECHO_LD - symbol to prefix "cc -o" lines dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) dnl SHOW_CC - symbol to put before explicit "cc -c" lines dnl ECHO_CC - symbol to put before any "cc" line dnl AC_DEFUN([CF_DISABLE_ECHO],[ AC_MSG_CHECKING(if you want to see long compiling messages) CF_ARG_DISABLE(echo, [ --disable-echo do not display "compiling" commands], [ ECHO_LT='--silent' ECHO_LD='@echo linking [$]@;' RULE_CC='@echo compiling [$]<' SHOW_CC='@echo compiling [$]@' ECHO_CC='@' ],[ ECHO_LT='' ECHO_LD='' RULE_CC='' SHOW_CC='' ECHO_CC='' ]) AC_MSG_RESULT($enableval) AC_SUBST(ECHO_LT) AC_SUBST(ECHO_LD) AC_SUBST(RULE_CC) AC_SUBST(SHOW_CC) AC_SUBST(ECHO_CC) ])dnl dnl --------------------------------------------------------------------------- dnl CF_DISABLE_LEAKS version: 9 updated: 2021/04/03 16:41:50 dnl ---------------- dnl Combine no-leak checks with the libraries or tools that are used for the dnl checks. AC_DEFUN([CF_DISABLE_LEAKS],[ AC_REQUIRE([CF_WITH_DMALLOC]) AC_REQUIRE([CF_WITH_DBMALLOC]) AC_REQUIRE([CF_WITH_VALGRIND]) AC_MSG_CHECKING(if you want to perform memory-leak testing) AC_ARG_ENABLE(leaks, [ --disable-leaks test: free permanent memory, analyze leaks], [enable_leaks=$enableval], [enable_leaks=yes]) dnl with_no_leaks is more readable... if test "x$enable_leaks" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi AC_MSG_RESULT($with_no_leaks) if test "$enable_leaks" = no ; then AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_ENABLE_WARNINGS version: 9 updated: 2021/01/05 19:40:50 dnl ------------------ dnl Configure-option to enable gcc warnings dnl dnl $1 = extra options to add, if supported dnl $2 = option for checking attributes. By default, this is done when dnl warnings are enabled. For other values: dnl yes: always do this, e.g., to use in generated library-headers dnl no: never do this AC_DEFUN([CF_ENABLE_WARNINGS],[ if test "$GCC" = yes || test "$GXX" = yes then CF_FIX_WARNINGS(CFLAGS) CF_FIX_WARNINGS(CPPFLAGS) CF_FIX_WARNINGS(LDFLAGS) AC_MSG_CHECKING(if you want to turn on gcc warnings) CF_ARG_ENABLE(warnings, [ --enable-warnings test: turn on gcc compiler warnings], [enable_warnings=yes], [enable_warnings=no]) AC_MSG_RESULT($enable_warnings) if test "$enable_warnings" = "yes" then ifelse($2,,[CF_GCC_ATTRIBUTES]) CF_GCC_WARNINGS($1) fi ifelse($2,yes,[CF_GCC_ATTRIBUTES]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_FIX_WARNINGS version: 3 updated: 2020/12/31 18:40:20 dnl --------------- dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's dnl "-Werror" flags can interfere with configure-checks. Those go into dnl EXTRA_CFLAGS. dnl dnl $1 = variable name to repair define([CF_FIX_WARNINGS],[ if test "$GCC" = yes || test "$GXX" = yes then case [$]$1 in (*-Werror=*) CF_VERBOSE(repairing $1: [$]$1) cf_temp_flags= for cf_temp_scan in [$]$1 do case "x$cf_temp_scan" in (x-Werror=*) CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan) ;; (*) CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) ;; esac done $1="$cf_temp_flags" CF_VERBOSE(... fixed [$]$1) CF_VERBOSE(... extra $EXTRA_CFLAGS) ;; esac fi AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary dnl to documentation, unrecognized directives cause older compilers to barf. AC_DEFUN([CF_GCC_ATTRIBUTES], [AC_REQUIRE([AC_PROG_FGREP])dnl AC_REQUIRE([CF_C11_NORETURN])dnl if test "$GCC" = yes || test "$GXX" = yes then cat > conftest.i < "conftest.$ac_ext" <&AC_FD_CC case "$cf_attribute" in (printf) cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <>confdefs.h case "$cf_attribute" in (noreturn) AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) ;; (printf) cf_value='/* nothing */' if test "$cf_printf_attribute" != no ; then cf_value='__attribute__((format(printf,fmt,var)))' AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) fi AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) ;; (scanf) cf_value='/* nothing */' if test "$cf_scanf_attribute" != no ; then cf_value='__attribute__((format(scanf,fmt,var)))' AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) fi AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) ;; (unused) AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) ;; esac fi done else ${FGREP-fgrep} define conftest.i >>confdefs.h fi rm -rf ./conftest* fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36 dnl -------------- dnl Find version of gcc, and (because icc/clang pretend to be gcc without being dnl compatible), attempt to determine if icc/clang is actually used. AC_DEFUN([CF_GCC_VERSION],[ AC_REQUIRE([AC_PROG_CC]) GCC_VERSION=none if test "$GCC" = yes ; then AC_MSG_CHECKING(version of $CC) GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION) fi CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59 dnl --------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: dnl dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) dnl -Winline (usually not worthwhile) dnl -Wredundant-decls (system headers make this too noisy) dnl -Wtraditional (combines too many unrelated messages, only a few useful) dnl -Wwrite-strings (too noisy, but should review occasionally). This dnl is enabled for ncurses using "--enable-const". dnl -pedantic dnl dnl Parameter: dnl $1 is an optional list of gcc warning flags that a particular dnl application might want to use, e.g., "no-unused" for dnl -Wno-unused dnl Special: dnl If $with_ext_const is "yes", add a check for -Wwrite-strings dnl AC_DEFUN([CF_GCC_WARNINGS], [ AC_REQUIRE([CF_GCC_VERSION]) if test "x$have_x" = xyes; then CF_CONST_X_STRING fi cat > "conftest.$ac_ext" <],[ #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 return 0; #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 return 0; #else # error not GNU C library #endif], [cf_cv_gnu_library=yes], [cf_cv_gnu_library=no]) ]) if test x$cf_cv_gnu_library = xyes; then # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE # was changed to help a little. newlib incorporated the change about 4 # years later. AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) AC_TRY_COMPILE([#include ],[ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) return 0; #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) return 0; #else # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old #endif], [cf_cv_gnu_library_219=yes], [cf_cv_gnu_library_219=no]) CPPFLAGS="$cf_save" ]) if test "x$cf_cv_gnu_library_219" = xyes; then cf_save="$CPPFLAGS" AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) AC_TRY_COMPILE([ #include #include ],[ #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) return 0; #else # error GNU C library is too old #endif], [cf_cv_gnu_dftsrc_219=yes], [cf_cv_gnu_dftsrc_219=no]) ]) test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" else cf_cv_gnu_dftsrc_219=maybe fi if test "x$cf_cv_gnu_dftsrc_219" != xyes; then AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ AC_TRY_COMPILE([#include ],[ #ifndef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be defined #endif], [cf_cv_gnu_source=no], [cf_save="$CPPFLAGS" CF_ADD_CFLAGS(-D_GNU_SOURCE) AC_TRY_COMPILE([#include ],[ #ifdef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be undefined #endif], [cf_cv_gnu_source=no], [cf_cv_gnu_source=yes]) CPPFLAGS="$cf_save" ]) ]) if test "$cf_cv_gnu_source" = yes then AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) AC_TRY_COMPILE([#include ],[ #ifdef _DEFAULT_SOURCE #error expected _DEFAULT_SOURCE to be undefined #endif], [cf_cv_default_source=no], [cf_cv_default_source=yes]) ]) if test "$cf_cv_default_source" = yes then CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) fi fi fi fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_INTEL_COMPILER version: 8 updated: 2021/01/01 16:53:59 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. dnl dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from dnl the wrappers for gcc and g++ warnings. dnl dnl $1 = GCC (default) or GXX dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS dnl $3 = CFLAGS (default) or CXXFLAGS AC_DEFUN([CF_INTEL_COMPILER],[ AC_REQUIRE([AC_CANONICAL_HOST]) ifelse([$2],,INTEL_COMPILER,[$2])=no if test "$ifelse([$1],,[$1],GCC)" = yes ; then case "$host_os" in (linux*|gnu*) AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" AC_TRY_COMPILE([],[ #ifdef __INTEL_COMPILER #else make an error #endif ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) ;; esac fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_MAKE_DOCS version: 5 updated: 2021/01/10 16:05:11 dnl ------------ dnl $1 = name(s) to generate rules for dnl $2 = suffix of corresponding manpages used as input. dnl dnl This works best if called at the end of configure.in, following CF_WITH_MAN2HTML define([CF_MAKE_DOCS],[ test -z "$cf_make_docs" && cf_make_docs=0 cf_output=makefile test -f "$cf_output" || cf_output=Makefile if test "$cf_make_docs" = 0 then cat >>$cf_output <[\$]@ ${GROFF_NOTE}.ps.pdf : ${GROFF_NOTE} ps2pdf [\$]*.ps ${GROFF_NOTE} ${GROFF_NOTE}.$2.ps : ${GROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | groff -man" >[\$]@ ${GROFF_NOTE} ${GROFF_NOTE}.$2.txt : ${GROFF_NOTE} GROFF_NO_SGR=stupid [\$](SHELL) -c "tbl [\$]*.$2 | nroff -rHY=0 -Tascii -man | col -bx" >[\$]@ ${MAN2HTML_NOTE}.$2.html : ${MAN2HTML_NOTE} ./${MAN2HTML_TEMP} [\$]* $2 man >[\$]@ CF_EOF cf_make_docs=1 fi for cf_name in $1 do cat >>$cf_output <conftest if test -f CONFTEST ; then cf_cv_mixedcase=no else cf_cv_mixedcase=yes fi rm -f conftest CONFTEST fi ]) test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_MKSTEMP version: 11 updated: 2021/01/01 13:31:04 dnl ---------- dnl Check for a working mkstemp. This creates two files, checks that they are dnl successfully created and distinct (AmigaOS apparently fails on the last). AC_DEFUN([CF_MKSTEMP],[ AC_CHECK_HEADERS( \ unistd.h \ ) AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ rm -rf ./conftest* AC_TRY_RUN([ #include #ifdef HAVE_UNISTD_H #include #endif #include #include #include #include int main(void) { char *tmpl = "conftestXXXXXX"; char name[2][80]; int n; int result = 0; int fd; struct stat sb; umask(077); for (n = 0; n < 2; ++n) { strcpy(name[n], tmpl); if ((fd = mkstemp(name[n])) >= 0) { if (!strcmp(name[n], tmpl) || stat(name[n], &sb) != 0 || (sb.st_mode & S_IFMT) != S_IFREG || (sb.st_mode & 077) != 0) { result = 1; } close(fd); } } if (result == 0 && !strcmp(name[0], name[1])) result = 1; ${cf_cv_main_return:-return}(result); } ],[cf_cv_func_mkstemp=yes ],[cf_cv_func_mkstemp=no ],[cf_cv_func_mkstemp=maybe]) ]) if test "x$cf_cv_func_mkstemp" = xmaybe ; then AC_CHECK_FUNC(mkstemp) fi if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 dnl ---------- dnl Write a debug message to config.log, along with the line number in the dnl configure script. AC_DEFUN([CF_MSG_LOG],[ echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC ])dnl dnl --------------------------------------------------------------------------- dnl CF_NEED_PROG version: 1 updated: 2021/01/10 07:35:14 dnl ------------ dnl Check if a program was found by inspecting the variable used to record its dnl name: dnl $1 is the name of the variable dnl $2 is the action to take if it is found dnl $3 is the action to take if it is missing, defaulting to simple error exit define([CF_NEED_PROG],[ case "x[$]$1" in (x|x:|xno|xnone) ifelse($3,,[AC_MSG_ERROR($1: no suitable program was found)],[$3]) ;; (*) ifelse($2,,,[$2]) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_NO_LEAKS_OPTION version: 9 updated: 2021/06/13 19:45:41 dnl ------------------ dnl see CF_WITH_NO_LEAKS dnl dnl $1 = option/name dnl $2 = help-text dnl $3 = symbol to define if the option is set dnl $4 = additional actions to take if the option is set AC_DEFUN([CF_NO_LEAKS_OPTION],[ AC_MSG_CHECKING(if you want to use $1 for testing) AC_ARG_WITH($1, [$2], [case "x$withval" in (x|xno) ;; (*) : "${with_cflags:=-g}" : "${enable_leaks:=no}" with_$1=yes AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ $4 ]) ;; esac], [with_$1=]) AC_MSG_RESULT(${with_$1:-no}) case ".$with_cflags" in (.*-g*) case .$CFLAGS in (.*-g*) ;; (*) CF_ADD_CFLAGS([-g]) ;; esac ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_PATH_SYNTAX version: 18 updated: 2020/12/31 18:40:20 dnl -------------- dnl Check the argument to see that it looks like a pathname. Rewrite it if it dnl begins with one of the prefix/exec_prefix variables, and then again if the dnl result begins with 'NONE'. This is necessary to work around autoconf's dnl delayed evaluation of those symbols. AC_DEFUN([CF_PATH_SYNTAX],[ if test "x$prefix" != xNONE; then cf_path_syntax="$prefix" else cf_path_syntax="$ac_default_prefix" fi case ".[$]$1" in (.\[$]\(*\)*|.\'*\'*) ;; (..|./*|.\\*) ;; (.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX ;; (.\[$]\{*prefix\}*|.\[$]\{*dir\}*) eval $1="[$]$1" case ".[$]$1" in (.NONE/*) $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` ;; esac ;; (.no|.NONE/*) $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` ;; (*) ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_POPEN_TEST version: 5 updated: 2014/06/04 18:37:28 dnl ------------- dnl Check to ensure that our prototype for 'popen()' doesn't conflict dnl with the system's (this is a problem on AIX and CLIX). dnl AC_DEFUN([CF_POPEN_TEST], [AC_MSG_CHECKING(for conflicting prototype for popen) AC_CACHE_VAL(ac_cv_td_popen, AC_TRY_LINK([ #include #include "system.h" #if defined(popen) || defined(pclose) make an error #else extern int pclose (FILE *p); extern FILE *popen (const char *c, const char *m); #endif ],, ac_cv_td_popen=no, ac_cv_td_popen=yes)) AC_MSG_RESULT($ac_cv_td_popen) if test $ac_cv_td_popen = yes; then AC_DEFINE(HAVE_POPEN_PROTOTYPE,[1],[Conflicting popen prototype]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17 dnl ----------------- dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. dnl dnl POSIX.1-1990 _POSIX_SOURCE dnl POSIX.1-1990 and _POSIX_SOURCE and dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 dnl Bindings Option dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L dnl X/Open 2000 _POSIX_C_SOURCE=200112L dnl dnl Parameters: dnl $1 is the nominal value for _POSIX_C_SOURCE AC_DEFUN([CF_POSIX_C_SOURCE], [AC_REQUIRE([CF_POSIX_VISIBLE])dnl if test "$cf_cv_posix_visible" = no; then cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ CF_MSG_LOG(if the symbol is already defined go no further) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE make an error #endif], [cf_cv_posix_c_source=no], [cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in (.[[12]]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; (.2) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; (.*) cf_want_posix_source=yes ;; esac if test "$cf_want_posix_source" = yes ; then AC_TRY_COMPILE([#include ],[ #ifdef _POSIX_SOURCE make an error #endif],[], cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") fi CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) CF_MSG_LOG(if the second compile does not leave our definition intact error) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE make an error #endif],, [cf_cv_posix_c_source=no]) CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" ]) ]) if test "$cf_cv_posix_c_source" != no ; then CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" CF_ADD_CFLAGS($cf_cv_posix_c_source) fi fi # cf_cv_posix_visible ])dnl dnl --------------------------------------------------------------------------- dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 dnl ---------------- dnl POSIX documents test-macros which an application may set before any system dnl headers are included to make features available. dnl dnl Some BSD platforms (originally FreeBSD, but copied by a few others) dnl diverged from POSIX in 2002 by setting symbols which make all of the most dnl recent features visible in the system header files unless the application dnl overrides the corresponding test-macros. Doing that introduces portability dnl problems. dnl dnl This macro makes a special check for the symbols used for this, to avoid a dnl conflicting definition. AC_DEFUN([CF_POSIX_VISIBLE], [ AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ AC_TRY_COMPILE([#include ],[ #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) #error conflicting symbols found #endif ],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) ]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 dnl ---------- dnl standard check for CC, plus followup sanity checks dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name AC_DEFUN([CF_PROG_CC],[ CF_ACVERSION_CHECK(2.53, [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) AC_REQUIRE([AC_PROG_CC])], []) ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) CF_GCC_VERSION CF_ACVERSION_CHECK(2.52, [AC_PROG_CC_STDC], [CF_ANSI_CC_REQD]) CF_CC_ENV_FLAGS ])dnl dnl --------------------------------------------------------------------------- dnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19 dnl ------------- dnl Check if groff is available, for cases (such as html output) where nroff dnl is not enough. AC_DEFUN([CF_PROG_GROFF],[ AC_PATH_PROG(GROFF_PATH,groff,no) AC_PATH_PROGS(NROFF_PATH,nroff mandoc,no) AC_PATH_PROG(TBL_PATH,tbl,cat) if test "x$GROFF_PATH" = xno then NROFF_NOTE= GROFF_NOTE="#" else NROFF_NOTE="#" GROFF_NOTE= fi AC_SUBST(GROFF_NOTE) AC_SUBST(NROFF_NOTE) ])dnl dnl --------------------------------------------------------------------------- dnl CF_PROG_LINT version: 4 updated: 2019/11/20 18:55:37 dnl ------------ AC_DEFUN([CF_PROG_LINT], [ AC_CHECK_PROGS(LINT, lint cppcheck splint) case "x$LINT" in (xcppcheck|x*/cppcheck) test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" ;; esac AC_SUBST(LINT_OPTS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40 dnl ---------------- dnl Remove a given option from CFLAGS/CPPFLAGS dnl $1 = option to remove dnl $2 = variable to update dnl $3 = nonempty to allow verbose message define([CF_REMOVE_CFLAGS], [ cf_tmp_cflag=`echo "x$1" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x[$]$2" | sed -e 's/^.//' -e 's/[[ ]][[ ]]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[[^ ]][[^ ]]*\\)\?%%" -e 's/^[[ ]]*//' -e 's%[[ ]][[ ]]*-D% -D%g' -e 's%[[ ]][[ ]]*-I% -I%g'` test "[$]$2" != "$cf_old_cflag" || break ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)]) $2="$cf_old_cflag" done ])dnl dnl --------------------------------------------------------------------------- dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 dnl ---------------- dnl Remove all -U and -D options that refer to the given symbol from a list dnl of C compiler options. This works around the problem that not all dnl compilers process -U and -D options from left-to-right, so a -U option dnl cannot be used to cancel the effect of a preceding -D option. dnl dnl $1 = target (which could be the same as the source variable) dnl $2 = source (including '$') dnl $3 = symbol to remove define([CF_REMOVE_DEFINE], [ $1=`echo "$2" | \ sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` ])dnl dnl --------------------------------------------------------------------------- dnl CF_SIZE_T version: 6 updated: 2021/01/10 18:23:00 dnl --------- dnl On both Ultrix and CLIX, I find size_t defined in AC_DEFUN([CF_SIZE_T], [ AC_MSG_CHECKING(for size_t in or ) AC_CACHE_VAL(cf_cv_type_size_t,[ AC_TRY_COMPILE([ #include #ifdef STDC_HEADERS #include #include #endif #include ], [size_t x], [cf_cv_type_size_t=yes], [cf_cv_type_size_t=no]) ]) AC_MSG_RESULT($cf_cv_type_size_t) test "$cf_cv_type_size_t" = no && AC_DEFINE(size_t, unsigned, [Define to type if size_t not declared]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_TRY_XOPEN_SOURCE version: 3 updated: 2021/08/28 15:20:37 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ AC_TRY_COMPILE([ #include #include #include ],[ #ifndef _XOPEN_SOURCE make an error #endif], [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) AC_TRY_COMPILE([ #include #include #include ],[ #ifdef _XOPEN_SOURCE make an error #endif], [cf_cv_xopen_source=no], [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) CPPFLAGS="$cf_save" ]) ]) if test "$cf_cv_xopen_source" != no ; then CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" CF_APPEND_CFLAGS($cf_temp_xopen_source) fi ]) dnl --------------------------------------------------------------------------- dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 dnl -------- dnl Make an uppercase version of a variable dnl $1=uppercase($2) AC_DEFUN([CF_UPPER], [ $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` ])dnl dnl --------------------------------------------------------------------------- dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 dnl ---------- dnl Use AC_VERBOSE w/o the warnings AC_DEFUN([CF_VERBOSE], [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG CF_MSG_LOG([$1]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITHOUT_X version: 3 updated: 2021/01/13 16:51:52 dnl ------------ dnl Use this to cancel the check for X headers/libraries which would be pulled dnl in via CF_GCC_WARNINGS. define([CF_WITHOUT_X], AC_DEFUN([AC_PATH_XTRA],[]) AC_DEFUN([CF_SAVE_XTRA_FLAGS],[]) AC_DEFUN([CF_RESTORE_XTRA_FLAGS],[]) AC_DEFUN([CF_CONST_X_STRING],[echo "skipping X-const check";])dnl AC_SUBST(X_CFLAGS) AC_SUBST(X_LIBS) [])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 dnl ---------------- dnl Configure-option for dbmalloc. The optional parameter is used to override dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. AC_DEFUN([CF_WITH_DBMALLOC],[ CF_NO_LEAKS_OPTION(dbmalloc, [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], [USE_DBMALLOC]) if test "$with_dbmalloc" = yes ; then AC_CHECK_HEADER(dbmalloc.h, [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 dnl --------------- dnl Configure-option for dmalloc. The optional parameter is used to override dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. AC_DEFUN([CF_WITH_DMALLOC],[ CF_NO_LEAKS_OPTION(dmalloc, [ --with-dmalloc test: use Gray Watson's dmalloc library], [USE_DMALLOC]) if test "$with_dmalloc" = yes ; then AC_CHECK_HEADER(dmalloc.h, [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_MAN2HTML version: 12 updated: 2021/01/03 18:30:50 dnl ---------------- dnl Check for man2html and groff. Prefer man2html over groff, but use groff dnl as a fallback. See dnl dnl http://invisible-island.net/scripts/man2html.html dnl dnl Generate a shell script which hides the differences between the two. dnl dnl We name that "man2html.tmp". dnl dnl The shell script can be removed later, e.g., using "make distclean". AC_DEFUN([CF_WITH_MAN2HTML],[ AC_REQUIRE([CF_PROG_GROFF])dnl AC_REQUIRE([AC_PROG_FGREP])dnl case "x${with_man2html}" in (xno) cf_man2html=no ;; (x|xyes) AC_PATH_PROG(cf_man2html,man2html,no) case "x$cf_man2html" in (x/*) AC_MSG_CHECKING(for the modified Earl Hood script) if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) then cf_man2html_ok=yes else cf_man2html=no cf_man2html_ok=no fi AC_MSG_RESULT($cf_man2html_ok) ;; (*) cf_man2html=no ;; esac esac AC_MSG_CHECKING(for program to convert manpage to html) AC_ARG_WITH(man2html, [ --with-man2html=XXX use XXX rather than groff], [cf_man2html=$withval], [cf_man2html=$cf_man2html]) cf_with_groff=no case $cf_man2html in (yes) AC_MSG_RESULT(man2html) AC_PATH_PROG(cf_man2html,man2html,no) ;; (no|groff|*/groff*) cf_with_groff=yes cf_man2html=$GROFF_PATH AC_MSG_RESULT($cf_man2html) ;; (*) AC_MSG_RESULT($cf_man2html) ;; esac MAN2HTML_TEMP="man2html.tmp" cat >$MAN2HTML_TEMP <>$MAN2HTML_TEMP <conftest.in <conftest.out cf_man2html_1st="`${FGREP-fgrep} -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" cf_man2html_top=`expr "$cf_man2html_1st" - 2` cf_man2html_bot="`wc -l conftest.out |sed -e 's/[[^0-9]]//g'`" cf_man2html_bot=`expr "$cf_man2html_bot" - 2 - "$cf_man2html_top"` cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" AC_MSG_RESULT($cf_man2html_top_bot) AC_MSG_CHECKING(for pagesize to use) for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 do cat >>conftest.in <conftest.out cf_man2html_page="`${FGREP-fgrep} -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" test -z "$cf_man2html_page" && cf_man2html_page=99999 test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 rm -rf conftest* AC_MSG_RESULT($cf_man2html_page) cat >>$MAN2HTML_TEMP < and other headers which use u_int / u_short types cf_XOPEN_SOURCE= CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) ;; (netbsd*) cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw ;; (openbsd[[6-9]]*) # OpenBSD 6.x has broken locale support, both compile-time and runtime. # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html # Abusing the conformance level is a workaround. AC_MSG_WARN(this system does not provide usable locale support) cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=700 ;; (openbsd[[4-5]]*) # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=600 ;; (openbsd*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; (osf[[45]]*) cf_xopen_source="-D_OSF_SOURCE" ;; (nto-qnx*) cf_xopen_source="-D_QNX_SOURCE" ;; (sco*) # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; (solaris2.*) cf_xopen_source="-D__EXTENSIONS__" cf_cv_xopen_source=broken ;; (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) cf_XOPEN_SOURCE= cf_POSIX_C_SOURCE= ;; (*) CF_TRY_XOPEN_SOURCE CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) ;; esac if test -n "$cf_xopen_source" ; then CF_APPEND_CFLAGS($cf_xopen_source,true) fi dnl In anything but the default case, we may have system-specific setting dnl which is still not guaranteed to provide all of the entrypoints that dnl _XOPEN_SOURCE would yield. if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) AC_TRY_COMPILE([#include ],[ #ifndef _XOPEN_SOURCE make an error #endif], [cf_XOPEN_SOURCE_set=yes], [cf_XOPEN_SOURCE_set=no]) AC_MSG_RESULT($cf_XOPEN_SOURCE_set) if test "$cf_XOPEN_SOURCE_set" = yes then AC_TRY_COMPILE([#include ],[ #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE make an error #endif], [cf_XOPEN_SOURCE_set_ok=yes], [cf_XOPEN_SOURCE_set_ok=no]) if test "$cf_XOPEN_SOURCE_set_ok" = no then AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) fi else CF_TRY_XOPEN_SOURCE fi fi fi # cf_cv_posix_visible ]) dnl --------------------------------------------------------------------------- dnl CF_YACC_ERROR version: 8 updated: 2018/05/24 19:33:52 dnl ------------- dnl Test the supplied version of yacc to see which (if any) of the dnl error-reporting enhancements will work. dnl dnl Also, test the preprocessor to see if it will handle non-C files. dnl (gcc 2.5.8 doesn't). dnl AC_DEFUN([CF_YACC_ERROR], [ rm -f yacctest.y cat >yacctest.y < #include #include "yyerror.c" static void yaccError(const char *s) { (void)*s; return; } int yylex (void) { return 1; } %} %% dummy : /* empty */ | error '.' ; %% EOF AC_MSG_CHECKING(if $CPP can handle only .c files) $CPP yacctest.y >yacctest.out 2>/dev/null if test ! -s yacctest.out then AC_DEFINE(CPP_DOES_ONLY_C_FILES) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi $YACC yacctest.y rm -f yacctest.* td_incl='#include "y.tab.c"' for COND in BISON_HAS_YYTNAME YACC_HAS_YYTOKS YACC_HAS_YYTOKS_2 YACC_HAS_YYNAME do AC_MSG_CHECKING(for error-reporting with $COND) AC_CACHE_VAL(ac_cv_$COND, AC_TRY_LINK([ #define $COND 1 #define YYDEBUG 1 $td_incl],, eval 'ac_cv_'$COND'=yes', eval 'ac_cv_'$COND'=no')) eval 'td_result=$ac_cv_'$COND AC_MSG_RESULT($td_result) if test $td_result = yes; then AC_DEFINE_UNQUOTED($COND) break fi done rm -f y.tab.c ])dnl cproto-4.7t/install-sh0000755000175100001440000001572307762207755013632 0ustar tomusers#! /bin/sh # # install - install a program, script, or datafile # # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd=$cpprog shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "$0: no input file specified" >&2 exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d "$dst" ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" ] || [ -d "$src" ] then : else echo "$0: $src does not exist" >&2 exit 1 fi if [ x"$dst" = x ] then echo "$0: no destination specified" >&2 exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d "$dst" ] then dst=$dst/`basename "$src"` else : fi fi ## this sed command emulates the dirname command dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp='' while [ $# -ne 0 ] ; do pathcomp=$pathcomp$1 shift if [ ! -d "$pathcomp" ] ; then $mkdirprog "$pathcomp" else : fi pathcomp=$pathcomp/ done fi if [ x"$dir_arg" != x ] then $doit $instcmd "$dst" && if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename "$dst"` else dstfile=`basename "$dst" $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename "$dst"` else : fi # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/#inst.$$# rmtmp=$dstdir/#rm.$$# # Trap to clean up temp files at exit. trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && # Now remove or move aside any old file at destination location. We try this # two ways since rm can't unlink itself on some systems and the destination # file might be busy for other reasons. In this case, the final cleanup # might fail but the new file should still install successfully. { if [ -f "$dstdir/$dstfile" ] then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } cproto-4.7t/msdos/0000755000175100001440000000000010346114277012727 5ustar tomuserscproto-4.7t/msdos/borland.mak0000644000175100001440000000273610346114277015052 0ustar tomusers# $Id: borland.mak,v 4.2 2005/12/08 20:34:07 tom Exp $ # # Borland C++ makefile for C prototype generator # Define MSDOS for MS-DOS compatibility. # Define TURBO_CPP to pipe the input through the Turbo C preprocessor. DEFINES = -DMSDOS -DTURBO_CPP LEX = lex YACC = yacc CC = bcc CFLAGS = -mc $(DEFINES) -w-pin -w-pro LIBS = \bc\lib\wildargs.obj DIST1 = README CHANGES cproto.man DIST2 = cproto.1 borland.mak micrsoft.mak makefile.in lex.l grammar.y DIST3 = system.h cproto.h patchlev.h semantic.h symbol.h DIST4 = cproto.c popen.c lintlibs.c semantic.c strkey.c symbol.c OBJECTS = cproto.obj lintlibs.obj getopt.obj popen.obj semantic.obj strkey.obj symbol.obj y_tab.obj all: cproto.exe cproto.exe: $(OBJECTS) $(CC) $(CFLAGS) -e$*.exe $(OBJECTS) $(LIBS) y_tab.obj: y_tab.c lex_yy.c system.h cproto.h symbol.h semantic.h $(CC) $(CFLAGS) -c $*.c y_tab.c: grammar.y $(YACC) grammar.y lex_yy.c: lex.l $(LEX) lex.l cproto.man: cproto.1 cawf -man $*.1 | bsfilt - >$*.man clean: erase *.obj erase *.bak erase *.log erase lex_yy.c erase y_tab.c erase cproto.exe ci: ci -u3 $(DIST2) $(DIST3) ci -u3 $(DIST4) shar: shar $(DIST1) $(DIST2) >cproto.sh1 shar $(DIST3) $(DIST4) >cproto.sh2 # DO NOT DELETE THIS LINE -- make depend depends on it. cproto.obj: system.h cproto.h symbol.h lintlibs.obj: system.h cproto.h symbol.h semantic.h popen.obj: system.h cproto.h semantic.obj: system.h cproto.h symbol.h semantic.h strkey.obj: cproto.h system.h symbol.obj: system.h cproto.h symbol.h cproto-4.7t/msdos/turboc.mak0000644000175100001440000000503210346114277014717 0ustar tomusers# $Id: turboc.mak,v 4.3 2005/12/08 20:34:07 tom Exp $ # # Turbo C/C++ makefile for C prototype generator # (adapted from PRJ2MAK output) .AUTODEPEND # Define MSDOS for MS-DOS compatibility. # Define TURBO_CPP to pipe the input through the Turbo C preprocessor. DEFINES = MSDOS;TURBO_CPP # There's no standard for the names produced by lex clones on MSDOS: # FLEX produces LEXYY.C # MKS LEX produces LEX_YY.C (I think) #LEX = lex #LEX_OUT=lex_yy LEX = flex LEX_OUT=lexyy #YACC = yacc YACC = byacc #YACC = bison -o y_tab.c # *Translator Definitions* CC = tcc +cproto.cfg MODEL = l TLIB = tlib TLINK = tlink LIBPATH = C:\TC\LIB LIBS = $(LIBPATH)\wildargs.obj INCLUDEPATH = .;\tc\include DOC_FILES = \ README \ CHANGES \ cproto.man \ cproto.1 MAK_FILES = \ makefile.in configure.in \ turboc.mak \ borland.mak \ micrsoft.mak DIST2 = lex.l grammar.y DIST3 = system.h cproto.h patchlev.h semantic.h symbol.h DIST4 = cproto.c popen.c lintlibs.c semantic.c strkey.c symbol.c OBJECTS = \ cproto.obj \ lintlibs.obj \ getopt.obj \ popen.obj \ semantic.obj \ strkey.obj \ symbol.obj \ y_tab.obj all: cproto.exe y_tab.obj : cproto.cfg \ y_tab.c $(LEX_OUT).c system.h cproto.h symbol.h semantic.h $(CC) -w-rch -c {$*.c } y_tab.c : grammar.y $(YACC) grammar.y $(LEX_OUT).c: lex.l $(LEX) lex.l cproto.man: cproto.1 cawf -man $*.1 | bsfilt - >$*.man clean: erase *.$$$ erase cproto.cfg erase *.out erase *.obj erase *.bak erase *.log erase $(LEX_OUT).c erase y_tab.c erase cproto.exe # *Implicit Rules* .c.obj: $(CC) -c {$< } .cpp.obj: $(CC) -c {$< } # *Explicit Rules* cproto.exe: cproto.cfg $(OBJECTS) $(TLINK) /v/x/c/L$(LIBPATH) @&&| c0$(MODEL).obj+ cproto.obj + lintlibs.obj + getopt.obj + popen.obj + semantic.obj + strkey.obj + symbol.obj + y_tab.obj + $(LIBS) cproto # no map file emu.lib+ math$(MODEL).lib+ c$(MODEL).lib | # *Compiler Configuration File* cproto.cfg: turboc.mak copy &&| -m$(MODEL) -v -vi- -w-ret -w-nci -w-inl -wpin -wamb -wamp -w-par -wasm -wcln -w-cpt -wdef -w-dup -w-pia -wsig -wnod -w-ill -w-sus -wstv -wucp -wuse -w-ext -w-ias -w-ibc -w-pre -w-nst -I$(INCLUDEPATH) -L$(LIBPATH) -D$(DEFINES);STDC_HEADERS=1;USE_$(LEX);YY_USE_PROTOS | cproto.cfg # DO NOT DELETE THIS LINE -- make depend depends on it. cproto.obj : cproto.cfg system.h cproto.h symbol.h lintlibs.obj : cproto.cfg system.h cproto.h symbol.h semantic.h popen.obj : cproto.cfg system.h cproto.h semantic.obj : cproto.cfg system.h cproto.h symbol.h semantic.h strkey.obj : cproto.cfg cproto.h system.h symbol.obj : cproto.cfg system.h cproto.h symbol.h cproto-4.7t/msdos/micrsoft.lnk0000644000175100001440000000024206461035674015267 0ustar tomusersCPROTO.OBJ + LINTLIBS.OBJ + GETOPT.OBJ + SEMANTIC.OBJ + STRKEY.OBJ + SYMBOL.OBJ + YTAB.OBJ + POPEN.OBJ cproto.exe cproto.map d:\msc60ax\lib\llibce.lib ; cproto-4.7t/msdos/micrsoft.mak0000644000175100001440000000345710346114277015260 0ustar tomusers# $Id: micrsoft.mak,v 4.2 2005/12/08 20:34:07 tom Exp $ # # Microsoft C makefile for C prototype generator # tested with: # nmake 1.11. # cl 6.00ax. # Define MSDOS for MS-DOS compatibility. # Define TURBO_CPP to pipe the input through the Turbo C preprocessor. DEFINES = -DMSDOS -DSTDC_HEADERS MSC_TOP = d:\msc60ax # names from MKS tools (ran out of memory in lex; used unix output) Y_TAB = ytab LEX_YY = lex_yy LEX = lex YACC = yacc CC = cl LINK = link CFLAGS = -EM -AL $(DEFINES) LIBS = $(MSC_TOP)\lib\setargv.obj LDFLAGS = /F 1000 DIST1 = README CHANGES cproto.man DIST2 = cproto.1 borland.mak micrsoft.mak makefile.in lex.l grammar.y DIST3 = system.h cproto.h patchlev.h semantic.h symbol.h DIST4 = cproto.c lintlibs.c popen.c semantic.c strkey.c symbol.c OBJECTS = cproto.obj lintlibs.obj getopt.obj semantic.obj strkey.obj symbol.obj $(Y_TAB).obj popen.obj all: cproto.exe cproto.exe: $(OBJECTS) micrsoft.lnk $(LINK) @micrsoft.lnk micrsoft.lnk: for %%i in ( *.obj ) do echo %%i + >>$@ echo >>$@ echo cproto.exe >>$@ echo >>$@ echo $(LIBS); >>$@ $(Y_TAB).obj: $(Y_TAB).c $(LEX_YY).c system.h cproto.h symbol.h semantic.h $(CC) $(CFLAGS) -c $*.c $(Y_TAB).c: grammar.y $(YACC) grammar.y $(LEX_YY).c: lex.l $(LEX) lex.l cproto.man: cproto.1 cawf -man $*.1 | bsfilt - >$*.man clean: erase *.obj erase *.bak erase *.log erase $(LEX_YY).c erase $(Y_TAB).c erase micrsoft.lnk erase cproto.exe ci: ci -u3 $(DIST2) $(DIST3) ci -u3 $(DIST4) shar: shar $(DIST1) $(DIST2) >cproto.sh1 shar $(DIST3) $(DIST4) >cproto.sh2 # DO NOT DELETE THIS LINE -- make depend depends on it. cproto.obj: system.h cproto.h lintlibs.obj: system.h cproto.h symbol.h semantic.h popen.obj: system.h cproto.h semantic.obj: system.h cproto.h symbol.h semantic.h strkey.obj: cproto.h system.h symbol.obj: system.h cproto.h symbol.h cproto-4.7t/msdos/README0000644000175100001440000000030106461035674013607 0ustar tomusersThe files in this directory are used to build on MS-DOS. turboc.mak makefile for Turbo C/C++ 3.0 for MS-DOS borland.mak makefile for Borland C for MS-DOS micrsoft.mak makefile for Microsoft C cproto-4.7t/README0000644000175100001440000000131407643576142012472 0ustar tomusersCproto is a program that generates function prototypes and variable declarations from C source code. It can also convert function definitions between the old style and the ANSI C style. This conversion overwrites the original files, so make a backup copy of your files in case something goes wrong. The program isn't confused by complex function definitions as much as other prototype generators because it uses a yacc generated parser. By ignoring all the input between braces, I avoided implementing the entire C language grammar. Cproto is in the public domain, except for the configure script which is copyrighted by the Free Software Foundation, Inc. Chin Huang Thomas Dickey dickey@invisible-island.net cproto-4.7t/trace.c0000644000175100001440000001512411510150754013041 0ustar tomusers/* $Id: trace.c,v 4.6 2011/01/02 19:28:44 tom Exp $ * * Simple malloc debugging (for finding leaks) * * This is a cut-down version of a module I wrote originally for 'vile', it * requires an ANSI compiler. Its main purpose is to allow tracing problems in * a repeatable test, including malloc/free bugs -- T.Dickey */ #include /* interface of this module */ #if DOALLOC #undef malloc #undef realloc #undef free #endif /* DOALLOC */ #include #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include #define BEFORE 0 /* padding "before" allocated area */ #define AFTER 0 /* padding "after" allocated area */ #define BEFORE_PTR(ptr) (void *)((char *)(ptr) - BEFORE) void Where(char *file, int line) { fflush(stderr); printf("%s @%d\n", file, line); fflush(stdout); Trace("%s @%d\n", file, line); } void Trace(char *format,...) { static FILE *fp; va_list ap; if (!fp) fp = fopen("Trace.out", "w"); if (!fp) abort(); if (format != 0) { va_start(ap, format); vfprintf(fp, format, ap); va_end(ap); (void) fflush(fp); } else { (void) fclose(fp); (void) fflush(stdout); (void) fflush(stderr); } } #define SECS(tv) (tv.tv_sec + (tv.tv_usec / 1.0e6)) void Elapsed(char *msg) { #if HAVE_GETTIMEOFDAY static struct timeval tv0, tv1; static struct timezone tz0, tz1; static int init; if (!init++) gettimeofday(&tv0, &tz0); gettimeofday(&tv1, &tz1); Trace("%10.6f %s\n", SECS(tv1) - SECS(tv0), msg); tv0 = tv1; #endif } #ifdef apollo static int contains(char *ref, char *tst) { size_t len = strlen(ref); while (*tst) { if (!strncmp(ref, tst++, len)) return TRUE; } return FALSE; } #endif /* apollo */ void WalkBack(void) { #ifdef apollo static char *first = "\"WalkBack\"", *last = "\"unix_$main\""; auto FILE *pp; auto char bfr[BUFSIZ]; auto int ok = FALSE; static int count; Trace("%s %d\n", first, ++count); sprintf(bfr, "/com/tb %d", getpid()); if (!(pp = popen(bfr, "r"))) perror(bfr); while (fgets(bfr, sizeof(bfr), pp)) { if (ok && contains(last, bfr)) break; else if (contains(first, bfr)) ok = TRUE; else if (ok) Trace("%s", bfr); } (void) fclose(pp); #endif /* apollo */ } static long count_alloc, count_freed; void fail_alloc(char *msg, char *ptr) { Trace("%s: %p\n", msg, ptr); Trace("allocs %ld, frees %ld\n", count_alloc, count_freed); WalkBack(); #ifdef NO_LEAKS show_alloc(); #endif Trace((char *) 0); abort(); } #if DOALLOC #undef malloc #undef realloc #undef free typedef struct { long size; /* ...its size */ char *text; /* the actual segment */ int note; /* ...last value of 'count_alloc' */ } AREA; static AREA area[DOALLOC]; static long maxAllocated, /* maximum # of bytes allocated */ nowAllocated, /* current # of bytes allocated */ nowPending, /* current end of 'area[]' table */ maxPending; /* maximum # of segments allocated */ static int FindArea(char *ptr) { register int j; for (j = 0; j < DOALLOC; j++) if (area[j].text == ptr) { if (j >= nowPending) { nowPending = j + 1; if (nowPending > maxPending) maxPending = nowPending; } return j; } return -1; } static int record_freed(char *ptr) { register int j; if ((j = FindArea(ptr)) >= 0) { nowAllocated -= area[j].size; /*memset(ptr, 0xdf, area[j].size); -* poison */ area[j].size = 0; area[j].text = 0; area[j].note = count_freed; if ((j + 1) == nowPending) { register int k; for (k = j; (k >= 0) && !area[k].size; k--) nowPending = k; } } return j; } static int record_alloc(char *newp, char *oldp, unsigned len) { register int j; if (newp == oldp) { if ((j = FindArea(oldp)) >= 0) { nowAllocated -= area[j].size; area[j].size = len; area[j].note = count_alloc; } else fail_alloc("could not find", oldp); } else { if (oldp != 0) record_freed(oldp); if ((j = FindArea((char *) 0)) >= 0) { area[j].text = newp; area[j].size = len; area[j].note = count_alloc; } else fail_alloc("no room in table", newp); } nowAllocated += len; if (nowAllocated > maxAllocated) maxAllocated = nowAllocated; return len; } #define OK_ALLOC(p,q,n) ((p != 0) && (record_alloc(p,q,n) >= 0)) #define OK_FREE(p) ((p != 0) && (record_freed(p) >= 0)) #else #define OK_ALLOC(p,q,n) (p != 0) #define OK_FREE(p) (p != 0) #endif /* DOALLOC */ #ifdef DEBUG2 #define LOG_PTR(msg,num) Trace("%s %p\n", msg, num) #define LOG_LEN(msg,num) Trace("%s %d\n", msg, num) #else #define LOG_PTR(msg,num) #define LOG_LEN(msg,num) #endif /************************************************************************ * public entrypoints * ************************************************************************/ #if DOALLOC void * doalloc(void *oldp, unsigned amount) { char *newp; if (oldp != 0) oldp = BEFORE_PTR(oldp); count_alloc += (oldp == 0); #if 0 if ((count_alloc > 99914 && count_alloc < 99920)) { Trace("doalloc #%d\n", count_alloc); WalkBack(); } #endif LOG_LEN("allocate", amount); LOG_PTR(" old = ", oldp); amount += (BEFORE + AFTER); /* patch */ newp = (oldp != 0) ? realloc(oldp, amount) : malloc(amount); if (!OK_ALLOC(newp, oldp, amount)) { perror("doalloc"); fail_alloc("doalloc", oldp); /*NOT REACHED */ } LOG_PTR(" new = ", newp); return (void *) (newp + BEFORE); } /* * Entrypoint so we can validate pointers */ void dofree(void *oldp) { oldp = BEFORE_PTR(oldp); count_freed++; LOG_PTR("dealloc ", oldp); if (OK_FREE(oldp)) { free(oldp); return; } fail_alloc("free (not found)", oldp); } #endif void show_alloc(void) { #if DOALLOC static char *format = ".. %-24.24s %10ld\n"; Trace("** allocator metrics:\n"); Trace(format, "allocs:", count_alloc); Trace(format, "frees:", count_freed); { register int j, count = 0; register long total = 0; for (j = 0; j < nowPending; j++) { if (area[j].text) { if (count++ < 10) Trace("...%d) %ld bytes in alloc #%d:%p\n", j, area[j].size, area[j].note, area[j].text); total += area[j].size; } } Trace(format, "total bytes allocated:", total); Trace(format, "current bytes allocated:", nowAllocated); Trace(format, "maximum bytes allocated:", maxAllocated); Trace(format, "segment-table length:", nowPending); Trace(format, "current # of segments:", (long) count); Trace(format, "maximum # of segments:", maxPending); } #endif } cproto-4.7t/strkey.c0000644000175100001440000000264313704047553013277 0ustar tomusers/* $Id: strkey.c,v 4.11 2020/07/16 13:00:27 tom Exp $ * * Some string handling routines */ #include #include #define LETTER(c) (isalnum(UCH(c)) || (c == '_') || (c == '$')) /* * Return a pointer to the first occurrence of the given keyword in the string * or NULL if not found. Unlike 'strstr()', which verifies that the match is * against an identifier-token. */ char * strkey(char *src, const char *key) { if (src != 0 && key != 0) { char *s = src, *d; size_t len = strlen(key); while (*s) { if (!LETTER(*s)) { s++; } else { for (d = s; LETTER(*d); d++) ; if ((d - s) == (int) len && !strncmp(s, key, len)) return s; s = d; } } } return NULL; } /* * Delete a specified keyword from a string if it appears there */ void strcut(char *src, const char *key) { char *s, *d; if ((s = strkey(src, key)) != 0) { d = s + strlen(key); while (*d != '\0' && !LETTER(*d)) d++; while ((*s++ = *d++) != '\0') ; } } /* Search for a substring within the given string. * Return a pointer to the first occurrence within the string, * or NULL if not found. */ #if !HAVE_STRSTR char * strstr(char *src, char *key) { char *s; int keylen; if ((keylen = strlen(key)) == 0) return src; s = strchr(src, *key); while (s != NULL) { if (strncmp(s, key, keylen) == 0) return s; s = strchr(s + 1, *key); } return NULL; } #endif