📄 acgroff.m4
字号:
dnl Autoconf macros for groff.dnl Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.dnl dnl This file is part of groff.dnl dnl groff is free software; you can redistribute it and/or modify it underdnl the terms of the GNU General Public License as published by the Freednl Software Foundation; either version 2, or (at your option) any laterdnl version.dnl dnl groff is distributed in the hope that it will be useful, but WITHOUT ANYdnl WARRANTY; without even the implied warranty of MERCHANTABILITY ordnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licensednl for more details.dnl dnl You should have received a copy of the GNU General Public License alongdnl with groff; see the file COPYING. If not, write to the Free Softwarednl Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.dnldefine(GROFF_EXIT,[rm -f conftest* core; exit 1])dnldefine(GROFF_PREFIX,[AC_PROVIDE([$0])AC_PREFIX(grops)AC_PREFIX(gcc)])dnldefine(GROFF_PROG_CCC,[AC_PROVIDE([$0])AC_REQUIRE([AC_PROG_CC])dnlcc_compile='$CCC conftest.cc -o conftest $CCLIBS $LIBS >/dev/null 2>&1'AC_SUBST(CCLIBS)if test -z "$CCC"; then# See whether the C compiler is also a C++ compiler.echo checking if C compiler is also a C++ compilercat <<EOF > conftest.cc#ifdef __cplusplus yes#endifEOF$CC -E conftest.cc >conftest.out 2>&1if egrep yes conftest.out >/dev/null 2>&1; then CCC="$CC"fifiAC_PROGRAM_CHECK(CCC,g++,g++,)AC_PROGRAM_CHECK(CCC,CC,CC,)AC_PROGRAM_CHECK(CCC,cc++,cc++,)if test -z "$CCC"; thencat <<EOMThis package requires a C++ compiler, but I couldn't find one.Set the environment variable CCC to the name of your C++ compiler.EOMGROFF_EXITfiecho checking that C++ compiler can compile very simple C++ programGROFF_CC_TEST_PROGRAM([extern "C" { void exit(int); }int main() { exit(0); }],,cat <<EOM$CCC was unable successfully to compile a very simple C++ program(the C++ program was in a file with a suffix of .cc)EOMGROFF_EXIT,)echo checking that C++ static constructors and destructors are calledGROFF_CC_TEST_PROGRAM([extern "C" { void exit(int); void _exit(int);}int i;struct A { char dummy; A() { i = 1; } ~A() { if (i == 1) _exit(0); }};A a;main() { exit(1); }],,cat <<EOM$CCC is not installed correctly: static constructors and destructors do not workEOMGROFF_EXIT,)GROFF_CC_COMPILE_CHECK([C++ header files],[#include <stdio.h>],[fopen(0, 0);],,[cat <<\EOFYour header files do not appear to support C++.I was unable to compile and link a simple C++ program that used a functiondeclared in <stdio.h>.If you're using gcc/g++, you should install libg++.EOFGROFF_EXIT])])dnldefine(GROFF_CC_COMPILE_CHECK,[AC_PROVIDE([$0])AC_REQUIRE([GROFF_PROG_CCC])echo checking for $1cat <<EOF >conftest.cc[$2]extern "C" { void exit(int); }int main() { exit(0); } void t() { [$3] }EOFdnl Don't try to run the program, which would prevent cross-configuring.if eval $cc_compile; then ifelse([$4], , :, [$4])ifelse([$5], , , [else $5])dnlfirm -f conftest*])dnldnldefine(GROFF_CC_TEST_PROGRAM,[AC_PROVIDE([$0])AC_REQUIRE([GROFF_PROG_CCC])ifelse([$4], , ,[AC_REQUIRE([AC_CROSS_CHECK])if $cross_compilingthen $4else])dnlcat <<EOF > conftest.cc[$1]EOFrm -f conftesteval $cc_compileif test -s conftest && (./conftest) 2>/dev/null; then ifelse([$2], , :, [$2])ifelse([$3], , , [else $3])dnlfiifelse([$4], , , fi)dnlrm -f conftest*])dnldnldefine(GROFF_PAGE,[AC_REQUIRE([GROFF_PREFIX])if test -z "$PAGE" && test -r $prefix/lib/groff/font/devps/DESCthen if grep "^paperlength 841890" \ $prefix/lib/groff/font/devps/DESC >/dev/null 2>&1 then PAGE=A4 else PAGE=letter fifiif test -z "$PAGE"then dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \ /etc/resolv.conf 2>/dev/null` if test -z "$dom" then dom=`(domainname) 2>/dev/null | tr -d '+'` if test -z "$dom" then dom=`(hostname) 2>/dev/null | grep '\.'` fi fichangequote(,)dnl # If the top-level domain is two letters and it's not `us' or `ca' # then they probably use A4 paper. case "$dom" in *.[Uu][Ss]|*.[Cc][Aa]) ;; *.[A-Za-z][A-Za-z]) PAGE=A4 ;; esacchangequote([,])dnlfitest -n "$PAGE" || PAGE=letterecho guessing $PAGE size paperAC_SUBST(PAGE)])dnldnldefine(GROFF_PERL_PATH,[echo checking for perlPERLPATH=saveifs="$IFS"; IFS="${IFS}:"for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/perl; then PERLPATH="$dir/perl" break fidoneIFS="$saveifs"AC_SUBST(PERLPATH)])dnldnldefine(GROFF_WCOREFLAG,[echo checking for w_coredumpAC_TEST_PROGRAM([#include <sys/types.h>#include <sys/wait.h>main(){#ifdef WCOREFLAG exit(1);#else int i = 0; ((union wait *)&i)->w_coredump = 1; exit(i != 0200);#endif}],AC_DEFINE(WCOREFLAG,0200),,)])dnldnldefine(GROFF_MMAP,[AC_COMPILE_CHECK([mmap],[#include <sys/types.h>#include <sys/mman.h>],[char *p = mmap(0, 0, PROT_READ, MAP_PRIVATE, 0, 0); munmap(p, 0);],AC_DEFINE(HAVE_MMAP))])dnldnl;define(GROFF_SYS_SIGLIST,[AC_COMPILE_CHECK([sys_siglist],,changequote(,)dnlextern char *sys_siglist[]; sys_siglist[0] = 0;,changequote([,])dnlAC_DEFINE(HAVE_SYS_SIGLIST))])dnldnldefine(GROFF_STRUCT_EXCEPTION,[AC_COMPILE_CHECK([struct exception],[#include <math.h>],[struct exception e;],AC_DEFINE(HAVE_STRUCT_EXCEPTION))])dnldefine(GROFF_COOKIE_BUG,[echo checking for gcc/g++ delete bugGROFF_CC_TEST_PROGRAM([#include <stdlib.h>#include <stddef.h>int testit = 0;int main(){ testit = 1; int *p = new int; delete p; testit = 0; exit(1);}static unsigned dummy[3];void *operator new(size_t n){ if (testit) { dummy[1] = -(unsigned)(dummy + 2); return dummy + 2; } else return (void *)malloc(n);}void operator delete(void *p){ if (testit) { if (p == dummy) exit(0); } else free(p);}],AC_DEFINE(COOKIE_BUG),,)])dnldnldefine(GROFF_CFRONT_ANSI_BUG,[AC_REQUIRE([GROFF_LIMITS_H])echo checking for cfront ANSI C INT_MIN bugGROFF_CC_TEST_PROGRAM([#include <stdlib.h>#ifdef HAVE_CC_LIMITS_H#include <limits.h>#else#define INT_MAX 2147483647#endif#undef INT_MIN#define INT_MIN (-INT_MAX-1)int main(){ int z = 0; exit(INT_MIN < z);}],AC_DEFINE(CFRONT_ANSI_BUG),,)])dnldnldefine(GROFF_ARRAY_DELETE,[GROFF_CC_COMPILE_CHECK(new array delete syntax,,changequote(,)dnlchar *p = new char[5]; delete [] p;changequote([,]),,AC_DEFINE(ARRAY_DELETE_NEEDS_SIZE))])dnldnldefine(GROFF_BROKEN_SPOOLER_FLAGS,[test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7echo using default value of ${BROKEN_SPOOLER_FLAGS} for grops -b optionAC_SUBST(BROKEN_SPOOLER_FLAGS)])dnldnldefine(GROFF_PRINT,[if test -z "$PSPRINT"then AC_PROGRAMS_CHECK(LPR,lpr) AC_PROGRAMS_CHECK(LP,lp) if test -n "$LPR" && test -n "$LP" then # HP-UX provides an lpr command that emulates lpr using lp, # but it doesn't have lpq; in this case we want to use lp # rather than lpr. AC_PROGRAMS_CHECK(LPQ,lpq) test -n "$LPQ" || LPR= fi if test -n "$LPR" then PSPRINT="$LPR" elif test -n "$LP" then PSPRINT="$LP" fifiAC_SUBST(PSPRINT)# Figure out DVIPRINT from PSPRINT.if test -n "$PSPRINT" && test -z "$DVIPRINT"then if test "X$PSPRINT" = "Xlpr" then DVIPRINT="lpr -d" else DVIPRINT="$PSPRINT" fifiAC_SUBST(DVIPRINT)])dnldefine(GROFF_GETOPT,[GROFF_CC_COMPILE_CHECK([declaration of getopt in stdlib.h],[#include <stdlib.h>],[int opt = getopt(0, 0, 0); optarg = "foo"; optind = 1;],AC_DEFINE(STDLIB_H_DECLARES_GETOPT))GROFF_CC_COMPILE_CHECK([declaration of getopt in unistd.h],[#include <sys/types.h>#include <unistd.h>],[int opt = getopt(0, 0, 0);],AC_DEFINE(UNISTD_H_DECLARES_GETOPT))])dnldefine(GROFF_PUTENV,[GROFF_CC_COMPILE_CHECK([declaration of putenv],[#include <stdlib.h>],[putenv((char *)0);],AC_DEFINE(STDLIB_H_DECLARES_PUTENV))])dnldefine(GROFF_ETAGSCCFLAG,[echo checking for etags C++ optionfor flag in p Cdo test -z "$ETAGSCCFLAG" || break >conftest.c (etags -$flag -o /dev/null conftest.c >/dev/null 2>&1) 2>/dev/null && ETAGSCCFLAG="-$flag" rm -f conftest.cdoneAC_SUBST(ETAGSCCFLAG)])dnldefine(GROFF_LIMITS_H,[AC_PROVIDE([$0])GROFF_CC_COMPILE_CHECK(['C++ <limits.h>'],[#include <limits.h>],[int x = INT_MIN; int y = INT_MAX; int z = UCHAR_MAX;],AC_DEFINE(HAVE_CC_LIMITS_H))])dnldefine(GROFF_TRADITIONAL_CPP,[GROFF_CC_COMPILE_CHECK([traditional preprocessor],[#define name2(a,b) a/**/b],[int name2(foo,bar);],AC_DEFINE(TRADITIONAL_CPP))])dnldefine(GROFF_TIME_T,[GROFF_CC_COMPILE_CHECK([time_t],[#include <time.h>],[time_t t = time(0); struct tm *p = localtime(&t);],,AC_DEFINE(LONG_FOR_TIME_T))])dnldefine(GROFF_UNISTD_H,[GROFF_CC_COMPILE_CHECK(['C++ <unistd.h>'],[#include <unistd.h>],dnl Bison generated parsers have problems with C++ compilers other than g++.dnl So byacc is preferred over bison.[read(0, 0, 0);],AC_DEFINE(HAVE_CC_UNISTD_H))])dnldefine(GROFF_PROG_YACC,[AC_PROGRAM_CHECK(YACC, byacc, byacc, )AC_PROGRAM_CHECK(YACC, bison, bison -y, yacc)])dnldnl GROFF_CSH_HACK(if hack present, if not present)define(GROFF_CSH_HACK,[echo 'checking for csh # hack'cat <<EOF >conftest.sh#!/bin/shtrue || exit 0export PATH || exit 0exit 1EOFchmod +x conftest.shif echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1then :; $1else :; $2firm -f conftest.sh])dnl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -