📄 configure.in
字号:
PAC_CHECK_HEADERS(termio.h termios.h)PAC_CHECK_HEADERS(sys/types.h sys/wait.h)## In some cases, we need both string.h and strings.h . Some systems# apparently complain, so we try to include them bothAC_MSG_CHECKING(that string.h and strings.h can be included)AC_TEST_PROGRAM([#include <strings.h>#include <string.h>main() {return 0;}],AC_MSG_RESULT(yes)AC_DEFINE(BOTH_STRING_INCS),AC_MSG_RESULT(no))#if test "$has_rpc_rpc" = 1 ; then # does it really? # (gcc on Solaris 5.6 sometimes fails, particularly when OS was upgraded # from 5.5 to 5.6 but gcc was not reinstalled). AC_COMPILE_CHECK([correct headers with rpc/rpc.h],[#include <sys/types.h>#include <rpc/rpc.h>],return 0;,,cc_broken=1) if test "$cc_broken" = 1; then echo "Your C compiler $CC fails to compile the program" echo "#include <sys/types.h>" echo "#include <rpc/rpc.h>" echo "If you are using gcc, make sure that the system include" echo "files and the gcc include files are consistent. If " echo "you have upgraded the OS, you may need to reinstall gcc" exit 1 fifiif test "$has_netinet_in" = 1 ; then # does it really? # (gcc on Solaris 5.6 sometimes fails, particularly when OS was upgraded # from 5.5 to 5.6 but gcc was not reinstalled). AC_COMPILE_CHECK([correct headers with netinet/in.h],[#include <sys/types.h>#include <netinet/in.h>],return 0;,,cc_broken=1) if test "$cc_broken" = 1; then echo "Your C compiler $CC fails to compile the program" echo "#include <sys/types.h>" echo "#include <netinet/in.h>" echo "If you are using gcc, make sure that the system include" echo "files and the gcc include files are consistent. If " echo "you have upgraded the OS, you may need to reinstall gcc" exit 1 fifi## It isn't enough to check for stdarg. Even gcc doesn't get it right;# on some systems, the gcc version of stdio.h loads stdarg.h WITH THE WRONG# OPTIONS (causing it to choose the OLD STYLE va_start etc).#PAC_STDARG(AC_DEFINE(USE_STDARG),AC_DEFINE(USE_OLDSTYLE_STDARG))## We need to check that these functions are also available to # the other compilers (C++ and Fortran). For Solaris /usr/ucb/cc, these# are found but not for the stock C++ and Fortran compilers.## Another grungy problem. Even though some systems support sighold, # the library might have various problems. Sigaction should be used instead# if it is present.AC_HAVE_FUNCS(sigprocmask sigemptyset sigaddset)AC_HAVE_FUNCS(sighold)AC_HAVE_FUNCS(sigsetmask)AC_HAVE_FUNCS(sigblock)# Look for sigaction routine (instead of signal)AC_HAVE_FUNCS(sigaction)AC_COMPILE_CHECK(for struct sigaction,[#include <signal.h>],[struct sigaction act; sigaddset( &act.sa_mask, SIGINT );return 0;],sigaction_ok="yes",sigaction_ok="no")# XOPEN mandates that union semun NOT be defined(!)# The return 0 works around a but in ac compile check (the test is in a# function with no return value)AC_COMPILE_CHECK(for union semun,[#include <sys/types.h>#include <sys/ipc.h>#include <sys/sem.h>],[union semun arg;arg.val=0;return 0;],,AC_DEFINE(SEMUN_UNDEFINED))# strerror is prefered over extern char *sys_errlist[];## See if we can use an int in semctl or if we need the unionAC_COMPILE_CHECK([whether semctl needs union semun],[#include <sys/types.h>#include <sys/ipc.h>#include <sys/sem.h>],[int arg = 0; semctl( 1, 1, SETVAL, arg );return 0;],AC_DEFINE(SEMCTL_ARG_UNION))#AC_HAVE_FUNCS(strerror)## Check to see if we need to define sys_errlist. We do this by defining it# badly, and then checking for an error.AC_COMPILE_CHECK([whether sys_errlist needs do be defined],[#include <string.h>],[extern short sys_errlist;],,AC_DEFINE(NEEDS_SYS_ERRLIST))#AC_HAVE_LIBRARY(crypt,CRYPT_LIBS=-lcrypt)# Look for vprintfAC_HAVE_FUNCS(vprintf)PAC_CHECK_HEADERS(sys/uio.h)AC_HAVE_FUNCS(writev)## Yield handlinguse_select_yield=nohave_sched_yield=nouse_yield=no# Test for sched_yield here since we need the answer in two places# Solaris hides sched_yield in the rt libraryPAC_CHECK_HEADERS(sched.h)AC_CHECK_FUNC(sched_yield,have_sched_yield=yes)if test "$have_sched_yield" = "no" ; then # try with -lrt (Solaris) save_LIBS="$LIBS" LIBS="$LIBS -lrt" AC_CHECK_FUNC(sched_yield,have_sched_yield=yes) if test "$have_sched_yield" = "no" ; then LIBS="$save_LIBS" fificase $enable_yield in no) # Do nothing ;; yes|sched_yield) if test "$have_sched_yield" = "yes" ; then AC_DEFINE(USE_SCHED_YIELD,,[define to use POSIX sched_yield]) use_yield=yes else # Hook to allow us to make this the alternate default use_select_yield=no fi ;; sginap) AC_CHECK_FUNC(sginap, AC_DEFINE(USE_SGINAP_YIELD,,[define to use sginap to yield])) ;; yield) # AIX 4.2 has yield AC_CHECK_FUNC(yield, AC_DEFINE(USE_YIELD_YIELD,,[define to use yield to yield])) ;; select) # Assume that we can always use select use_select_yield=yes use_yield=yes ;; dynamic) if test "$have_sched_yield" = "yes" ; then AC_DEFINE(USE_DYNAMIC_YIELD,,[define to dynamically select yield]) use_yield=yes fi ;; *) AC_MSG_WARN([Unrecognized yield method $enable_yield]) ;;esacif test "$use_select_yield" = "yes" ; then AC_DEFINE(USE_SELECT_YIELD,,[define to use select to yield])fiif test "$use_yield" = "yes" ; then AC_DEFINE(USE_YIELD,,[define to yield in the communication calls])fidnl #dnl # Check that nonblocking read works:dnl # Early SYSV (R2) had a design problem with nonblocking sockets:dnl # there was no way to distinquish between EOF and no data on socket.dnl # This code tests for this case; if an EOF on the socket gives thednl # correct value (-1), we note this. If it fails, there is code indnl # p4 to work around this design bug, but it can introduce performancednl # penalties. dnl if test -s $top_srcdir/readblock.c -a $use_nonblock_read = 1 ; thendnl AC_MSG_CHECKING([that read O_NDELAY works])dnl readworks=0dnl AC_TEST_PROGRAM([`cat $top_srcdir/readblock.c`],readworks=1)dnl if test $readworks = 1 ; thendnl AC_MSG_RESULT(yes)dnl AC_DEFINE(NONBLOCKING_READ_WORKS)dnl elsednl AC_MSG_RESULT(no)dnl fidnl fi## Test for sgttyb and the ability to set noecho on terminalsPAC_COMPILE_CHECK_FUNC(echo off supported with sgttyb,[#include <stdio.h>#ifdef FREEBSD#include <sys/ioctl_compat.h>#else#include <sys/ioctl.h>#endifstatic struct sgttyb orig_tty;int main() { struct sgttyb tty_new; ioctl(0, TIOCGETP, &orig_tty); tty_new = orig_tty; tty_new.sg_flags &= ~(ECHO); ioctl(0, TIOCSETP, &tty_new); return 0;}],,AC_DEFINE(NO_ECHO))if test -n "$RSHCOMMAND" ; then AC_DEFINE(HAS_RSHCOMMAND) # Check for arguments (actually the blanks separating them) in the command tst=`echo "$RSHCOMMAND" | sed -e 's/ /-/g'` if test "$tst" != "$RSHCOMMAND" ; then AC_DEFINE(RSH_NEEDS_OPTS) fifiif test -n "$RSHNOL" ; then AC_DEFINE(RSH_HAS_NO_L)fi### The following are necessary for AIX in particular because in 64 bit mode,# some of the socket functions use size_t (unsigned long, 64 bits) instead of# int (signed int, 32 bits) as a return value. Getting the wrong type# causes all sorts of chaos. Unfortunately, there isn't any consensus on what# the arguments *should* be.found_sockopt_type=0AC_COMPILE_CHECK([if getsockopt wants socklen_t],[#include <sys/types.h>#include <sys/socket.h>],[socklen_t dummy; int rc, skt=0; void *ssz=0;rc = getsockopt(skt,SOL_SOCKET,SO_SNDBUF,ssz,&dummy);return 0;],found_sockopt_type=1)if test $found_sockopt_type = 1 ; then MDEP_CFLAGS="$MDEP_CFLAGS -DUSE_SOCKLEN_T"fiif test $found_sockopt_type = 0 ; then # This case is harder. size_t is a valid type, but it may not be the # one that getsockopt etc wants. AC_MSG_CHECKING([if getsockopt wants size_t]) PAC_TRY_COMPILE_CLEAN([#include <sys/types.h>#include <sys/socket.h>],[int try(void){size_t dummy; int rc, skt=0; void *ssz=0;rc = getsockopt(skt,SOL_SOCKET,SO_SNDBUF,ssz,&dummy);return rc;}],found_sockopt_type) case $found_sockopt_type in 0) AC_MSG_RESULT(yes) MDEP_CFLAGS="$MDEP_CFLAGS -DUSE_SIZE_T_FOR_SOCKLEN_T" ;; 1) AC_MSG_RESULT([no (warnings from compiler)]) ;; 2) AC_MSG_RESULT(no) ;; esacfiif test "$enable_lazy_gethostbyname" = "yes" ; then AC_DEFINE(LAZY_GETHOSTBYNAME)fiif test "$enable_nonblocking_listener" = "yes" ; then AC_DEFINE(USE_NONBLOCKING_LISTENER_SOCKETS)fi## Check whether u_int should be used for xdr_array use_u_int=0AC_MSG_CHECKING([if xdr_array wants u_int])# Initialize the variables to suppress warnings about usage.PAC_TRY_COMPILE_CLEAN([#include <rpc/xdr.h>],[int try(void){u_int l=0, ms=0, el=0; xdrproc_t elproc=(xdrproc_t)xdr_int; XDR *xdrs=0; int rc; char **arrp=0;rc = xdr_array(xdrs,arrp,&l,ms,el,elproc);return rc;}],use_u_int)case $use_u_int in 0) AC_MSG_RESULT(yes) MDEP_CFLAGS="$MDEP_CFLAGS -DUSE_U_INT_FOR_XDR" ;; 1) AC_MSG_RESULT([no (compiler warnings)]) ;; 2) AC_MSG_RESULT(no) ;;esacif test "$use_u_int" != "0" ; then # Check whether unsigned int should be used for xdr_array use_unsigned_int=0 AC_MSG_CHECKING([if xdr_array wants unsigned int]) PAC_TRY_COMPILE_CLEAN([#include <rpc/xdr.h>],[int try(void){unsigned int l=0, ms=0, el=0; xdrproc_t elproc=(xdrproc_t)xdr_int; XDR *xdrs=0; int rc; char **arrp=0;rc = xdr_array(xdrs,arrp,&l,ms,el,elproc);return rc;}],use_unsigned_int) case $use_unsigned_int in 0) AC_MSG_RESULT(yes) MDEP_CFLAGS="$MDEP_CFLAGS -DUSE_UNSIGNED_INT_FOR_XDR" ;; 1) AC_MSG_RESULT([no (compiler warnings)]) ;; 2) AC_MSG_RESULT(no) ;; esacfi#### Some systems don't include support for xdr. Check for it.# Also, some versions of FreeBSD don't inlude xdr_float (later ones apparently# do). Check for that as well.AC_HAVE_FUNCS(xdrmem_create xdr_float)AC_COMPILE_CHECK("XDR includes and functions",[#include <rpc/rpc.h>],[int a=1;],HAS_XDR=1,HAS_XDR=0)if test "$HAS_XDR" = 1 ; then AC_DEFINE(HAS_XDR)else print_error "XDR not available on this system" fi## If Scyld/bproc selected, (-p4comm=bproc), see if we can define itif test -n "$p4comm_bproc" ; then PAC_CHECK_HEADERS(sys/bproc.h) AC_HAVE_LIBRARY(bproc) AC_FUNC_CHECK(bproc_numnodes,AC_DEFINE(SCYLD_BEOWULF)) AC_DEFINE(P4_DO_NOT_USE_SERVER,,Define if server should never be used)fi## We do NOT add the CFLAGS and DEFS to the MDEP_CFLAGS because they are # used ONLY in building the p4 package itself. However, we add USER_CFLAGS# which were specified on the configure#CFLAGS="$USER_CFLAGS $CFLAGS $DEFS"#MDEP_CFLAGS="$USER_CFLAGS $MDEP_CFLAGS"## Set the sock_buff_size variable through the "optflags" variableif test -n "$SOCKSIZE" ; then OPTFLAGS="$OPTFLAGS -DSET_SOCK_BUFF_SIZE -DSOCK_BUFF_SIZE=$SOCKSIZE"fiif test -n "$listener_sig" ; then LISTENER_ATTN_SIGNAL="$listener_sig" AC_DEFINE_UNQUOTED(LISTENER_ATTN_SIGNAL,$listener_sig)fidnl # Check for byte orderingdnl PAC_WORDS_BIGENDIANif test "$cross_compiling" != 1 ; then dnl Set WORDS_BIGENDIAN if MSB is first. We use this to dnl differentiate between ia32 and non-ia32 platforms that are dnl running portable operating systems such as Linux, Solaris, or dnl FreeBSD. This is needed because the old P4 code associates dnl the OS type with the architecture type AC_WORDS_BIGENDIANfi## Variables used by Makefile.in's:MDEP_LIBS="$LIBS"AC_SUBST(P4ARCH)dnlAC_SUBST(P4DEVICE)dnlAC_SUBST(MAKE)dnlAC_SUBST(CC)dnlAC_SUBST(DEFS)dnlAC_SUBST(CFLAGS)dnlAC_SUBST(FC)dnlAC_SUBST(CLINKER)dnlAC_SUBST(FLINKER)dnlAC_SUBST(AR)dnlAC_SUBST(RANLIB)dnlAC_SUBST(RM)dnlAC_SUBST(P4_OBJ)dnlAC_SUBST(MDEP_LIBS)dnlAC_SUBST(CRYPT_LIBS)dnlAC_SUBST(MDEP_CFLAGS)dnlAC_SUBST(MDEP_FFLAGS)dnlAC_SUBST(MDEP_LFLAGS)dnlAC_SUBST(OPTFLAGS)dnlAC_SUBST(P4_CONFIGURED_TIME)dnlAC_SUBST(DEFINE_ALOG)dnlAC_SUBST(DEFINE_SYSV_IPC)dnlAC_SUBST(DEFINE_VENDOR_IPC)dnlAC_SUBST(DEFINE_P4_DPRINTFL)dnlAC_SUBST(LISTENER_PATHNAME)dnlAC_SUBST(RSHCOMMAND)dnlAC_OUTPUT(Makefile lib/Makefile alog/Makefile usc/Makefile \ usc/usctest/Makefile messages/Makefile include/Makefile \ lib_f/Makefile contrib/Makefile contrib_f/Makefile bin/Makefile \ doc/Makefile messages_f/Makefile misc/Makefile monitors/Makefile \ servers/Makefile)## ch_p4mpd device uses only the files Makefile lib/Makefile alog/Makefile# usc/Makefile usc/usctest/Makefile include/Makefile lib_f/Makefile# bin/Makefile servers/Makefile) dnl dnl This code removes that stupid first line placed by ac_outputdnl p4_config.h needs to be in the top-level directory so that VPATH will dnl work correctlyPAC_OUTPUT_EXEC(p4_config.h)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -