pexec-1.0rc8/0000755000175000017500000000000011253516315011511 5ustar apalapalpexec-1.0rc8/INSTALL0000644000175000017500000000055211077115426012546 0ustar apalapal PEXEC - Installation ********************* The program `pexec` can be installed using the standard `./configure && make && make install` procedure. In order to create a debian binary package, enter `make deb` (this feature requres the `dpkg-deb` utility). The created debian package can be installed using `dpkg --install pexec_$(VERSION)_$(ARCH).deb`. pexec-1.0rc8/prepare0000755000175000017500000000053311223130314013062 0ustar apalapal#!/bin/sh if test "x$1" == "x--help" ; then echo "Usage: $0 [clean]" exit 1 fi AUTOCONF=${AUTOCONF:-autoconf} rm -r -f ./autom4te.cache ./configure rm -r -f ./config.cache ./config.status ./config.log if test "x$1" == "xclean" ; then exit 0 elif ${AUTOCONF} ; then rm -r -f autom4te.cache exit 0 else rm -r -f autom4te.cache exit 1 fi pexec-1.0rc8/AUTHORS0000644000175000017500000000010311223130044012537 0ustar apalapalAndras Pal (apal@szofi.net, apal@users.sf.net, apal@szofi.elte.hu) pexec-1.0rc8/configure0000755000175000017500000065177111253516027013441 0ustar apalapal#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for pexec 1.0rc8. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # 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 # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' 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$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # 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` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='pexec' PACKAGE_TARNAME='pexec' PACKAGE_VERSION='1.0rc8' PACKAGE_STRING='pexec 1.0rc8' PACKAGE_BUGREPORT='apal@szofi.net' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GREP EGREP XLIBS DEB_VERSION DEB_ARCH DPKG_DEB HELP2MAN ROFF PAPERSIZE PAPER_WIDTH PAPER_HEIGHT LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # 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. # (The list follows the same order as the GNU Coding Standards.) 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' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= 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 case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -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) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) 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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$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 ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$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 | -n) 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 ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. 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 ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # 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 the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` 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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # 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 <<_ACEOF \`configure' configures pexec 1.0rc8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/pexec] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of pexec 1.0rc8:";; esac cat <<\_ACEOF Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective 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. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF pexec configure 1.0rc8 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by pexec $as_me 1.0rc8, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/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` /usr/bin/hostinfo = `(/usr/bin/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` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # 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. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* 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 -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$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:$LINENO: 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:$LINENO: 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 $ac_precious_vars; 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:$LINENO: 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:$LINENO: 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:$LINENO: 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:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: 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. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: 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:$LINENO: 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 # our default $(CFLAGS) are: CFLAGS="-Wall -pedantic -O3 -D_GNU_SOURCE" # check compiler: 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 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:$LINENO: 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 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: 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:$LINENO: 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 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi 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:$LINENO: 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 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi 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:$LINENO: 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 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS 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 ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: 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.exe 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:$LINENO: 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 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: 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.exe 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:$LINENO: 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 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # 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:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $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 conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: 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:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: 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 { echo "$as_me:$LINENO: 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: 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 { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end 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; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; 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 () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac 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 # check used headers: 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 { echo "$as_me:$LINENO: 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. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' 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 nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' 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:$LINENO: 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. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' 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 nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' 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:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&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 { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: 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 # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end 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 -f 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end 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 -f 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #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 () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $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 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: 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 <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in ctype.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in errno.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in signal.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in stdarg.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in time.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/resource.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/select.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/socket.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/time.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/un.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/wait.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in netdb.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in netinet/in.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/loadavg.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in libintl.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to apal@szofi.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Some OS-dependent functions: { echo "$as_me:$LINENO: checking for setenv in -lc" >&5 echo $ECHO_N "checking for setenv in -lc... $ECHO_C" >&6; } if test "${ac_cv_lib_c_setenv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char setenv (); int main () { return setenv (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_c_setenv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_setenv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_c_setenv" >&5 echo "${ECHO_T}$ac_cv_lib_c_setenv" >&6; } if test $ac_cv_lib_c_setenv = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBC 1 _ACEOF LIBS="-lc $LIBS" fi { echo "$as_me:$LINENO: checking for putenv in -lc" >&5 echo $ECHO_N "checking for putenv in -lc... $ECHO_C" >&6; } if test "${ac_cv_lib_c_putenv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char putenv (); int main () { return putenv (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_c_putenv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_putenv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_c_putenv" >&5 echo "${ECHO_T}$ac_cv_lib_c_putenv" >&6; } if test $ac_cv_lib_c_putenv = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBC 1 _ACEOF LIBS="-lc $LIBS" fi { echo "$as_me:$LINENO: checking for socket in -lc" >&5 echo $ECHO_N "checking for socket in -lc... $ECHO_C" >&6; } if test "${ac_cv_lib_c_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_c_socket=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_socket=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_c_socket" >&5 echo "${ECHO_T}$ac_cv_lib_c_socket" >&6; } if test $ac_cv_lib_c_socket = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBC 1 _ACEOF LIBS="-lc $LIBS" fi { echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6; } if test "${ac_cv_lib_socket_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_socket_socket=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6; } if test $ac_cv_lib_socket_socket = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi { echo "$as_me:$LINENO: checking for gethostbyname in -lc" >&5 echo $ECHO_N "checking for gethostbyname in -lc... $ECHO_C" >&6; } if test "${ac_cv_lib_c_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_c_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_c_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_c_gethostbyname" >&6; } if test $ac_cv_lib_c_gethostbyname = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBC 1 _ACEOF LIBS="-lc $LIBS" fi { echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6; } if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6; } if test $ac_cv_lib_nsl_gethostbyname = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi { echo "$as_me:$LINENO: checking for getloadavg in -lc" >&5 echo $ECHO_N "checking for getloadavg in -lc... $ECHO_C" >&6; } if test "${ac_cv_lib_c_getloadavg+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getloadavg (); int main () { return getloadavg (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_c_getloadavg=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_getloadavg=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_c_getloadavg" >&5 echo "${ECHO_T}$ac_cv_lib_c_getloadavg" >&6; } if test $ac_cv_lib_c_getloadavg = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBC 1 _ACEOF LIBS="-lc $LIBS" fi { echo "$as_me:$LINENO: checking for gettext in -lc" >&5 echo $ECHO_N "checking for gettext in -lc... $ECHO_C" >&6; } if test "${ac_cv_lib_c_gettext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gettext (); int main () { return gettext (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_c_gettext=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_gettext=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_c_gettext" >&5 echo "${ECHO_T}$ac_cv_lib_c_gettext" >&6; } if test $ac_cv_lib_c_gettext = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBC 1 _ACEOF LIBS="-lc $LIBS" fi # Debian archiver: { echo "$as_me:$LINENO: checking for a debian archiver" >&5 echo $ECHO_N "checking for a debian archiver... $ECHO_C" >&6; } if dpkg-deb --version >/dev/null 2>&1 ; then { echo "$as_me:$LINENO: result: dpkg-deb" >&5 echo "${ECHO_T}dpkg-deb" >&6; } ac_cv_debian_archiver="yes" DPKG_DEB=dpkg-deb else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } ac_cv_debian_archiver="no" DPKG_DEB=false fi # help2man utility: { echo "$as_me:$LINENO: checking help2man" >&5 echo $ECHO_N "checking help2man... $ECHO_C" >&6; } if help2man --version >/dev/null 2>&1 ; then { echo "$as_me:$LINENO: result: help2man" >&5 echo "${ECHO_T}help2man" >&6; } ac_cv_help2man="yes" HELP2MAN=help2man else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } ac_cv_help2man="no" HELP2MAN=true fi # Groff: { echo "$as_me:$LINENO: checking for a roff formatter" >&5 echo $ECHO_N "checking for a roff formatter... $ECHO_C" >&6; } if groff --version >/dev/null 2>&1 ; then { echo "$as_me:$LINENO: result: groff" >&5 echo "${ECHO_T}groff" >&6; } ac_cv_roff_groff="yes" ROFF=groff else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } ac_cv_roff_groff="no" ROFF=false fi # Check paper size: { echo "$as_me:$LINENO: checking papersize" >&5 echo $ECHO_N "checking papersize... $ECHO_C" >&6; } if test -x /usr/bin/paperconf ; then PAPERSIZE=`/usr/bin/paperconf` PAPER_WIDTH=`/usr/bin/paperconf -w` PAPER_HEIGHT=`/usr/bin/paperconf -h` elif test -f /etc/papersize ; then PAPERSIZE=`grep -v "^\#" /etc/papersize | head -1` PAPER_WIDTH=0 PAPER_HEIGHT=0 else PAPERSIZE=letter PAPER_WIDTH=612 PAPER_HEIGHT=792 fi { echo "$as_me:$LINENO: result: $PAPERSIZE: ${PAPER_WIDTH}x${PAPER_HEIGHT}" >&5 echo "${ECHO_T}$PAPERSIZE: ${PAPER_WIDTH}x${PAPER_HEIGHT}" >&6; } xlibs="" if test "$ac_cv_lib_c_socket" == no && test "$ac_cv_lib_socket_socket" == no ; then { { echo "$as_me:$LINENO: error: no proper socket library is available" >&5 echo "$as_me: error: no proper socket library is available" >&2;} { (exit 1); exit 1; }; } elif test "$ac_cv_lib_socket_socket" == yes ; then { echo "$as_me:$LINENO: using -lsocket" >&5 echo "$as_me: using -lsocket" >&6;} xlibs="${xlibs} -lsocket" fi if test "$ac_cv_lib_c_gethostbyname" == no && test "$ac_cv_lib_nsl_gethostbyname" == no ; then { { echo "$as_me:$LINENO: error: error: no proper gethostbyname function is available" >&5 echo "$as_me: error: error: no proper gethostbyname function is available" >&2;} { (exit 1); exit 1; }; } elif test "$ac_cv_lib_c_gethostbyname" == yes ; then true elif test "$ac_cv_lib_nsl_gethostbyname" == yes ; then { echo "$as_me:$LINENO: using -lnsl" >&5 echo "$as_me: using -lnsl" >&6;} xlibs="${xlibs} -lnsl" fi if test "$ac_cv_lib_c_setenv" == yes ; then CFLAGS="${CFLAGS} -DHAVE_SETENV" fi if test "$ac_cv_header_libintl_h" == yes && test "$ac_cv_lib_c_gettext" == yes ; then CFLAGS="${CFLAGS} -DHAVE_LIBINTL_H" { echo "$as_me:$LINENO: with internationalization support" >&5 echo "$as_me: with internationalization support" >&6;} else { echo "$as_me:$LINENO: no support for internationalization" >&5 echo "$as_me: no support for internationalization" >&6;} fi if test "$ac_cv_header_sys_loadavg_h" == yes ; then CFLAGS="${CFLAGS} -DHAVE_SYS_LOADAVG_H" fi { echo "$as_me:$LINENO: using CFLAGS: ${CFLAGS}" >&5 echo "$as_me: using CFLAGS: ${CFLAGS}" >&6;} DEB_ARCH=`uname -m | sed -e 's/x86_64/amd64/' -e 's/i486/i386/' -e 's/i586/i386/' -e 's/i686/i386/'` { echo "$as_me:$LINENO: using Debian architecture identifier: ${DEB_ARCH}" >&5 echo "$as_me: using Debian architecture identifier: ${DEB_ARCH}" >&6;} DEB_VERSION=$PACKAGE_VERSION XLIBS=${xlibs} DEB_VERSION=${DEB_VERSION} DEB_ARCH=${DEB_ARCH} DPKG_DEB=${DPKG_DEB} HELP2MAN=${HELP2MAN} ROFF=${ROFF} PAPERSIZE=${PAPERSIZE} PAPER_WIDTH=${PAPER_WIDTH} PAPER_HEIGHT=${PAPER_HEIGHT} ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile" cat >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 overridden 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, we kill variables containing newlines. # 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. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} 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}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # 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 ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # 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 # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' 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$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by pexec $as_me 1.0rc8, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -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 Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ pexec config.status 1.0rc8 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # 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[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { 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" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; *) { { echo "$as_me:$LINENO: 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim XLIBS!$XLIBS$ac_delim DEB_VERSION!$DEB_VERSION$ac_delim DEB_ARCH!$DEB_ARCH$ac_delim DPKG_DEB!$DPKG_DEB$ac_delim HELP2MAN!$HELP2MAN$ac_delim ROFF!$ROFF$ac_delim PAPERSIZE!$PAPERSIZE$ac_delim PAPER_WIDTH!$PAPER_WIDTH$ac_delim PAPER_HEIGHT!$PAPER_HEIGHT$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 58; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # 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 cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # 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 by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $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'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF 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=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || 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 pexec-1.0rc8/Makefile.in0000644000175000017500000000751711253515707013574 0ustar apalapalSHELL = /bin/sh .PHONY: all \ src info html pdf ps dvi man \ install install-strip \ install-info install-html install-dvi install-pdf install-ps \ uninstall \ clean distclean mostlyclean maintainter-clean TAGS \ deb deb-pexec DEB_VERSION = @DEB_VERSION@ DEB_ARCH = @DEB_ARCH@ DPKG_DEB = @DPKG_DEB@ HELP2MAN = @HELP2MAN@ datarootdir = @datarootdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ mandir = @mandir@ bindir = @bindir@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ infodir = @infodir@ docdir = @docdir@ htmldir = @htmldir@ dvidir = @dvidir@ pdfdir = @pdfdir@ psdir = @psdir@ all: src src: make -C src html: make -C doc html dvi: make -C doc dvi ps: make -C doc ps pdf: make -C doc pdf info: make -C doc info man: src test -f ./doc/pexec.1 || $(HELP2MAN) -h --long-help ./src/pexec > ./doc/pexec.1 install: src info man install -d ${bindir} install -m 0755 ./src/pexec ${bindir} install -d ${mandir}/man1 test -s ./doc/pexec.1 && install -m 0644 ./doc/pexec.1 ${mandir}/man1 || true install -d ${infodir} install -m 0644 ./doc/pexec.info ${infodir} install-strip: install strip ${bindir}/pexec install-dvi: dvi install -d ${dvidir} install -m 0644 ./doc/pexec.dvi ${dvidir} install-ps: ps install -d ${psdir} install -m 0644 ./doc/pexec.ps ${psdir} install-pdf: pdf install -d ${pdfdir} install -m 0644 ./doc/pexec.pdf ${pdfdir} install-html: html install -d ${htmldir} install -m 0644 ./doc/pexec.html ${htmldir} uninstall: rm -f ${bindir}/pexec rm -f ${mandir}/man1/pexec.1 rm -f ${infodir}/pexec.info clean: make -C src clean make -C doc clean rm -f -r deb/pexec rm -f pexec_$(DEB_VERSION)_$(DEB_ARCH).deb rm -f -r pexec-$(DEB_VERSION) rm -f pexec-$(DEB_VERSION).tar.gz mostlyclean: clean dist: rm -f -r pexec-$(DEB_VERSION) mkdir pexec-$(DEB_VERSION) mkdir pexec-$(DEB_VERSION)/deb cp -p deb/pexec.control deb/README pexec-$(DEB_VERSION)/deb mkdir pexec-$(DEB_VERSION)/doc cp -p doc/Makefile.in pexec-$(DEB_VERSION)/doc cp -p doc/pexec.texi doc/version.texi doc/gfdl.texi pexec-$(DEB_VERSION)/doc test -f ./doc/pexec.1 && cp -p ./doc/pexec.1 pexec-$(DEB_VERSION)/doc || true mkdir pexec-$(DEB_VERSION)/src cp -p src/*.[ch] src/Makefile.in pexec-$(DEB_VERSION)/src cp -p AUTHORS COPYING INSTALL NEWS README TODO VERSION pexec-$(DEB_VERSION) cp -p Makefile.in ./configure configure.ac ./prepare pexec-$(DEB_VERSION) tar cvzf pexec-$(DEB_VERSION).tar.gz pexec-$(DEB_VERSION) rm -f -r pexec-$(DEB_VERSION) distclean: clean rm -f -r autom4te.cache rm -f ./config.status ./config.log rm -f ./src/Makefile rm -f ./doc/Makefile rm -f ./Makefile maintainer-clean: distclean rm -f ./configure TAGS: check: src ./src/pexec -n 2 -r 1 2 3 4 -e x -c -R -- 'echo $$x' deb: deb-pexec deb-pexec: src info man rm -f -r deb/pexec mkdir -p deb/pexec{,/DEBIAN} mkdir -p deb/pexec{,/usr/bin,/usr/share/man/man1,/usr/share/info,/usr/share/doc/pexec} cp src/pexec deb/pexec/usr/bin/ cp doc/pexec.1 deb/pexec/usr/share/man/man1/ gzip deb/pexec/usr/share/man/man1/pexec.1 cp doc/pexec.info deb/pexec/usr/share/info/ gzip deb/pexec/usr/share/info/pexec.info cp README deb/pexec/usr/share/doc/pexec/ gzip deb/pexec/usr/share/doc/pexec/README cp AUTHORS deb/pexec/usr/share/doc/pexec/ gzip deb/pexec/usr/share/doc/pexec/AUTHORS cat deb/pexec.control | \ sed -e "s/__ARCH__/$(DEB_ARCH)/" \ -e "s/__INSTALLED_SIZE__/`du -k -s --exclude DEBIAN deb/pexec | awk '{ print $$1; }'`/" > deb/pexec/DEBIAN/control for f in `find deb/pexec` ; do \ o=`echo $$f | sed 's/deb\/pexec\///'` ; \ if [ -f "$$f" -a `dirname "$$f"` != deb/pexec/DEBIAN ] ; then \ m=`md5sum $$f | awk '{ print $$1; }'` ; \ echo $$m $$o ; \ fi ; \ done > deb/pexec/DEBIAN/md5sums $(DPKG_DEB) --build deb/pexec pexec_$(DEB_VERSION)_$(DEB_ARCH).deb rm -f -r deb/pexec pexec-1.0rc8/deb/0000755000175000017500000000000011253516315012243 5ustar apalapalpexec-1.0rc8/deb/pexec.control0000644000175000017500000000141711223130336014744 0ustar apalapalPackage: pexec Version: 1.0rc8 Section: utils Priority: optional Architecture: __ARCH__ Depends: libc6 (>= 2.3.2) Installed-Size: __INSTALLED_SIZE__ Maintainer: Andras Pal Source: pexec Description: pexec - simple utility for parallel shell command execution The program `pexec` executes parallely the given command or shell script on the local host or on remote hosts, while some of the execution parameters, namely the redirected standard input, output or error and environmental variables can be varied. `pexec` features some additional functionality for implementing mutual exclusions and atomic command executions, as well as the program is also capable to run in hypervisor mode to control system resources for concurrent tasks run in parallel. pexec-1.0rc8/deb/README0000644000175000017500000000022711223130436013115 0ustar apalapalThis directory contains the `pexec.control` file, that is patched dynamically by the `./Makefile` (see __*__ tags) in order to create debian packages. pexec-1.0rc8/doc/0000755000175000017500000000000011253516315012256 5ustar apalapalpexec-1.0rc8/doc/Makefile.in0000644000175000017500000000123511104102131014302 0ustar apalapalSHELL = /bin/sh ROFF=@ROFF@ PAPERSIZE = @PAPERSIZE@ PAPER_WIDTH = @PAPER_WIDTH@ PAPER_HEIGHT = @PAPER_HEIGHT@ .PHONY: all clean postscript ps pdf dvi html info ps: postscript dvi: pexec.dvi postscript: pexec.ps pdf: pexec.pdf info: pexec.info html: pexec.html pexec.dvi: pexec.texi texi2dvi pexec.texi pexec.ps: pexec.dvi dvips pexec.dvi -o pexec.pdf: pexec.dvi dvipdf pexec.dvi pexec.pdf pexec.info: pexec.texi makeinfo pexec.texi pexec.html: pexec.texi makeinfo --html --no-split --output pexec.html pexec.texi clean: rm -f pexec.html pexec.ps pexec.info pexec.dvi pexec.pdf pexec.1 rm -f *.cp *.aux *.log *.fn *.ky *.tp *.pg *.toc *.vr *.cps pexec-1.0rc8/doc/pexec.texi0000644000175000017500000011117611135662277014274 0ustar apalapal\input texinfo @c -*-texinfo-*- @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c %**start of header @include version.texi @setfilename pexec.info @settitle pexec @value{VERSION} @c %**end of header @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @ifinfo This manual page documents briefly the pexec program. @end ifinfo @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @copying This manual page documents briefly the @code{pexec} program. @quotation This software was written by Andr@'{a}s P@'{a}l. The core part was written while working for the Hungarian-made Automated Telescope (HAT) project to make the data processing more easier and therefore find many-many extrasolar planets. See more information about this project: @code{http://hatnet.hu}. Another internal libraries (e.g. @file{numhash.[ch]}) were primarily written/developed for other projects. @end quotation This documentation: Copyright (C) 2007, 2008; Andr@'{a}s P@'{a}l. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". @end quotation @end copying @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @ifnottex @node Top @top pexec @end ifnottex @titlepage @title pexec @subtitle A program for executing commands or script pieces in parallel. @subtitle @value{UPDATED}, pexec version @value{VERSION} @author by Andr@'{a}s P@'{a}l (apal@@szofi.elte.hu) @page @vskip 0pt plus 1filll @insertcopying @end titlepage @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @menu * General information:: * Command line options:: * Examples:: * Additional information:: * Copying This Manual:: @end menu @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @c @node General information @chapter General information @menu * General options:: * Redirecting standard streams:: * Execution using remote hosts:: * Mutual exclusions and atomic command execution:: * Hypervisor mode:: * Logging:: @end menu @section Name @code{pexec} - execute commands or shell scripts in parallel on a single host or on remote hosts using a remote shell @section Description This manual page documents briefly the @code{pexec} program. @code{pexec} executes in parallel the given command or shell script (e.g. parsed by @code{/bin/sh}) on the local host or on remote hosts, while some of the execution parameters, namely the redirected standard input, output or error and environmental variables can be varied. The given program or script is executed as many times as how many parameters are specified in the command line or read from a given parameter file. Each parameter is a simple string which can be used either to pass to the program/script as the value of an environmental variable or it can be used in the format of the file names where the standard input, output or error are optionally redirected from or to. Moreover, more than one shell command script can also be passed to parallel execution, in this case there is no need for parameters or the number of the parameters taken from command line (or read from a parameter file) must be the same as the number of the distinct shell command scripts. The program is capable to automatically swallow the standard output and error (to @code{/dev/null}), or collecting them via pipes and dump to the invoker's standard output or error (with optional line headers or trailers which can be used to distinguish between the output of the distinctive processes). The execution on remote hosts is done using a remote shell which both builds a tunnel between the invoking and the remote host(s) and do the authentication and ensures the security (if a secure remote shell is used). Hence, there is no need to run standalone daemons on the remote side: the remote shell itself executes the @code{pexec} program in daemon mode when the standard input and output of the latter is bound to the remote shell to form a (secure and authenticated) tunnel. See the appropriate section below for a more detailed explanation. In order to avoid unexpected I/O load or to synchronize individual tasks, @code{Bpexec} supports mutual exclusions (@i{mutex}es) and atomic command executions. The maximum number of simultaneous tasks can be controlled by a hypervisor daemon: with such a daemon, concurrent @code{pexec} instances can start without an unexpectedly high load. @section Synopsys General invocation: @code{pexec [options] [--] command [arguments]} @code{pexec [options] -c [--] script} @noindent or @code{pexec [options] -m [--] 'script1' ['script2'...]} @noindent Remote control, mutual exclusions and atomic command exectuion: @code{pexec [-j|--remote] [options]} @code{pexec [-j|--remote] [options] [-l|-u ]} @code{pexec [-j|--remote] [options] -a -m [-c] [--] command [arguments]} @noindent Hypervisor daemon: @code{pexec [-H|--hypervisor] [options] start|stop} @node Command line options @chapter Command line options @node General options @section General options @table @code @item @code{-h}, @code{--help} Gives general summary about the command line options. @item @code{--version} Gives some version information about the program. @item @code{-s}, @code{--shell} <@i{full shell path}> Full path (e.g. @code{/bin/sh}) of the shell to be used for script execution. @item @code{-c}, @code{--shell-command} Use a shell (see @code{-s|--shell} also) to interpret the command(s) instead of direct execution. @item @code{-m}, @code{--multiple-command} Allow multiple individual shell command scripts to be executed in parallel with the variation of the parameters (see notes at @code{-l|--list} or @code{-f|--listfile}). @item @code{-e}, @code{--environment} <@i{environmental variable name}> Name of an environmental variable which is set to the respective parameter (taken from the command line or the parameter file) before each execution and can be read from the program or shell script. In shells like @code{/bin/bash}, such environmental variables can easily be read as if they would be a normal shell variable (see the examples also). @item @code{-n}, @code{--number} <@i{number of parallel processes}> | @i{auto} | @i{managed} | @i{ncpu} The maximal number of processes running simultaneously. By default (omitting @code{-n|--number} or specifying @code{-n|--number} @i{auto}) the program tries to connect to a local hypervisor which keeps track the resources of the system (see sec. Hypervisor Mode for more details). If the connection to the local hypervisor failed, the program derives the number of available processing units on the local host using the content of @code{/proc/cpuinfo} or other system-specific method (on operating systems with different kernel than Linux). If the argument of @code{-n|--number} is @i{managed}, @code{pexec} searches only for hypervisor and terminates with a non-zero exits status if the connection is failed. If the argument for @code{-n|--number} is @i{ncpu}, the program does not try to connect to the hypervisor (even if it is running) but uses the available information (@code{/proc/cpuinfo} or other system-specific method) to figure out the number of processing units. @item @code{-C}, @code{--control} [@i{}:]@i{}|@i{} This option specifies the control port of a hypervisor which is used to control the number of simultaneously run tasks. By default, this is the UNIX doman socket @code{/tmp/pexec.sock}. If the specified port is a single number, @code{pexec} connects to the given port on the localhost, if a host is specified, the program connects to the given host and port; otherwise if it is a valid path, @code{pexec} connects to that UNIX domain socket. Note that the hypervisor socket does not have a default port number, i.e. the port argument is mandatory after the host name. See sec. Hypervisor Mode for more details. @item @code{-p}, @code{--list} <@i{space separated list of parameters}> [@code{-p} ...] The single-argument form of main parameter list: each switch can accept one command line argument, thus if more than one parameter is defined after a single @code{-p} or @code{--list} option, the delimiter whitespace should be escaped somehow. Note that if there are more than one shell commands to be executed, the total number of parameters should be the same as the number of the individual shell commands or no parameters should be declared. @item @code{-r}, @code{--parameters} <@i{list of parameters up to the next switch}> [@code{-r} ....] The multiple-argument form of the main parameter list: each switch can be followed by multiple arguments up to the next switch, i.e. the nearest command line argument which begins with at least a single dash. Note that if in either of the arguments there is a space (or there are more spaces), such arguments will be splitted among the delimiting whitespaces. Note also that the parameter specifications by @code{-p|--list} and @code{-r|--parameters} can be mixed, depending on the actual problem or convenience. See also some notes below at @code{-f|--listfile}. @item @code{-f}, @code{--listfile} <@i{file containing the parameters}> The main parameter list file. The parameters are read line by line while the parts of the file after a '#' (hashmark) are treated as comments. By default, the parameter is the first whitespace delimited column of the line if the line is not empty (or fully commented out). The parameters can be gathered from another column (see @code{-w|--column}) or the complete line can be threaded as a single parameter (see @code{-t|--complete}). If the parameters are read from a single column and some of the parameters are wanted to contain space(s), it can be put between double quotation marks ("..."). Note that if there are more than one shell commands to be executed, the total number of parameters should be the same as the number of the individual shell commands or no parameters should be declared. Note also that the parameters can only be defined from command line @i{or} from this list file, i.e. @code{-f|--listfile} and @code{-p|--list|-r|--parameters} cannot be mixed. @item @code{-w}, @code{--column} <@i{column index}> The column from where the parameters should be taken if they are read from a parameter file (see @code{-f|--listfile} above). If the given column is not exist in the current line, that line will silently be omitted. @item @code{-t}, @code{--complete} Threat the whole line as a single parameter if the parameters are read from a file. Empty lines and all parts in the line after a '#' (hashmark) are omitted. Note that contrary to the argument splitting near @code{-r|--parameters} (or @code{-p|--list}), the content of a line won't be splitted into distinct parameters even if there are whitespaces. @item @code{-z}, @code{--nice} <@i{nice}> Sets the scheduling priority of @code{pexec} and all children (executed processes) to the priority defined by the nice value. @item @code{--} A marker after when the command begins. This is optional but useful to limit the parameter list of @code{-r|--parameters} or when the command itself begins with a literal '@i{-}' (dash) character (the latter is a rear case, as one can expect). This marker can also be used to emphasize the (beginning of the) command itself. @end table @node Redirecting standard streams @section Redirecting standard input, output and error @table @code @item @code{-i}, @code{--input} <@i{input file format}> The name of the input file which is used for redirecting the standard input. If this argument is omitted, the standard input will be empty (i.e. /dev/null) unless the other two standard file redirection specifications are also omitted @i{and} there is not more than one parameter; in this case the standard streams are inherited by this single executed process. If the input file argument is a single existing file, all command execution processes will use the same file for input. If the argument contains the format elements @i{%s} and @i{%d}, these are replaced to the respective parameter name or the sequence number of the parameter (which is between 1 and the total number of parameters). @item @code{-o}, @code{--output} <@i{output file format}> The name of the output file which is used for redirecting the standard output. If this argument is omitted, the standard output will be swallowed (unless the other two redirections are also omitted, see @code{-i|--input} for this case). If the argument is a single file, all command execution processes writes their output to this single file. If the argument is a single dash or @code{-1}, all of the standard outputs are gathered to the invoker's standard output. If the argument is @code{-2}, the standard outputs are gathered to the standard error of the invoker. If the argument contains the format elements @i{%s} or @i{%d}, these are replaced to the respective parameter name and the standard output will be a different file for each process. Note that in the second case, when the output file is a single, non-formatted file name, the outputs are collected via pipes and there is no guarantee for subsequent data order, even the outputs of different processes can be mixed (moreover, if the output is ASCII text, parts of lines can also be mixed). This means that the processes will feel their standard outputs as pipes not as regular files. Note also that if only @i{I%s} is used in the formatted file name, the parameter list should contain unique parameters, unless some of the output files will be lost and/or written in parallel, yielding unexpected result. @item @code{-u}, @code{--error}, @code{--output-error} <@i{output error file format}> The name of the output file which is used for redirecting the standard error. All of the properties of the standard error redirection mechanism is the same as for the standard output, see @code{-o|--output} above for a more detailed explanation. The only exception is the single dash: specifying a single dash to @code{-u|--error} results that the standard errors are going to be collected to the standard error of the invoker. To redirect the errors to the standard output, use @code{-1} as an argument. @item @code{-R}, @code{--normal-redirection} This is equivalent to specifying @code{--output -} @i{and} @code{--error -} @i{and} @code{--input /dev/null}. Since redirecting the @i{same} standard input to all of the executed commands is nearly meaningless in a parallel environment, this argument implies an expectable behaviour, i.e. the standard output and error streams of the commands are gathered to the invoker's standard output. @item @code{-a}, @code{--output-format} <@i{Ioutput line format}> The format of the final standard output redirection if the output of all of the processes are gathered into the same file. The format can contain any character, while the @i{%s} and @i{%d} format elements are replaced as it was written in @code{-i|--input}. The line itself without the trailing newline character is represented by @i{%l}. Extra characters (e.g. tabulators, newlines) can also be inserted using the well-known escape sequences. Note that the trailing newline is always set implicitly unless it is disabled by @code{-x|--omit-newlines}. The line buffering yielded by the simple format of @i{%l} can also be useful if all of the standard outputs (or errors) are collected in a single file and the invoker wants to avoid the inter-line confusion of output (i.e. if this redirection formatting is omitted, no line buffering is done at all). The @code{printf}-like alignment syntax can also be used near @i{%s}, @i{I%l} and @i{%d} (both in the post-formatting and in the redirection file name formats): the number before the period indicates the minimum size and its sign refers to the alignment (positive: right alignment, negative: left alignment) while the number after the period indicates the minimum number of padding zeroes for numerical values. E.g the @i{%5.3d} would yield @i{" -042"} for -42. @item @code{-b}, @code{--error-format} <@i{error line format}> The same final redirection format for the standard error. See @code{-a|--output-format} for more details. @item @code{-x}, @code{--omit-newlines} If the final redirection of the standard output or error are re-formatted using @code{-a|--output-format} and/or @code{-b|--error-format}, the trailing newlines are disabled and only written if specified directly using '@i{\n}'. .PP Note that in the case when no redirection is specified @i{and} the number of the parameters is exactly one or less; the executed process will inherit the standard files directly from the invoker. Otherwise, if there is more than one parameter in the list, the redirection will be defined by the @code{-i|--input}, @code{-o|--output} and @code{-u|--error} options. It means if one of these options is omitted, the respecting standard stream will be redirected from/to @code{/dev/null}. In other words, if any of these redirection options is specified, the latter rules will define the redirection, independently of the number of the parameters. @end table @node Execution using remote hosts @section Execution using remote hosts The execution on remote hosts is done using a remote shell which both builds a tunnel between the invoking and the remote host(s) and do the authentication and ensures the security (if a secure remote shell is used). It means that on the remote hosts(s) there should be: @itemize @bullet @item an appropriate daemon for the remote shell to connect to; @item the appropriate version of @code{pexec} which is started in daemon mode; @item and the same file structure if the executed command rely on some files (see below the option @code{-k|--local-files} for more details about this issue). @end itemize @noindent The same file structure which might be required the script can be ensured by an NFS or other types of network filesystem mounts. Note that in this case it is highly crucial since it is not determined which parameter is executed on which host. I.e. the executed script and the underlying filesystem should ensure the same result on every single host; otherwise one can get unexpected results. @table @code @item @code{-g}, @code{--remote-shell} "<@i{remote_shell}> [<@i{arguments}>]" The name or full path of the remote shell to be used for building the tunnel between the local and the peer host(s). The default remote shell is @code{/usr/bin/ssh} with no extra arguments. Note that if additional arguments are defined for the remote shell, the whole argument of the switch should be escaped somehow (e.g. put between quotation marks). The connection and authentication are performed sequentially @i{before} executing anything and only once for each host: if the the authentication requires interactivity (e.g. typing a password), it is also done before the whole procedure starts. @item @code{-n}, @code{--number} <@i{hostspec}>:[<@i{processes}>],...,[<@i{processes}>] This more sophisticated form of the @code{-n|--number} option is used to specify a comma-separated list of names and expected capacities of the remote hosts used for parallel execution. The @i{hostspec} argument is the host specification argument passed directly to the remote shell which should be capable to understand it. In the most cases, it is simply the name of the peer machine, in the case of @code{ssh}, the username also can be passed using the well-known @i{username@@hostname} form. The host specification must always be followed by a literal colon ('@i{:}'). Optionally, the maximum number of processes to run on that host can follow the colon. If it is omitted, the maximum number of processes are determined on the peer side automatically (yielding the same number of processes as it is determined by @code{--number} @i{auto}, see above), moreover the literal @i{auto}, @i{managed} and @i{ncpu} arguments can also be used, like in the case of local host parallelization. The number of processes executed on the invoker's host can simply be specified by a single positive number, or by one of the keywords @i{auto}, @i{managed} and @i{ncpu} (just in the case of simple local host execution). Note that the host specifications are additive, i.e. if the same machine (including the local one when the @i{hostspec} and its colon is omitted) is defined more than once, the maximum number of processes are added. It can yield unexpected results if the number is omitted after the colon, i.e. it is determined automatically, in this case the automatically determined maximum number of processes are also added, yielding a large load. @item @code{-k}, @code{--local-files} [TBD] If this option is enabled, the remote daemons will read or store the redirected standard input, output and error files on the local side. Otherwise (by default), these files are read from/stored to the invoker's host and tunneled to/from the peer. Note that if the redirected files are parameter-specific @i{and} tunneled to/from the remote hosts, then these files 1/ on the invoker's host are seen as regular files; 2/ on the remote hosts are seen as pipes. Otherwise, if the redirection is done from/to a single file, both the local and remote hosts will see their standard outputs and errors as pipes but the standard input is still a regular file on the local side and a pipe on the remote side. @item @code{-P}, @code{--pexec} <@i{pexec-path}> The full path of the @code{pexec} program on the remote hosts. If this option is omitted, the invoker tries to figure out from the invoking syntax (see @i{argv[0]}) and the current path. This issue can be a bottleneck if the program is installed differently on the hosts since the remote shells executes their commands in non-interactive and/or non-login modes which might result different paths. @item @code{-T}, @code{--tunnel} If this option is the first in the positional argument list of @code{pexec}, the program will start in tunnel daemon mode. This parameter is not used during the regular usage but used by @code{pexec} itself to start daemons via the remote shell tunnels. @end table @node Mutual exclusions and atomic command execution @section Remote control, mutual exclusions and atomic command execution Running instances of @code{pexec} can be controlled remotely to gather some status information of the paralleled execution and implement mutual exclusions. @table @code @item @code{-y}, @code{--bind} @i{inet}|@i{unix}|@i{}|@i{/} This option lets @code{pexec} to be remote controlled via internet (AF_INET family sockets) or via UNIX domain sockets. If the literal @i{inet} or @i{unix} is specified as an argument for this switch, the port or the path of the named socket will be assigned randomly; but both of them can be specified directly by a single integer number (referring to an INET port) or by an absolute path (beginning with a literal slash, referring to an UNIX domain named socket). In all cases, the currently assigned port or path will be reported in the logs and will be exported as an environmental variable with the name of @i{PEXEC_REMOTE_PORT} (by default, see also @code{-E|--pexec-connection-variable}). This environmental variable is inherited by all processes executed on the local host @i{and} tunneled to the remote hosts too and inherited by the all of the processes executed by @code{pexec} daemons. @item @code{-E}, @code{--pexec-connection-variable} <@i{environment_variable_name}> This option overrides the default environment name @i{PEXEC_REMOTE_PORT} to the specified value, which is used by the @code{-p|--connect} @i{auto} combination to determine the control socket with which the running @code{pexec} instance can be controlled or polled. Note that in practice there is no need to change this variable since separate @code{pexec} jobs uses different environment space (i.e. a process which changes an environment variable affects the variables of its childrend only). @item @code{-j}, @code{--remote} If this option is the first in the argument list of @code{pexec}, then the program can be used to control and poll the status of other running instances of @code{pexec} @i{if} these other running ones were started with enabling the remote control by @code{-y|--bind} (see above). @item @code{-p}, @code{--connect} @i{auto}|[@i{:}]@i{}|@i{/} With this option one can specify the @code{pexec} instance which is to be remote controlled. Since connecting to something is mandatory for doing remote control, omitting this option is equivalent with @code{--connect auto} and in this case the program gets the remote port information using the environmental variable @i{PEXEC_REMOTE_PORT} (by default, see also @code{-E|--pexec-connection-variable}). If this environmental variable is not exist, the connection will fail and @code{pexec} exits with an error. The @code{pexec} instance to be remote controlled can also be specified directly by specifying either the INET host and port (in this case if host is omitted, @i{localhost} is used as default but the port number is mandatory since there is no default port) or the absolute path of the UNIX domain socket. Note that in the most shells @code{--connect auto} is equivalent to @code{--connect $PEXEC_REMOTE_PORT} (by default, see also @code{-E|--pexec-connection-variable}) since the environmental variables can be referred as a normal shell variable. @item @code{-t}, @code{--status} This option prints the actual status of the running jobs in a human-readable form to the invoker's standard output. It can be used for polling the progress of the whole paralleled execution. @item @code{-l}, @code{--lock}, @code{--mutex-lock} @i{} @item @code{-u}, @code{--unlock}, @code{--mutex-unlock} @i{} With these options mutual exclusions (@i{mutex}es) can easily be implemented: if no one else performs the same locking, the program exists immediately, otherwise it would block until someone else releases the mutex (i.e. by calling @code{-u|--unlock|--mutex-unlock} with the mutex of the same name). @item @code{-m}, @code{--mutex} @i{} @item @code{-d}, @code{--dump} @i{} | @code{-s}, @code{--save} @i{} If one of the @code{-d|--dump} or @code{-s|--save} options are specified, the program prints the content of the file to standard output or stores the data read from the standard input to the specified file, respectively (like @code{cat} or @code{tee} with the difference that @code{-s|--save} does not copy the content to standard output like @code{tee} does so). If a mutex is specified by @code{-m|--mutex}, @code{pexec} locks the mutex @i{before} the dump/save operation and unlock @i{after} it is done, i.e. @code{pexec -j -d something.txt -m mymutex} is equivalent with @code{( pexec -j -l mymutex && cat something.txt && pexec -j -u mymutex )}. @item @code{-m}, @code{--mutex} @i{} @item @code{-a}, @code{--atomic} [@code{-c|--shell-command}] [@code{--}] @i{} With this option, an atomic execution respective to a given mutex (specified by @code{-m|--mutex}) of the command can be performed. For example, @code{pexec -j -m mymutex -a cat something.txt} is equivalent with @code{( pexec -j -l mymutex && cat something.txt && pexec -j -u mymutex )}. @end table @noindent Note that if the lock and unlock operations are in the same pipeline @i{and} these operations use the same mutex, the invoker should ensure that the locking call exists before the unlock request could start (otherwise the whole parallel execution blocks infinitely). Like so, if dump and a save operations with the same mutex present in the same pipeline, the intermediate programs should delay the data propagation: the save part must not get any data until the dump part flushes everything to its standard output (otherwise even this single pipeline blocks infinitely). Note also that the whole remote controlling procedure is transparent to the remote host execution, i.e. every necessary parameter, environmental variable and mutex lock/unlock request will propagate via the remote shell tunnel. Therefore the end-user won't see any difference (and do not have to bother with these details in his final invocation) between the purely local and remote execution processes. @node Hypervisor mode @section Hypervisor mode The program @code{pexec} is capable to run in hypervisor mode. The hypervisor daemon acts as a resource controller, i.e. other running instances of @code{pexec} ask the hypervisor if there is available resource or not. The main purpose of the hypervisor daemon is to balance the usage between concurrent running @code{pexec} instances in order to avoid unexpectedly high load. @table @code @item @code{-H}, @code{--hypervisor} [@i{start}|@i{stop}] This option starts @code{pexec} in hypervisor mode. By default, the hypervisor is not detached from the terminal. If @i{start} is given, the deamon is detached and put into background. Such running daemons can be stopped using the @i{stop} argument. @item @code{-C}, @code{--control} @i{}|@i{/} This option specifies the control port used by the hypervisor to listen for connections. By default, this is the UNIX doman socket @code{/tmp/pexec.sock}. If the specified port is a single number, @code{pexec} creates an INET server socket, otherwise if it is a valid path, an UNIX domain socket is created. @item @code{-n}, @code{--number} <@i{number of parallel processes}> | @i{auto} | @i{ncpu} The maximum number of parallel processes which is allowed to be executed simultaneously by all of the connected @code{pexec} programs together. By default, @code{pexec} uses @code{/proc/cpuinfo} (or other system-dependent way) to figure out the number of available processing units and use this number as the maximum of parallel processes. @item @code{-l}, @code{--load}, @code{--use-load} <@i{load}> This option limits the number of processes to yield a normalized load less than unity, still keeping the number of simultaneous processes not to be greater than the value specified by @code{-n|--number}. The normalized load is the actual load (averaged on 1, 5 or 15 minutes) divided by the maximum number of parallel processes. The argument of this switch can be @i{0}, @i{1} or @i{2}, or @i{1min}, @i{5min} or @i{15min}, respectively. The @code{pexec} hypervisor uses the specified time averaged load. @end table @node Logging @section Logging @table @code @item @code{-L}, @code{--log} <@i{log file}> The name of the log file where the details of the parallel executions are written. By default, no such log file is created. @item @code{-W}, @code{--log-level} <@i{log level}> The log level, an integer number between 0 and infinity. The more large this number is, the more information is written to the log file. If the log level is zero, no log file is created. The default log level is 1. If the log level is specified directly, but @code{-l|--log} is omitted, the log will be written to the invoker's standard error (maybe in parallel with other messages gathered by @code{-u|--error -}. If neither @code{-l|--log} nor @code{-v|--log-level} is specified, logging does not occur. @item @code{-V}, @code{--verbose} Increase the log level (see @code{-v|--log-level}) by one. For example, @code{--log-level 2} is equivalent to @code{-V -V}. @end table @node Examples @chapter Examples @section Identical execution If all options are omitted, only the command and its arguments are specified after @code{pexec}, the program simply runs the given process, as it would happen without @code{pexec}: @verbatim pexec ssh -X -l user host @end verbatim @section Calculate the square root of some numbers Using directly the output of the command @code{seq}, let us calculate the square root of the first ten integer numbers and store the results in separate files [named @file{sqrt-@var{n}.dat}]. For the calculation itself, we use the program @code{bc}, a command-line driven arbitrary precision calculator: @verbatim pexec -o sqrt-%s.dat -p "$(seq 10)" -e NUM -n 4 -c -- \ 'echo "scale=10000;sqrt($NUM)" | bc' @end verbatim @noindent Here we explicitly used 4 processors. The number itself is passed to the shell-script via the environmental variable @i{NUM}. @section Sort some files This example sorts some files which matches the a pre-defined search pattern. The sorted versions of the files are stored in the files with the same names but the suffix @code{.sort} is always appended. @verbatim pexec -p "$(ls myfiles*.ext)" -i %s -o %s.sort -- sort @end verbatim @noindent Here we used explicit redirection from the input files to the output files. Since the command itself is very simple, it is wise to put the dash-dash before the command to make the reading of the whole command easier. @section Detect stars on astronomical images In this example we assume that we have a list file of base names of astronomical images, i.e. the images themselves have the base name followed by the extension @code{*.fits}. Since we not expect so much errors, the standard errors are collected in a single file (@code{star.log}, namely): @verbatim pexec -f image.list -n auto -e B -u star.log -c -- \ 'fistar $B.fits -f 100 -F id,x,y,flux -o $B.star' @end verbatim @noindent The program @code{fistar} can be more tuned, depending on the actual problem. The base name of the image implies the base name of the star detection output (@code{*.star}). Here also an environmental variable, @i{B} was used to pass the varied information, i.e. the basename of the images. @section Convert all PNG images in the current directory to JPEG format If all of our images (@code{*.png}) have a name which does not start with a dash, we can use the @code{-r|--parameters} switch too: @verbatim pexec -r *.png -e IMG -c -o - -- \ 'convert $IMG ${IMG%.png}.jpeg ; "echo $IMG: done"' @end verbatim @noindent For the conversion the ImageMagick tool @code{convert} is used which simply figures out the format from the extensions. The trailing @code{echo} just report the images which are ready after conversion, these "reports" are collected via the standard output and printed for the invoker due to @code{-o -}. Another realization, using the NetPBM package: @verbatim pexec -r *.png -i %s -o %s.jpg -c 'pngtopnm | pnmtojpeg' @end verbatim @noindent Note the difference between the two examples above. From a PNG file named @file{something.png}, the first one creates a JPEG file named @file{something.jpeg} while the output of the second call will be @file{something.png.jpg} (i.e. the argument @code{-o %s.jpg} simply yield a concatenation of the @code{.jpg} extension to the existing file name). To get rid of this ``side effect'', one can say @verbatim for p in *.png ; do echo ${p%.png} ; done | \ pexec -f - -i %s.png -o %s.jpg -c 'pngtopnm | pnmtojpeg' @end verbatim @noindent or @verbatim LIST=$(for p in *.png ; do echo ${p%.png} ; done) pexec -r $LIST -i %s.png -o %s.jpg -c 'pngtopnm | pnmtojpeg' @end verbatim @section Rescale all JPEGimages in the current directory, using mutexes: In this example a simple usage of mutexes is demonstrated. The usage of mutexes prevents peaks of high disk accesses if many processes would try to read/write the same disk simultaneously: @verbatim pexec -n 8 -r *.jpg -y unix -e IMG -c \ 'pexec -j -m blockread -d $IMG | \ jpegtopnm | pnmscale 0.5 | pnmtojpeg | \ pexec -j -m blockwrite -s th_$IMG' @end verbatim @noindent In the above example an UNIX domain socket is used to for the communication between the main @code{pexec} program and the remote control calls. From a given file, for example @file{something.jpg}, the above call would create a file named @file{th_something.jpg}. @node Additional information @chapter Additional information @menu * Bugs:: @end menu @node Bugs @section Bugs @itemize @item The @code{-k|--local-files} option is still not implemented. @item Actually, in the cases when the execution of the process fails (i.e. the program or shell does not exists, access is denied or things like that), the child of @code{pexec} prints an error to standard error and exits, therefore unless the standard error is gathered somehow (see @code{-u|--error}), the invoker won't be informed in such cases. And even if so, the invoker is unable to distinguish this from the case when the successfully executed process prints directly the same message to its standard error. This is not a real bug but this behavior is planned to be changed in the future. @item Another strange cases are when the child process is explicitly terminated, killed or stopped/continued. These cases are handled somehow but should be fine-tuned by the invoker in the further releases. @item The logging now is still poorish, it should also be improved (esp. to log the above unexpected shutdowns). @end itemize @node Copying This Manual @appendix Copying This Manual @menu * GNU Free Documentation License:: @end menu @include gfdl.texi @bye pexec-1.0rc8/doc/version.texi0000644000175000017500000000013511223130641014624 0ustar apalapal@set UPDATED 04 Nov 2008 @set UPDATED-MONTH Nov 2008 @set EDITION 1.0rc8 @set VERSION 1.0rc8 pexec-1.0rc8/doc/gfdl.texi0000644000175000017500000005117211104077634014074 0ustar apalapal @node GNU Free Documentation License @appendixsec GNU Free Documentation License @cindex FDL, GNU Free Documentation License @center Version 1.2, November 2002 @display Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @end display @enumerate 0 @item PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document @dfn{free} in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of ``copyleft'', which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. @item APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The ``Document'', below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as ``you''. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A ``Modified Version'' of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A ``Secondary Section'' is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The ``Invariant Sections'' are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The ``Cover Texts'' are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A ``Transparent'' copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not ``Transparent'' is called ``Opaque''. Examples of suitable formats for Transparent copies include plain @sc{ascii} without markup, Texinfo input format, La@TeX{} input format, @acronym{SGML} or @acronym{XML} using a publicly available @acronym{DTD}, and standard-conforming simple @acronym{HTML}, PostScript or @acronym{PDF} designed for human modification. Examples of transparent image formats include @acronym{PNG}, @acronym{XCF} and @acronym{JPG}. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, @acronym{SGML} or @acronym{XML} for which the @acronym{DTD} and/or processing tools are not generally available, and the machine-generated @acronym{HTML}, PostScript or @acronym{PDF} produced by some word processors for output purposes only. The ``Title Page'' means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, ``Title Page'' means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. A section ``Entitled XYZ'' means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as ``Acknowledgements'', ``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' of such a section when you modify the Document means that it remains a section ``Entitled XYZ'' according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. @item VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. @item COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. @item MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: @enumerate A @item Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. @item List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. @item State on the Title page the name of the publisher of the Modified Version, as the publisher. @item Preserve all the copyright notices of the Document. @item Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. @item Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. @item Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. @item Include an unaltered copy of this License. @item Preserve the section Entitled ``History'', Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled ``History'' in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. @item Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the ``History'' section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. @item For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. @item Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. @item Delete any section Entitled ``Endorsements''. Such a section may not be included in the Modified Version. @item Do not retitle any existing section to be Entitled ``Endorsements'' or to conflict in title with any Invariant Section. @item Preserve any Warranty Disclaimers. @end enumerate If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled ``Endorsements'', provided it contains nothing but endorsements of your Modified Version by various parties---for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. @item COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled ``History'' in the various original documents, forming one section Entitled ``History''; likewise combine any sections Entitled ``Acknowledgements'', and any sections Entitled ``Dedications''. You must delete all sections Entitled ``Endorsements.'' @item COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. @item AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an ``aggregate'' if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. @item TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled ``Acknowledgements'', ``Dedications'', or ``History'', the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. @item TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. @item FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See @uref{http://www.gnu.org/copyleft/}. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License ``or any later version'' applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. @end enumerate @c @page @c @appendixsubsec ADDENDUM: How to use this License for your documents @c @c To use this License in a document you have written, include a copy of @c the License in the document and put the following copyright and @c license notices just after the title page: @c @c @smallexample @c @group @c Copyright (C) @var{year} @var{your name}. @c Permission is granted to copy, distribute and/or modify this document @c under the terms of the GNU Free Documentation License, Version 1.2 @c or any later version published by the Free Software Foundation; @c with no Invariant Sections, no Front-Cover Texts, and no Back-Cover @c Texts. A copy of the license is included in the section entitled ``GNU @c Free Documentation License''. @c @end group @c @end smallexample @c @c If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, @c replace the ``with...Texts.'' line with this: @c @c @smallexample @c @group @c with the Invariant Sections being @var{list their titles}, with @c the Front-Cover Texts being @var{list}, and with the Back-Cover Texts @c being @var{list}. @c @end group @c @end smallexample @c @c If you have Invariant Sections without Cover Texts, or some other @c combination of the three, merge those two alternatives to suit the @c situation. @c @c If your document contains nontrivial examples of program code, we @c recommend releasing these examples in parallel under your choice of @c free software license, such as the GNU General Public License, @c to permit their use in free software. @c Local Variables: @c ispell-local-pdict: "ispell-dict" @c End: pexec-1.0rc8/VERSION0000644000175000017500000000000711223130143012542 0ustar apalapal1.0rc8 pexec-1.0rc8/NEWS0000644000175000017500000001151111253516310012202 0ustar apalapal1.0rc8: new features, changes and fixes since pexec version 1.0rc7 ================================================================== * fix: subscript excess on array bounds: unaddr.sun_path[UNIX_PATH_MAX-1]: fixed * chg: ./webdoc directory has been expunged; website is going to be maintained independently from the source of `pexec` * fix: program directory name contains the version itself. 1.0rc7: new features, changes and fixes since pexec version 1.0rc6 ================================================================== * fix: additional "message" responses are added to the hypervisor protocol. * fix: according to standards, no included at all. * fix: hypervisor mode: a possible hangup is fixed in the main hypervisor server loop (if the loadavg feature is used to limit the maximum processes, past versions would results pexec clients to hang in some cases). * fix: unix domain socket binding (in remote_control_port_bind()) fails if the socket file exists. * fix: immediate close() of hypervisor client socket -- after sending the ``close'' command -- under some weird circumstances may have caused an EPIPE on server side and therefore an abnormal server termination. This has been fixed by waiting for read availability right after sending the ``close'' command, involving the select()-based function fdwait(). * new: FIFO and LIFO queue processing in the hypervisor mode. The previous versions supported only the FIFO model. The new default queue processing from now is LIFO. * fix: signals raised by EPIPEs are ignored. * fix: hypervisor mode: small fix in the scheduling algorithm. * chg: `help2man`-compatible long help is generated by the `longhelp` library. 1.0rc6: new features, changes and fixes since pexec version 1.0rc5 ================================================================== * fix: fixes in the documentation (nodes, menus, copyright issues) * fix: some minor improvements in the documentation * fix: safe malloc, realloc and strdup calls throughout the code 1.0rc5: new features, changes and fixes since pexec version 1.0rc4 ================================================================== * chg: man page is generated from --long-help, detailed description is available as a Texinfo manual. This feature requires the `help2man` utility (http://www.gnu.org/software/help2man/). This utility is also available as a debian package. * new: documentation is available under GFDL (see ./doc/COPYING.gfdl) 1.0rc4: new features, changes and fixes since pexec version 1.0rc3 ================================================================== * new: ./configure support (autoconf) * chg: ./man directory renamed to ./doc * chg: ./html directory renamed to ./webdoc * new: texinfo documentation (./doc/pexec.texi) 1.0rc3: new features, changes and fixes since pexec version 1.0rc2 ================================================================== * new: hypervisor mode, `-H|--hypervisor` + all related functionalty * new: additional section in the manual discussing the hypervisor mode * fix: some minor fixes in the hprintf() and get_number_of_cpus() * chg: the command line option -d|--daemon has been changed to -T|--tunnel (this switch this is used only internally when executing pexec daemons via a remote shell, i.e. this change would not affect the end-user interfaces; however the same version of pexec must be installed on both sides) * new: `make deb` creates a debian package on the current architecture (this feature requies the `dpkg-deb` utility) 1.0rc2: new features, changes and fixes since pexec version 1.0rc1 ================================================================== * fix: missing options from -h|--help * new: new option `-E|--pexec-connection-variable` added * fix: code fixed under Solaris and Mac OSX operationg systems 1.0rc1: new features, changes and fixes since pexec version 1.0rc0 ================================================================== * new: support for direct execution on remote hosts 1.0rc0: new features, changes and fixes since pexec version 1.0pre2 =================================================================== * fix: mutex algorithm bugs * fix: closing unused fd's after some fork()s * new: complete remote control user interface * new: dump/save files using remote control and mutexes * new: atomic execution of commands (and scripts) using remote control and mutexes 1.0pre2: new features, changes and fixes since pexec version 1.0pre1 ==================================================================== * fix: some minor fixes in format.c * fix: code cleanup in some modules (linebuffer.[ch]: separate libraries) * new: mutex backends * new: remote control user interface 1.0pre1 ======= * The first public release of pexec. See ./README and the reference manual (./man/pexec.1) for further details. See ./INSTALL for installation tips. pexec-1.0rc8/src/0000755000175000017500000000000011253516315012300 5ustar apalapalpexec-1.0rc8/src/numhash.h0000644000175000017500000001522011103146526014111 0ustar apalapal/*****************************************************************************/ /* numhash.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Hash table for numerical (integer) keys */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2007; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #ifndef __NUMHASH_H_INCLUDED #define __NUMHASH_H_INCLUDED 1 /*****************************************************************************/ typedef struct numhashnode numhashnode; struct numhashnode { union { numhashnode *leaves; void *data; } node; int nchild; }; typedef struct { numhashnode table; int depth; int bitsize; } numhashtable; /*****************************************************************************/ /* numhash_init(): Initializes the hash table 'nt' to be capable to store 1<. */ /*****************************************************************************/ #ifndef __PEXEC_H_INCLUDED #define __PEXEC_H_INCLUDED 1 /*****************************************************************************/ #define PEXEC_VERSION "1.0rc8" #define PEXEC_LAST_MODIFICATION "2009.07.02" /*****************************************************************************/ #define PEXEC_DEFAULT_SHELL "/bin/sh" #define PEXEC_DEFAULT_RSH "/usr/bin/ssh" #define PEXEC_DEFAULT_NULLFILE "/dev/null" #define PEXEC_DEFAULT_ENVVARIABLE "PEXEC_REMOTE_PORT" #define PEXEC_DEFAULT_HYPERVISOR_SOCKET "/tmp/pexec.sock" #define PEXEC_LOAD_CHECK_PERIOD 2 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define PEXEC_MODE_DEFAULT 0 #define PEXEC_MODE_DAEMON 1 #define PEXEC_MODE_REMOTECONTROL 2 #define PEXEC_MODE_HYPERVISOR 3 #define PEXEC_REMOTE_STATUS 1 #define PEXEC_REMOTE_LOCK 2 #define PEXEC_REMOTE_UNLOCK 3 #define PEXEC_REMOTE_DUMP 4 #define PEXEC_REMOTE_SAVE 5 #define PEXEC_REMOTE_ATOMIC 6 #define PEXEC_MNP_AUTO -1 #define PEXEC_MNP_MANAGED -2 #define PEXEC_MNP_NCPU -3 /*****************************************************************************/ typedef struct child child; typedef struct { int pid; /* pid (non-zero for real remote) */ int fhsend,fhrecv; /* stdin/stdout of the remote shell */ int num_processes; /* max num of processes or 0 (see V) */ int achild; /* active associated children */ int estatus; /* execution status (if managed) */ linebuffer lrsh; /* line buffer for fhrecv */ } remoteshell; struct child { child *prev,*next; /* list chain pointers */ int id; /* internal child identifier */ int pid; /* PID of the child */ remoteshell *rs; /* remote shell pointer */ int fdstdout; /* standard output pipe if collected */ linebuffer lout; /* stdout line buffer if reformatted */ int fdstderr; /* standard error pipe, if collected */ linebuffer lerr; /* stderr line buffer if reformatted */ }; typedef struct { int is_shell; char **argv; /* concat'ed with spaces if is_shell is true */ int argc; } command; typedef struct { char *hostspec; int num_processes; } remotehost; typedef struct { char *name; int no_touch_std; command c; int id; int status; } parameter; typedef struct client client; struct client { client *prev,*next; /* linked list pointers */ int peer; /* socket of peer (server) */ linebuffer lcli; /* main line buffer */ int status; /* some status, for arbitarary purp. */ }; typedef struct { int qid; /* queue id */ void *data; /* qid >= 0: *rsh, otherwise *client */ } pendingclient; typedef struct imutex imutex; struct imutex { imutex *prev,*next; char *name; int state; pendingclient *pclients; int npclient; }; typedef struct dqueue dqueue; struct dqueue { dqueue *prev,*next; client *qclient; int id; }; typedef struct { FILE *fwlog; int loglevel; } logdata; typedef struct { char *in, *out, *err; FILE *fwout; char *formatout; FILE *fwerr; char *formaterr; int omit_newlines; char *envvarname; char *shell; char *rsh,*rshcmd,**rshargs; int fallback_to_die; logdata *log; } paralleldata; typedef struct { child *childlist; int achild; int sock; /* remote control listen socket */ int hsck; /* hypervisor connection socket */ client *clientlist; imutex *imutexlist; dqueue *dqueuelist; int iqueue; int nfinished,npending,nparam; time_t t0; } parallelstatus; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ typedef struct request request; struct request { client *cl; }; typedef struct { client *clientlist; /* all clients connected */ int num_processes; /* max number of processes */ int use_load; /* 0, 1 or 2: 1, 5 or 15 min loadvg */ int use_fifo; /* use FIFO queuing insead of LIFO */ request *requests; /* list of requests */ int nrequest; /* total requests */ int nrunning; /* total running jobs */ } hypervisorstatus; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ typedef struct { int signal; int pid; int exitstatus; int exitsignal; } signalinfo; /*****************************************************************************/ #endif /*****************************************************************************/ pexec-1.0rc8/src/linebuffer.h0000644000175000017500000000406411103146567014600 0ustar apalapal/*****************************************************************************/ /* linebuffer.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2007; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Functions related to buffered line reading, from arbitrary streams */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #ifndef __LINEBUFFER_H_INCLUDED #define __LINEBUFFER_H_INCLUDED 1 /*****************************************************************************/ typedef struct { char *buffer; size_t length; } linebuffer; /*****************************************************************************/ int linebuffer_reset(linebuffer *lb); int linebuffer_free(linebuffer *lb); int linebuffer_concatenate(linebuffer *lb,char *buff,size_t size); char * linebuffer_read_line(int fd,linebuffer *lb,int timeout); char * linebuffer_fetch(linebuffer *lb); char * linebuffer_flush(linebuffer *lb); /*****************************************************************************/ #endif /*****************************************************************************/ pexec-1.0rc8/src/iof.h0000644000175000017500000000567011103146655013236 0ustar apalapal/*****************************************************************************/ /* iof.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Tools for high-level file manipulation (I/O with f*() functions). */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2004, Pal, A. (apal@szofi.elte.hu). */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #ifndef __IOF_H_INCLUDED #define __IOF_H_INCLUDED 1 /* freadline(): Reads one line (terminated by EOL, 012) from the stream 'fr' and stores it in a newly allocated string which is returned by the function. If the file stream is over, the function returns NULL. The returned string is zero-terminated and if the line read was not the last one, it includes the trailing EOL character. The string returned can be released with free(). */ char * freadline(FILE *fr); /* freadline_bs(): Reads one or more lines from the stream 'fr', and concates them if the ending is a backslash-EOL ("\\\n", 0114 0012) character pair. The function returns a pointer pointing to the newly allocated string with the line read. This string is zero-terminated, includes the last trailing EOL character and all internal backslash-EOLs are removed. The string returned can be released with free(). */ char * freadline_bs(FILE *fr); /* fopenread(), fopenwrite(): Opens the file 'name' for reading or writing in binary mode. If the name was "-" or NULL, the functions return stdin or stdout respectively. */ FILE * fopenread(char *name); FILE * fopenwrite(char *name); /* fcloseread(), fclosewrite(): Clses the stream 'fr' if it is not stdin or stdout. Can be used with the functions fopenread()/fopenwrite(). */ int fcloseread(FILE *fr); int fclosewrite(FILE *fw); /*****************************************************************************/ #endif /*****************************************************************************/ pexec-1.0rc8/src/Makefile.in0000644000175000017500000000146511111617576014357 0ustar apalapalSHELL = /bin/sh CC=@CC@ TARGETS=pexec CFLAGS=@CFLAGS@ XLIBS=@XLIBS@ all: $(TARGETS) MOD_PEXEC=\ tokenize.o \ iof.o \ numhash.o \ fifo.o \ format.o \ str.o \ longhelp.o \ linebuffer.o .PHONY: all clean tokenize.o: tokenize.c tokenize.h $(CC) $(CFLAGS) -c tokenize.c iof.o: iof.c iof.h $(CC) $(CFLAGS) -c iof.c numhash.o: numhash.c numhash.h $(CC) $(CFLAGS) -c numhash.c fifo.o: fifo.c fifo.h $(CC) $(CFLAGS) -c fifo.c format.o: format.c format.h $(CC) $(CFLAGS) -c format.c str.o: str.c str.h $(CC) $(CFLAGS) -c str.c linebuffer.o: linebuffer.c linebuffer.h $(CC) $(CFLAGS) -c linebuffer.c longhelp.o: longhelp.c longhelp.h $(CC) $(CFLAGS) -c longhelp.c pexec: pexec.c $(MOD_PEXEC) $(CC) $(CFLAGS) -o pexec pexec.c $(MOD_PEXEC) $(XLIBS) clean: rm -f $(TARGETS) *.o pexec-1.0rc8/src/fifo.h0000644000175000017500000000733011103146750013373 0ustar apalapal/*****************************************************************************/ /* fifo.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Simple FIFO (first-in-first-out) implementation. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2007; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #ifndef __FIFO_H_INCLUDED #define __FIFO_H_INCLUDED 1 /*****************************************************************************/ typedef struct { unsigned char *buffer; size_t size; size_t rpnt,wrts; } fifo; /*****************************************************************************/ /* fifo_init(): This function initializes the FIFO 'f'. */ int fifo_init(fifo *f); /* fifo_write(): This function pushes 'size' bytes from the buffer 'buffer' to the FIFO 'f'. The function returns 0 if the call was successful, otherwise it returns a nonzero value. */ int fifo_write(fifo *f,void *buffer,size_t size); /* fifo_available(): This function returns the number of available bytes to read in the FIFO. */ size_t fifo_available(fifo *f); /* fifo_read(): This function tries to read 'size' bytes from the FIFO 'f' into the buffer 'buffer'. The number of bytes actually read is returned, which can be less than 'size' if the desired amount of data are not available (i.e. fifo_available() is less than 'size'). */ size_t fifo_read(fifo *f,void *buffer,size_t size); /* fifo_skip(): Skips the next 'size' bytes from the FIFO. Equivalent to fifo_read(f,NULL,size); */ size_t fifo_skip(fifo *f,size_t size); /* fifo_peek(): This function tries to read 'size' bytes from the FIFO 'f' into the buffer 'buffer' but does not remove the data from the FIFO. */ size_t fifo_peek(fifo *f,void *buffer,size_t size); /* fifo_flush(): This function copies all available data from FIFO to 'buffer'. The number of bytes copied is returned (which can be zero if the FIFO is empty). Note that there should be enough space in 'buffer' to store the appropriate amount of data (i.e. which is fifo_available()). */ size_t fifo_flush(fifo *f,void *buffer); /* fifo_reduce(): This function reduces the memory usage of the FIFO to the minimal. */ size_t fifo_reduce(fifo *f); /* fifo_free(): This function releases and resets the FIFO 'f'. All data in the FIFO are lost. The FIFO object 'f' can be re-used as an empty one without initialization: there is no need to call fifo_init() before pushing new data into the FIFO. */ int fifo_free(fifo *f); /*****************************************************************************/ #endif /*****************************************************************************/ pexec-1.0rc8/src/tokenize.h0000644000175000017500000000764011103146230014275 0ustar apalapal/*****************************************************************************/ /* tokenize.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Standalone library for basic text processing. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2001, 2004, Pal, A. (apal@szofi.elte.hu). */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #ifndef __TOKENIZE_H_INCLUDED #define __TOKENIZE_H_INCLUDED 1 /*****************************************************************************/ /* remove_newlines_and_comments(): Removes newlines (012 and 015) and comments (all data after a #) from the string 'buff'. */ void remove_newlines_and_comments(char *buff); /* remove_spaces_and_comments(): Removes whitespaces (011, 012, 015 and 040) and comments from the string 'buff'. */ void remove_spaces_and_comments(char *buff); /* remove_spaces(): Removes whitespaces (011, 012, 015 and 040) from the string 'buff'. */ void remove_spaces(char *buff); /* remove_quote(): Removes all double quotation marks (042) from the string 'buff'. */ void remove_quotes(char *buff); /* char_is_space(): Returns a nonzero value if 'c' is a whitespace character, otherwise 0. */ int char_is_space(int c); /* tokenize_spaces(): Tokenizes the string 'buff', where tokens are delimited by one or more whitespaces. The string 'buff' are modified and the pointers in the array 'tokens' will point to the tokens stored in the newly modified string. After each token, a trailing zero (000) are put. The number of tokens are maximalized by the argument 'max'. The function returns the number of tokens and the last element of the array 'tokens' is set to NULL: tokens[max]==NULL (so, note that the array 'tokens' should be declared somehow like char *tokens[max+1]). All parts of buff are treated as one token if it is put between double quotation marks (042) and after the whole process, the quotation marks are removed (from the begining and the end of the tokens). */ int tokenize_spaces(char *buff,char **tokens,int max); char ** tokenize_spaces_dyn(char *buff); /* tokenize_char(): Tokenizes the string 'buff', where tokens are delimited by a single character given in the argument 'tchar'. There's no effect of double- quotation marks, spaces or any other special characters. The string 'buff' is modified and the pointers in the array 'tokens' point to the tokens in the newly modified string. After each token, a trailing zero (000) are put. The number of tokens are maximalized by the argument 'max'. */ int tokenize_char(char *buff,char **tokens,int tchar,int max); char ** tokenize_char_dyn_wwt(char *buff,int tchar,int is_terminate); char ** tokenize_char_dyn(char *buff,int tchar); /*****************************************************************************/ #endif /*****************************************************************************/ pexec-1.0rc8/src/format.c0000644000175000017500000001522011104653136013732 0ustar apalapal/*****************************************************************************/ /* format.c */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Simple *printf()-like implementation for arbitrary string formatting */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2007; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #include #include #include #include #include #ifdef HAVE_LIBINTL_H #include #define _(string) gettext(string) #else #define _(string) string #endif #include "format.h" #define FORMAT_ABORT_ON_MALLOC #ifdef FORMAT_ABORT_ON_MALLOC #define realloc_check(ptr,size) \ do \ { if ( ptr==NULL && size>0 ) \ { fprintf(stderr,"format.c: %s.\n",_("memory exhausted"));\ abort(); \ } \ } while(0) #else #define realloc_check(ptr,size) #endif #define malloc_check(ptr) realloc_check(ptr,1) /*****************************************************************************/ #define BLOCK_FORMAT 256 #define FORMAT_ABORT_ON_MALLOC /*****************************************************************************/ static int format_int_realloc(char **out,int *len,int *alen,int req) { if ( (*len)+req > (*alen) ) { req+=(*len); *alen = BLOCK_FORMAT*((req+BLOCK_FORMAT-1)/BLOCK_FORMAT); *out = realloc(*out,*alen); realloc_check(*out,*alen); } return(0); } static int format_get_parameters(char *format,int *d1,int *d2,int *fmt,char **next) { int set; char *fstart; fstart=format; set=0; while ( isspace((int)(*format)) ) format++; if ( *format && sscanf(format,"%d",d1)==1 ) { set|=1; while ( *format=='-' || isdigit((int)(*format)) ) format++; while ( isspace((int)(*format)) ) format++; } if ( *format=='.' ) format++; while ( isspace((int)(*format)) ) format++; if ( *format && sscanf(format,"%d",d2)==1 ) { set|=2; while ( *format=='-' || isdigit((int)(*format)) ) format++; while ( isspace((int)(*format)) ) format++; } if ( islower((int)(*format)) ) { *fmt=(int)(*format); format++; if ( next != NULL ) *next=format; return(set); } else { if ( next != NULL ) *next=format; return(-1); } } /* call: format_check_if_formatted(fmt,"..."); */ int format_check_if_formatted(char *format,char *fchars) { int fmt,d1,d2,set; char *next; while ( *format ) { if ( *format=='%' && *(format+1) ) { format++; set=format_get_parameters(format,&d1,&d2,&fmt,&next); if ( set>=0 ) format=next; else if ( *format=='%' ) format++; if ( strchr(fchars,fmt) != NULL ) return(1); } else format++; } return(0); } static int format_int_add_string(char **out,int *len,int *alen,int set,int d1,char *vs) { int slen,req; slen=strlen(vs); if ( (set & 1) && abs(d1)>slen ) req=abs(d1); else req=slen; format_int_realloc(out,len,alen,req); if ( (set & 1) && d1>slen ) { memset((*out)+(*len),32,d1-slen); strcpy((*out)+(*len)+(d1-slen),vs); *len+=req; } else if ( (set & 1) && -d1>slen ) { strcpy((*out)+(*len),vs); memset((*out)+(*len)+slen,32,(-d1)-slen); (*out)[(*len)+req]=0; *len+=req; } else { strcpy((*out)+(*len),vs); *len+=slen; } return(0); } /* call: format_replace(fmt,esc,'c1',TYPE1,value1,'c2',TYPE2,value2,...,0); */ char *format_replace(char *format,int is_escape,...) { char *out,*fstart,*next; int len,alen,set,d1,d2,fmt,chr,type; va_list ap; alen=BLOCK_FORMAT; out=(char *)malloc(alen); malloc_check(out); out[0]=0; len=0; while ( *format ) { if ( is_escape && *format=='\\' ) { format++; format_int_realloc(&out,&len,&alen,1); switch ( *format ) { case 'n': out[len]='\n',len++; break; case 't': out[len]='\t',len++; break; case 'r': out[len]='\r',len++; break; case 0: out[len]='\\',len++; break; default: out[len]=*format,len++; } if ( *format ) format++; } else if ( *format=='%' && *(format+1) ) { fstart=format; format++; set=format_get_parameters(format,&d1,&d2,&fmt,&next); /* valid printf-like format */ if ( set>=0 ) { va_start(ap,is_escape); while ( (chr=va_arg(ap,int))>0 ) { type=va_arg(ap,int); if ( chr==fmt ) break; else { switch ( type ) { case FORMAT_INTEGER: (void)va_arg(ap,int); break; case FORMAT_STRING: (void)va_arg(ap,char *); break; } } } /* valid printf-like format and found in the list */ if ( chr>0 ) { int vi; char *vs; char buff[256],sbuff[16]; switch ( type ) { case FORMAT_INTEGER: vi=va_arg(ap,int); if ( (set & 2) && d2>0 ) { if ( d2>128 ) d2=128; sprintf(sbuff,"%%.%dd",d2); sprintf(buff,sbuff,vi); } else sprintf(buff,"%d",vi); format_int_add_string(&out,&len,&alen,set,d1,buff); break; case FORMAT_STRING: vs=va_arg(ap,char *); if ( vs == NULL ) vs="(null)"; format_int_add_string(&out,&len,&alen,set,d1,vs); break; } format=next; } /* valid but not in the list: */ else { format--; /* go back to the percent mark */ format_int_realloc(&out,&len,&alen,next-format); memcpy(out+len,format,next-format); len+=next-format; format=next; } va_end(ap); } else if ( (*format)=='%' ) { format++; format_int_realloc(&out,&len,&alen,1); out[len]='%'; len++; } else { format_int_realloc(&out,&len,&alen,2); out[len]='%'; out[len+1]=(*format); format++; len+=2; } } else { format_int_realloc(&out,&len,&alen,1); out[len]=*format,len++; format++; } }; format_int_realloc(&out,&len,&alen,1); out[len]=0; return(out); } /*****************************************************************************/ pexec-1.0rc8/src/format.h0000644000175000017500000000406411103146714013741 0ustar apalapal/*****************************************************************************/ /* format.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Simple *printf()-like implementation for arbitrary string formatting */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2007; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #ifndef __FORMAT_H_INCLUDED #define __FORMAT_H_INCLUDED 1 /*****************************************************************************/ #define FORMAT_INTEGER 1 #define FORMAT_STRING 2 /*****************************************************************************/ /* call: format_check_if_formatted(fmt,"..."); */ int format_check_if_formatted(char *format,char *fchars); /* call: format_replace(fmt,esc,'c1',TYPE1,value1,'c2',TYPE2,value2,...,0); */ char * format_replace(char *format,int is_escape,...); /*****************************************************************************/ #endif /* #ifndef __FORMAT_H_INCLUDED */ /*****************************************************************************/ pexec-1.0rc8/src/longhelp.h0000644000175000017500000000505011113074165014256 0ustar apalapal/*****************************************************************************/ /* longhelp.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2008; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Functions for creating nice ``long helps'' */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #ifndef __LONGHELP_H_INCLUDED #define __LONGHELP_H_INCLUDED 1 /*****************************************************************************/ /* these are specific terms which are supported by the ``help2man'' utility. */ #define LONGHELP_OPTIONS { "Options:", NULL } #define LONGHELP_EXAMPLES { "Examples:", NULL } /*****************************************************************************/ typedef struct { char *options; char *description; } longhelp_entry; /*****************************************************************************/ /* longhelp_fprint(): Prints the (NULL,NULL)-terminated longhelp_entry array `entries` to the file stream referred by `fw`. The output is formatted for `width` width, if it is positive, ignored at all if `width` is zero and calculated automatically if it is negative (in this case, if `fw` refers to a terminal, the width is derived automatically from the terminal window size argument, otherwise the formatting is ignored). */ int longhelp_fprint(FILE *fw,longhelp_entry *entries,int flags,int width); /*****************************************************************************/ #endif /*****************************************************************************/ pexec-1.0rc8/src/fifo.c0000644000175000017500000001257411104653164013377 0ustar apalapal/*****************************************************************************/ /* fifo.c */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Simple FIFO (first-in-first-out) implementation. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2007; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #include #include #include #ifdef HAVE_LIBINTL_H #include #define _(string) gettext(string) #else #define _(string) string #endif #include "fifo.h" #define FIFO_ABORT_ON_MALLOC #ifdef FIFO_ABORT_ON_MALLOC #define realloc_check(ptr,size) \ do \ { if ( ptr==NULL && size>0 ) \ { fprintf(stderr,"fifo.c: %s.\n",_("memory exhausted"));\ abort(); \ } \ } while(0) #else #define realloc_check(ptr,size) #endif #define malloc_check(ptr) realloc_check(ptr,1) /*****************************************************************************/ int fifo_init(fifo *f) { f->buffer=NULL; f->size=0; f->rpnt=0; f->wrts=0; return(0); } int fifo_free(fifo *f) { if ( f->buffer != NULL ) free(f->buffer); fifo_init(f); return(0); } /*****************************************************************************/ #define FIFO_FRAGSIZE 256 int fifo_write(fifo *f,void *vbuffer,size_t size) { unsigned char *buffer=(unsigned char *)vbuffer; size_t msize,wpnt,osize; if ( size > f->size-f->wrts ) { osize=f->size; f->size=f->wrts+size+FIFO_FRAGSIZE-1; f->size=FIFO_FRAGSIZE*(f->size/FIFO_FRAGSIZE); f->buffer=realloc(f->buffer,f->size); realloc_check(f->buffer,f->size); if ( f->rpnt+f->wrts > osize ) { memmove(f->buffer+f->rpnt+(f->size-osize),f->buffer+f->rpnt,osize-f->rpnt); f->rpnt+=(f->size-osize); } } while ( size>0 ) { wpnt=f->rpnt+f->wrts; if ( wpnt>=f->size ) wpnt-=f->size; msize=f->size-wpnt; if ( sizebuffer+wpnt,buffer,msize); buffer+=msize; } f->wrts+=msize; size-=msize; }; /* if ( f->rpnt <= f->wpnt ) { if ( f->size-f->wpnt >= size ) { if ( buffer != NULL ) memcpy(f->buffer+f->wpnt,buffer,size); f->wpnt+=size; } else if ( f->rpnt > (size-(f->size-f->wpnt)) ) { if ( buffer != NULL ) { if ( f->wpnt < f->size ) memcpy(f->buffer+f->wpnt,buffer,f->size-f->wpnt); memcpy(f->buffer,buffer+(f->size-f->wpnt),size-(f->size-f->wpnt)); } f->wpnt=size-(f->size-f->wpnt); } else { f->size=(f->wpnt-f->rpnt)+size+FIFO_FRAGSIZE; f->size=FIFO_FRAGSIZE*(f->size/FIFO_FRAGSIZE); f->buffer=realloc(f->buffer,f->size); if ( f->size-f->wpnt >= size ) { if ( buffer != NULL ) memcpy(f->buffer+f->wpnt,buffer,size); f->wpnt+=size; } else { if ( buffer != NULL ) { if ( f->wpnt < f->size ) memcpy(f->buffer+f->wpnt,buffer,f->size-f->wpnt); memcpy(f->buffer,buffer+(f->size-f->wpnt),size-(f->size-f->wpnt)); } f->wpnt=size-(f->size-f->wpnt); } } } else if ( f->rpnt-f->wpnt > size ) { if ( buffer != NULL ) memcpy(f->buffer+f->wpnt,buffer,size); f->wpnt+=size; } else { size_t oldsize,diff; oldsize=f->size; f->size=(f->size-(f->rpnt-f->wpnt))+size+FIFO_FRAGSIZE; f->size=FIFO_FRAGSIZE*(f->size/FIFO_FRAGSIZE); f->buffer=realloc(f->buffer,f->size); diff=f->size-oldsize; memmove(f->buffer+f->rpnt+diff,f->buffer+f->rpnt,oldsize-f->rpnt); f->rpnt+=diff; if ( buffer != NULL ) memcpy(f->buffer+f->wpnt,buffer,size); f->wpnt+=size; } */ return(0); } size_t fifo_available(fifo *f) { return(f->wrts); } size_t fifo_read(fifo *f,void *vbuffer,size_t size) { unsigned char *buffer=(unsigned char *)vbuffer; size_t rsize,rsize0,msize; if ( sizewrts ) rsize=size; else rsize=f->wrts; rsize0=rsize; while ( rsize>0 ) { msize=f->size-f->rpnt; if ( rsizebuffer+f->rpnt,msize); buffer+=msize; } f->rpnt+=msize; f->wrts-=msize; if ( f->rpnt >= f->size ) f->rpnt=0; rsize-=msize; } return(rsize0); } size_t fifo_skip(fifo *f,size_t size) { return(fifo_read(f,NULL,size)); } size_t fifo_peek(fifo *f,void *vbuffer,size_t size) { size_t rpnt,wrts,ret; rpnt=f->rpnt; wrts=f->wrts; ret=fifo_read(f,vbuffer,size); f->rpnt=rpnt; f->wrts=wrts; return(ret); } size_t fifo_flush(fifo *f,void *vbuffer) { size_t size; size=fifo_available(f); if ( size>0 ) fifo_read(f,vbuffer,size); return(size); } /*****************************************************************************/ pexec-1.0rc8/src/iof.c0000644000175000017500000000702011104653037013216 0ustar apalapal/*****************************************************************************/ /* iof.c */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Tools for high-level file manipulation (I/O with f*() functions). */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* See function prototypes and the usage of the functions in iof.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2004, Pal, A. (apal@szofi.elte.hu). */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #include #include #include #ifdef HAVE_LIBINTL_H #include #define _(string) gettext(string) #else #define _(string) string #endif #include "iof.h" #define IOF_ABORT_ON_MALLOC #ifdef IOF_ABORT_ON_MALLOC #define realloc_check(ptr,size) \ do \ { if ( ptr==NULL && size>0 ) \ { fprintf(stderr,"iof.c: %s.\n",_("memory exhausted"));\ abort(); \ } \ } while(0) #else #define realloc_check(ptr,size) #endif #define malloc_check(ptr) realloc_check(ptr,1) /*****************************************************************************/ char *freadline(FILE *fr) { char *ret,buff[256]; ret=NULL; if ( feof(fr) ) return(NULL); while ( 1 ) { if ( fgets(buff,255,fr)==NULL ) break; if ( ret==NULL ) ret=(char *)malloc(strlen(buff)+1),ret[0]=0; else ret=(char *)realloc(ret,strlen(ret)+strlen(buff)+1); malloc_check(ret); strcat(ret,buff); if ( ret[strlen(ret)-1]==10 ) break; } return(ret); } char *freadline_bs(FILE *fr) { char *ret,*wr; int n; ret=NULL; while ( 1 ) { wr=freadline(fr); if ( wr==NULL ) return(ret); else { if ( ret==NULL ) ret=wr; else { ret=realloc(ret,strlen(ret)+strlen(wr)+1); malloc_check(ret); strcat(ret,wr); free(wr); } n=strlen(ret); if ( n>=2 ) { if ( ret[n-1]==0x0A && ret[n-2]=='\\' ) ret[n-2]=0; else return(ret); } else return(ret); } }; return(NULL); } /*****************************************************************************/ FILE *fopenread(char *name) { FILE *fr; if ( name==NULL ) fr=stdin; else if ( strcmp(name,"-")==0 ) fr=stdin; else fr=fopen(name,"rb"); return(fr); } FILE *fopenwrite(char *name) { FILE *fw; if ( name==NULL ) fw=stdout; else if ( strcmp(name,"-")==0 ) fw=stdout; else fw=fopen(name,"wb"); return(fw); } int fcloseread(FILE *fr) { if ( fileno(fr) != fileno(stdin) ) fclose(fr); return(0); } int fclosewrite(FILE *fw) { if ( fileno(fw) != fileno(stdout) ) fclose(fw); return(0); } /*****************************************************************************/ pexec-1.0rc8/src/longhelp.c0000644000175000017500000001212011113067723014247 0ustar apalapal/*****************************************************************************/ /* longhelp.c */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2008; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Functions for creating nice ``long helps''. Output is intented to be */ /* compatible with the `help2man` utility. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #include #include #include #include #include #include #include #include "longhelp.h" #ifdef HAVE_LIBINTL_H #include #define _(string) gettext(string) #else #define _(string) string #endif /*****************************************************************************/ #define LONGHELP_ABORT_ON_MALLOC #ifdef LONGHELP_ABORT_ON_MALLOC #define realloc_check(ptr,size) \ do \ { if ( ptr==NULL && size>0 ) \ { fprintf(stderr,"tokenize.c: %s.\n",_("memory exhausted"));\ abort(); \ } \ } while(0) #else #define realloc_check(ptr,size) #endif #define malloc_check(ptr) realloc_check(ptr,1) /*****************************************************************************/ static void remove_quotes(char *buff) { int k; while ( *buff ) { for ( k=0 ; buff[k]=='"' ; ) k++; if ( k ) memmove(buff,buff+k,strlen(buff)+1-k); else buff++; } } static int char_is_space(int c) { if ( c==32 || c==13 || c==10 || c==9 ) return(1); else return(0); } static char **tokenize_spaces_dyn(char *buff) { int intoken,inquota,i,n,nm; char **rtokens; nm=16; rtokens=(char **)malloc(sizeof(char *)*nm); malloc_check(rtokens); if ( rtokens==NULL ) return(NULL); intoken=0,inquota=0;n=0; while ( *buff ) { if ( ( ! char_is_space(*buff) ) && ! intoken ) { rtokens[n]=buff; intoken=!0,inquota=0;n++; if ( *buff=='"' ) inquota=!0; buff++; if ( n>=nm-1 ) { nm+=16; rtokens=(char **)realloc(rtokens,sizeof(char *)*nm); realloc_check(rtokens,sizeof(char *)*nm); } } else if ( intoken && ( (char_is_space(*buff) && inquota) || (!char_is_space(*buff)) ) ) { if ( *buff=='"' ) inquota=!inquota; buff++; } else if ( intoken && ! inquota && char_is_space(*buff) ) { *buff=0,buff++; intoken=0; } else buff++; }; rtokens[n]=NULL; for ( i=0 ; i0 ) l++; if ( l>width-p ) { fprintf(fw,"\n"); for ( i=0 ; i0 ) l--; w=0; p=fpad; } if ( w>0 ) fprintf(fw," %s",cmd[n]); else fprintf(fw,"%s",cmd[n]); p+=l; w++; }; fprintf(fw,"\n"); if ( cmd != NULL ) free(cmd); free(dd); } return(0); } int longhelp_fprint_entry(FILE *fw,longhelp_entry *entry,int flags,int width) { int w,fpad,pad; w=fprintf(fw," %s",entry->options); pad=(w+4+7)&(~7); fpad=16; if ( width>0 ) longhelp_fprint_description(fw,width,w,fpad,pad,entry->description); else { for ( ; wdescription); } return(0); } int longhelp_fprint(FILE *fw,longhelp_entry *entry,int flags,int width) { int lcnt; if ( width<0 && isatty(fileno(fw)) ) { struct winsize ws; if ( ! ioctl(fileno(fw),TIOCGWINSZ,&ws) ) width=ws.ws_col-1; else width=0; } lcnt=0; while ( entry != NULL && entry->options != NULL ) { if ( entry->description == NULL ) { if ( lcnt>0 ) { fprintf(fw,"\n"); } fprintf(fw,"%s\n", entry->options); lcnt=0; } else { longhelp_fprint_entry(fw,entry,flags,width); lcnt++; } entry++; } return(0); } /*****************************************************************************/ pexec-1.0rc8/src/linebuffer.c0000644000175000017500000001144411104653155014570 0ustar apalapal/*****************************************************************************/ /* linebuffer.c */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2007; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Functions related to buffered line reading, from arbitrary streams */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #include #include #include #include #include #include #include "linebuffer.h" #ifdef HAVE_LIBINTL_H #include #define _(string) gettext(string) #else #define _(string) string #endif #define LINEBUFFER_ABORT_ON_MALLOC #ifdef LINEBUFFER_ABORT_ON_MALLOC #define realloc_check(ptr,size) \ do \ { if ( ptr==NULL && size>0 ) \ { fprintf(stderr,"linebuffer.c: %s.\n",_("memory exhausted"));\ abort(); \ } \ } while(0) #else #define realloc_check(ptr,size) #endif #define malloc_check(ptr) realloc_check(ptr,1) /*****************************************************************************/ int linebuffer_reset(linebuffer *lb) { lb->buffer=NULL; lb->length=0; return(0); } int linebuffer_free(linebuffer *lb) { if ( lb->buffer != NULL ) free(lb->buffer); linebuffer_reset(lb); return(0); } int linebuffer_concatenate(linebuffer *lb,char *buff,size_t size) { if ( buff==NULL || size<=0 ) return(0); lb->buffer=(char *)realloc(lb->buffer,lb->length+size+1); malloc_check(lb->buffer); memcpy(lb->buffer+lb->length,buff,size); lb->length+=size; lb->buffer[lb->length]=0; return(0); } char * linebuffer_read_line(int fd,linebuffer *lb,int timeout) { char *line,*eoc,buff[256]; int length,n; struct timeval tv,*ptv,tn; fd_set set; if ( timeout>0 ) { tv.tv_sec=timeout; tv.tv_usec=0; ptv=&tv; } else ptv=NULL; while ( 1 ) { if ( lb->buffer != NULL ) eoc=memchr(lb->buffer,10,lb->length); else eoc=NULL; if ( eoc != NULL ) { length=(int)(eoc-lb->buffer); line=(char *)malloc(1+length); malloc_check(line); memcpy(line,lb->buffer,length); line[length]=0; length++; if ( length>=lb->length ) { free(lb->buffer); lb->buffer=NULL; lb->length=0; } else { memmove(lb->buffer,lb->buffer+length,lb->length-length); lb->length -= length; } return(line); } FD_ZERO(&set); FD_SET(fd,&set); tn.tv_sec=0; tn.tv_usec=0; select(fd+1,&set,NULL,NULL,&tn); if ( FD_ISSET(fd,&set) ) { n=read(fd,buff,256); if ( n>0 ) linebuffer_concatenate(lb,buff,n); else if ( ! ( n<0 && errno==EINTR ) ) return(NULL); } else { FD_ZERO(&set); FD_SET(fd,&set); select(fd+1,&set,NULL,NULL,ptv); if ( FD_ISSET(fd,&set) ) { n=read(fd,buff,256); if ( n>0 ) linebuffer_concatenate(lb,buff,n); else if ( ! ( n<0 && errno==EINTR ) ) return(NULL); } else return(NULL); } } return(NULL); /* unreachable */ } char *linebuffer_fetch(linebuffer *lb) { char *eoc,*line; size_t length; if ( lb->buffer != NULL && lb->length>0 ) eoc=memchr(lb->buffer,10,lb->length); else eoc=NULL; if ( eoc != NULL ) { length=(size_t)(eoc-lb->buffer); line=(char *)malloc(1+length); malloc_check(line); memcpy(line,lb->buffer,length); line[length]=0; length++; if ( length>=lb->length ) { free(lb->buffer); lb->buffer=NULL; lb->length=0; } else { memmove(lb->buffer,lb->buffer+length,lb->length-length); lb->length -= length; } return(line); } else return(NULL); } char * linebuffer_flush(linebuffer *lb) { char *line; size_t length; if ( lb->buffer != NULL && lb->length>0 ) { line=(char *)malloc(lb->length+1); malloc_check(line); length=lb->length; memcpy(line,lb->buffer,length); line[length]=0; free(lb->buffer); linebuffer_reset(lb); return(line); } else { if ( lb->buffer != NULL ) free(lb->buffer); linebuffer_reset(lb); return(NULL); } } /*****************************************************************************/ pexec-1.0rc8/src/list.h0000644000175000017500000001325011106060656013424 0ustar apalapal/*****************************************************************************/ /* list.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Simple set of macros for manipulating linked and doubly linked lists. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2006, 2008; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #ifndef __LIST_H_INCLUDED #define __LIST_H_INCLUDED 1 /* Each object used in the linked list shoud contain two fields with the type of a pointer to the object itself. These pointers are then used to define the links between the list elements. Both in the case of the linked list and doubly-linked list, the object must contain a 'prev' and 'next' field. To traverse on the list, one can use the for ( ; ; ) loop directly: for ( o=firstpointer ; o != NULL ; o=o->next ) { ... }; for ( o=lastpointer ; o != NULL ; o=o->prev ) { ... }; (the latter one can only be used in doubly-linked lists). */ #define __LIST_PREV prev #define __LIST_NEXT next #ifndef __LIST_MALLOC #define __LIST_MALLOC malloc #endif #ifndef __LIST_FREE #define __LIST_FREE free #endif /*****************************************************************************/ /* list_new(): Simple wrapper to malloc/calloc. */ #define list_new(type) ((type *)__LIST_MALLOC(sizeof(type))) /* list_insert_first(): Inserts the object 'object' to the beginning of the list of which first element is 'firstpointer'. */ #define list_insert_first(firstpointer,object) \ do \ { (object)->__LIST_NEXT=(firstpointer); \ (object)->__LIST_PREV=NULL; \ if ( (firstpointer) != NULL ) \ (firstpointer)->__LIST_PREV=(object); \ (firstpointer)=(object); \ } while ( 0 ) /* list_remove(): Deletes the object 'object' from the list of which first element is 'firstpointer'. */ #define list_remove(firstpointer,object) \ do \ { if ( (object)->__LIST_NEXT != NULL ) \ (object)->__LIST_NEXT->__LIST_PREV=(object)->__LIST_PREV; \ if ( (object)->__LIST_PREV != NULL ) \ (object)->__LIST_PREV->__LIST_NEXT=(object)->__LIST_NEXT; \ else \ (firstpointer)=(object)->__LIST_NEXT; \ } while ( 0 ) /* list_delete(): Like list_remove(), followed by a free() to the ``object'' pointer. */ #define list_delete(firstpointer,object) \ do \ { list_remove((firstpointer),(object)); \ __LIST_FREE(object); \ } while ( 0 ) \ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* dlist_new(): Simple wrapper to malloc/calloc. */ #define dlist_new(type) ((type *)__LIST_MALLOC(sizeof(type))) /* dlist_insert_first(): Inserts the object 'object' to the beginning of the list of which first element is 'firstpointer' and last element is 'lastpointer': */ #define dlist_insert_first(firstpointer,lastpointer,object) \ do \ { (object)->__LIST_NEXT=(firstpointer); \ (object)->__LIST_PREV=NULL; \ if ( (firstpointer) != NULL ) \ (firstpointer)->__LIST_PREV=(object); \ (firstpointer)=(object); \ if ( (lastpointer) == NULL ) \ (lastpointer)=(object); \ } while ( 0 ) /* dlist_insert_last(): Inserts the object 'object' to the end of the list of which first element is 'firstpointer' and last element is 'lastpointer': */ #define dlist_insert_last(firstpointer,lastpointer,object) \ do \ { (object)->__LIST_PREV=(lastpointer); \ (object)->__LIST_NEXT=NULL; \ if ( (lastpointer) != NULL ) \ (lastpointer)->__LIST_NEXT=(object); \ (lastpointer)=(object); \ if ( (firstpointer) == NULL ) \ (firstpointer)=(object); \ } while ( 0 ) /* dlist_remove(): Deletes the object 'object' from the list of which first element is 'firstpointer' and last element is 'lastpointer': */ #define dlist_remove(firstpointer,lastpointer,object) \ do \ { if ( (object)->__LIST_NEXT != NULL ) \ (object)->__LIST_NEXT->__LIST_PREV=(object)->__LIST_PREV; \ else \ (lastpointer) =(object)->__LIST_PREV; \ if ( (object)->__LIST_PREV != NULL ) \ (object)->__LIST_PREV->__LIST_NEXT=(object)->__LIST_NEXT; \ else \ (firstpointer)=(object)->__LIST_NEXT; \ } while ( 0 ) /* dlist_delete(): Like dlist_remove(), followed by a free() to the ``object'' pointer. */ #define dlist_delete(firstpointer,lastpointer,object) \ do \ { list_remove((firstpointer),(lastpointer),(object)); \ __LIST_FREE(object); \ } while ( 0 ) \ /*****************************************************************************/ #endif /*****************************************************************************/ pexec-1.0rc8/src/tokenize.c0000644000175000017500000001372411104653124014276 0ustar apalapal/*****************************************************************************/ /* tokenize.c */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Standalone library for basic text processing. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2001, 2004, Pal, A. (apal@szofi.elte.hu). */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* See function prototypes and the usage of the functions in tokenize.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #include #include #include #include "tokenize.h" #ifdef HAVE_LIBINTL_H #include #define _(string) gettext(string) #else #define _(string) string #endif #define TOKENIZE_ABORT_ON_MALLOC #ifdef TOKENIZE_ABORT_ON_MALLOC #define realloc_check(ptr,size) \ do \ { if ( ptr==NULL && size>0 ) \ { fprintf(stderr,"tokenize.c: %s.\n",_("memory exhausted"));\ abort(); \ } \ } while(0) #else #define realloc_check(ptr,size) #endif #define malloc_check(ptr) realloc_check(ptr,1) /*****************************************************************************/ void remove_newlines_and_comments(char *buff) { int k; while ( *buff ) { if ( *buff=='#' ) *buff=0; else { for ( k=0 ; buff[k]==10 || buff[k]==13 ; ) k++; if ( k ) memmove(buff,buff+k,strlen(buff)+1-k); else buff++; } } } void remove_spaces_and_comments(char *buff) { int k; while ( *buff ) { if ( *buff=='#' ) *buff=0; else { for ( k=0 ; buff[k]==9 || buff[k]==32 || buff[k]==10 || buff[k]==13 ; ) k++; if ( k ) memmove(buff,buff+k,strlen(buff)+1-k); else buff++; } } } void remove_spaces(char *buff) { int k; while ( *buff ) { for ( k=0 ; buff[k]==9 || buff[k]==32 || buff[k]==10 || buff[k]==13 ; ) k++; if ( k ) memmove(buff,buff+k,strlen(buff)+1-k); else buff++; } } /*****************************************************************************/ void remove_quotes(char *buff) { int k; while ( *buff ) { for ( k=0 ; buff[k]=='"' ; ) k++; if ( k ) memmove(buff,buff+k,strlen(buff)+1-k); else buff++; } } /*****************************************************************************/ int char_is_space(int c) { if ( c==32 || c==13 || c==10 || c==9 ) return(1); else return(0); } /*****************************************************************************/ int tokenize_spaces(char *buff,char **tokens,int max) { int intoken,inquota,n; char **tsave; tsave=tokens; intoken=0,inquota=0;n=0; while ( *buff && n=nm-1 ) { nm+=16; rtokens=(char **)realloc(rtokens,sizeof(char *)*nm); realloc_check(rtokens,sizeof(char *)*nm); } } else if ( intoken && ( (char_is_space(*buff) && inquota) || (!char_is_space(*buff)) ) ) { if ( *buff=='"' ) inquota=!inquota; buff++; } else if ( intoken && ! inquota && char_is_space(*buff) ) { *buff=0,buff++; intoken=0; } else buff++; }; rtokens[n]=NULL; for ( i=0 ; i. */ /*****************************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_SYS_LOADAVG_H #include #endif #ifdef HAVE_LIBINTL_H #include #define _(string) gettext(string) #else #define _(string) string #endif #include "tokenize.h" #include "iof.h" #include "numhash.h" #include "fifo.h" #include "format.h" #include "str.h" #include "linebuffer.h" #include "longhelp.h" #define __LIST_MALLOC xmalloc #include "list.h" #include "pexec.h" #define PEXEC_ABORT_ON_MALLOC #ifdef PEXEC_ABORT_ON_MALLOC #define realloc_check(ptr,size) \ do \ { if ( ptr==NULL && size>0 ) \ { fprintf(stderr,"pexec.c: %s.\n",_("memory exhausted"));\ abort(); \ } \ } while(0) #else #define realloc_check(ptr,size) #endif #define malloc_check(ptr) realloc_check(ptr,1) static void *xmalloc(size_t size) { void *ret; ret=malloc(size); malloc_check(ret); return(ret); } static void *xrealloc(void *ptr,size_t size) { void *ret; ret=realloc(ptr,size); realloc_check(ret,size); return(ret); } static char *xstrdup(const char *s) { char *ret; ret=strdup(s); malloc_check(ret); return(ret); } /*****************************************************************************/ /* global variables used throughout this program: */ char *progbasename; /* basename of the program, normally it is 'pexec' */ int sig_pipe[2]; /* file descriptors of pipes used in signal handlers */ /*****************************************************************************/ #define PEXEC_ISTR_AUTO "auto" #define PEXEC_ISTR_MANAGED "managed" #define PEXEC_ISTR_NCPU "ncpu" /*****************************************************************************/ char *logmsg_submit_task[] = { NULL, "unable to open " PEXEC_DEFAULT_NULLFILE " special file for reading", "unable to redirect from input file: file cannot be opened", "unable to open " PEXEC_DEFAULT_NULLFILE " special file for writing", "unable to create internal pipes", "unable to redirect to output file: file cannot be created", "unable to redirect to error file: file cannot be created", "unknown error", NULL }; int log_message(logdata *log,int loglevel,parameter *p,char *msg,...) { va_list ap; if ( log->fwlog==NULL || log->loglevelfwlog,"[%s] ",p->name); va_start(ap,msg); vfprintf(log->fwlog,msg,ap); va_end(ap); fprintf(log->fwlog,"\n"); fflush(log->fwlog); return(0); } /*****************************************************************************/ /* an implementation of the daemon() function for non-linux/GNU/BSD systems */ int background(int nochdir,int noclose) { int child_pid; /* PID of child process */ int nulldev_fd; /* file descriptor for null device */ child_pid = fork(); if ( child_pid < 0 ) return(-1); else if ( child_pid == 0 ) { #ifdef TIOCNOTTY if ( ( i=open("/dev/tty",O_RDWR) ) >= 0 ) { ioctl(i, TIOCNOTTY, 0) ; close(i); } #endif if ( ! nochdir ) chdir("/"); if ( ! noclose ) { nulldev_fd=open("/dev/null",O_RDONLY); if ( nulldev_fd>=0 ) { if ( isatty(0) ) { close(0); dup2(nulldev_fd,0); } close(nulldev_fd); } nulldev_fd=open("/dev/null",O_WRONLY); if ( nulldev_fd>=0 ) { if ( isatty(1) ) { close(1); dup2(nulldev_fd,1); } if ( isatty(2) ) { close(2); dup2(nulldev_fd,2); } close(nulldev_fd); } } } else exit(0); return(0); } /*****************************************************************************/ void sig_act_child(int signum) { int pid,ret,status; signalinfo sci; if ( sig_pipe[1]<0 ) return; while ( (pid=waitpid(-1,&status,WNOHANG))>0 ) { sci.signal=SIGCHLD; sci.pid=pid; sci.exitstatus=WEXITSTATUS(status); if ( WIFSIGNALED(status) ) sci.exitsignal=WTERMSIG(status); else sci.exitsignal=-1; ret=write(sig_pipe[1],&sci,sizeof(signalinfo)); } } void sig_act_interrupt(int signum) { signalinfo sci; int ret; if ( sig_pipe[1]<0 ) return; sci.signal=signum; sci.pid=0; sci.exitstatus=0; sci.exitsignal=!0; ret=write(sig_pipe[1],&sci,sizeof(signalinfo)); } /*****************************************************************************/ int fdwait(int fd,int timeout) { fd_set set; struct timeval tv; int ret; FD_ZERO(&set); FD_SET(fd,&set); if ( timeout>0 ) { tv.tv_sec=timeout; tv.tv_usec=0; ret=select(fd+1,&set,NULL,NULL,&tv); } else ret=select(fd+1,&set,NULL,NULL,NULL); return(ret); } /*****************************************************************************/ #ifdef HAVE_SETENV int env_export(char *name,char *value) { int ret; ret=setenv(name,value,!0); return(ret); } #else int env_export(char *name,char *value) { int ret; char *envstr; envstr=NULL; strappendf(&envstr,"%s=%s",name,value); ret=putenv(envstr); /* free(envstr); */ return(ret); } #endif /*****************************************************************************/ int is_nasty_char(int c) { if ( isalnum(c) ) return(0); else if ( c=='-' || c=='+' || c=='@' || c=='^' ) return(0); else if ( c=='_' || c=='=' || c==':' || c=='/' ) return(0); else if ( c==',' || c=='.' ) return(0); else return(1); } int get_nasty_char_number(char *arg) { int n; for ( n=0 ; *arg ; arg++ ) { if ( is_nasty_char(*arg) ) n++; } return(n); } /* char *make_escaped_shell_command(char **argv,int argc) { char *command; int len,i,j,x,l; len=0; command=NULL; for ( i=0 ; i=127 || c=='\"' || c=='\'' || c=='\\' ) return(1); else return(0); } static int hex_digit(int c) { if ( '0' <= c && c <= '9' ) return(c-'0'); else if ( 'a' <= c && c <= 'f' ) return(c-'a'+10); else if ( 'A' <= c && c <= 'F' ) return(c-'A'+10); else return(-1); } char * daemon_commandtoken_escape(char *buff,int size) { int l,s,c; char *p,*q,*out; if ( buff==NULL ) return(NULL); l=0; for ( p=buff,s=size ; s>0 ; p++,s-- ) { if ( daemon_commandtoken_is_nasty((int)(*p)) ) l+=3; else l++; } out=(char *)xmalloc(l+1); for ( p=buff,q=out,s=size ; s>0 ; p++,s-- ) { if ( daemon_commandtoken_is_nasty((int)(*p)) ) { c=(*(unsigned char *)p); sprintf(q,"\\%.2X",c); q+=3; } else { *q=*p; q++; } } *q=0; return(out); } char * daemon_commandtoken_escape_string(char *buff) { int len; if ( buff==NULL || (len=strlen(buff))<=0 ) return(NULL); else return(daemon_commandtoken_escape(buff,len)); } int daemon_commandtoken_unescape(char *buff) { char *out; int h1,h2,ret; ret=0; for ( out=buff ; *buff ; ) { if ( *buff=='\\' && (h1=hex_digit((int)(*(buff+1))))>=0 && (h2=hex_digit((int)(*(buff+2))))>=0 ) { *out=h1*16+h2; buff+=3; out++; } else { *out=*buff; buff++; out++; } ret++; } *out=0; return(ret); } /*****************************************************************************/ #define HPRINT_BUFFER_SIZE 256 int hprintf(int handle,char *msg,...) { char buff[HPRINT_BUFFER_SIZE],*tbuff; va_list ap; int n; va_start(ap,msg); n=vsnprintf(buff,HPRINT_BUFFER_SIZE,msg,ap); va_end(ap); if ( n0 && ncpu>0 ) ncpu=(w0 ; n/=2 ) { r++; } return(r); } /*****************************************************************************/ child * get_child_by_pid(child *cc,int pid) { for ( ; cc != NULL ; cc=cc->next ) { if ( cc->pid==pid ) return(cc); } return(NULL); } child * get_child_by_id(child *cc,int id) { for ( ; cc != NULL ; cc=cc->next ) { if ( cc->id==id ) return(cc); } return(NULL); } imutex * get_imutex_by_name(imutex *mx,char *name) { for ( ; mx != NULL ; mx=mx->next ) { if ( strcmp(mx->name,name)==0 ) return(mx); } return(NULL); } int fd_avail(int fd) { fd_set set; struct timeval tv; FD_ZERO(&set); FD_SET(fd,&set); tv.tv_sec=0; tv.tv_usec=0; select(fd+1,&set,NULL,NULL,&tv); if ( FD_ISSET(fd,&set) ) return(1); else return(0); } char *fileformat_replace(char *format,parameter *par) { char *name; name=format_replace(format,0, 's',FORMAT_STRING,par->name, 'k',FORMAT_STRING,par->id, 'd',FORMAT_STRING,par->id+1, 0); return(name); } int submit_task(paralleldata *p,parameter *par,child *c,int no_format_replace, parallelstatus *ps) { int stdfd[3]; int pipeout[2],pipeerr[2]; int pid; if ( par->no_touch_std ) { stdfd[0]=-1; stdfd[1]=-1; stdfd[2]=-1; pipeout[0]=-1; pipeout[1]=-1; pipeerr[0]=-1; pipeerr[1]=-1; } else { if ( p->in == NULL ) { stdfd[0]=open(PEXEC_DEFAULT_NULLFILE,O_RDONLY); if ( stdfd[0]<0 ) return(-1); } else { char *inname; if ( no_format_replace ) stdfd[0]=open(p->in,O_RDONLY); else { inname=fileformat_replace(p->in,par); stdfd[0]=open(inname,O_RDONLY); free(inname); } if ( stdfd[0]<0 ) return(-2); } if ( p->out == NULL ) { stdfd[1]=open(PEXEC_DEFAULT_NULLFILE,O_WRONLY); if ( stdfd[1]<0 ) return(-3); pipeout[0]=-1; pipeout[1]=-1; } else if ( p->fwout != NULL ) { if ( pipe(pipeout) ) return(-4); stdfd[1]=pipeout[1]; } else { char *outname; if ( no_format_replace ) stdfd[1]=open(p->out,O_WRONLY|O_CREAT|O_TRUNC,0644); else { outname=fileformat_replace(p->out,par); stdfd[1]=open(outname,O_WRONLY|O_CREAT|O_TRUNC,0644); free(outname); } if ( stdfd[1]<0 ) return(-5); pipeout[0]=-1; pipeout[1]=-1; } if ( p->err == NULL ) { stdfd[2]=open(PEXEC_DEFAULT_NULLFILE,O_WRONLY); if ( stdfd[2]<0 ) return(-3); pipeerr[0]=-1; pipeerr[1]=-1; } else if ( p->fwerr != NULL ) { if ( pipe(pipeerr) ) return(-4); stdfd[2]=pipeerr[1]; } else { char *errname; if ( no_format_replace ) stdfd[2]=open(p->err,O_WRONLY|O_CREAT|O_TRUNC,0644); else { errname=fileformat_replace(p->err,par); stdfd[2]=open(errname,O_WRONLY|O_CREAT|O_TRUNC,0644); free(errname); } if ( stdfd[2]<0 ) return(-6); pipeerr[0]=-1; pipeerr[1]=-1; } } pid=fork(); if ( pid<0 ) return(-4); else if ( pid>0 ) { if ( pipeout[0]>=0 ) { c->fdstdout=pipeout[0]; close(pipeout[1]); } else { c->fdstdout=-1; if ( stdfd[1]>=0 ) close(stdfd[1]); } if ( pipeerr[0]>=0 ) { c->fdstderr=pipeerr[0]; close(pipeerr[1]); } else { c->fdstderr=-1; if ( stdfd[2]>=0 ) close(stdfd[2]); } if ( stdfd[0]>=0 ) close(stdfd[0]); return(pid); } else { if ( pipeout[0]>=0 ) close(pipeout[0]); if ( pipeerr[0]>=0 ) close(pipeerr[0]); /* is ps (parallelstatus) is defined: close opened filedesc's */ if ( ps != NULL ) { client *cl; child *cc; for ( cl=ps->clientlist ; cl != NULL ; cl=cl->next ) { if ( cl->peer>=0 ) close(cl->peer); } if ( ps->sock >= 0 ) close(ps->sock); if ( ps->hsck >= 0 ) close(ps->hsck); for ( cc=ps->childlist ; cc != NULL ; cc=cc->next ) { if ( cc->fdstdout>=0 ) close(cc->fdstdout); if ( cc->fdstderr>=0 ) close(cc->fdstderr); } } if ( stdfd[0]>=0 ) { close(0); dup2(stdfd[0],0); close(stdfd[0]); } if ( stdfd[1]>=0 ) { close(1); dup2(stdfd[1],1); close(stdfd[1]); } if ( stdfd[2]>=0 ) { close(2); dup2(stdfd[2],2); close(stdfd[2]); } close(sig_pipe[0]); close(sig_pipe[1]); if ( p->envvarname != NULL && par->name != NULL ) env_export(p->envvarname,par->name); /* this is the normal shell execution: */ if ( par->c.is_shell > 0 ) { char *argv[4]; argv[0]=p->shell; /* /bin/sh */ argv[1]="-c"; argv[2]=concatenate_arguments(par->c.argc,par->c.argv); argv[3]=NULL; execv(p->shell,argv); fprintf(stderr,_("%s: unable to execute the shell '%s'.\n"), progbasename,p->shell); exit(2); } /* this is the remote shell execution: */ else if ( par->c.is_shell < 0 ) { char **argv; int i,argc,n; n=0; for ( n=0 ; p->rshargs[n] != NULL ; ) n++; argc=n+1+par->c.argc+1; /* rsh NULL */ argv=(char **)xmalloc(sizeof(char *)*(argc+1)); argc=0; for ( i=0 ; irshargs[i]; argc++; } if ( par->name != NULL ) { argv[argc]=par->name; argc++; } else { argv[argc]="localhost"; argc++; } for ( i=0 ; ic.argc ; i++ ) { argv[argc]=par->c.argv[i]; argc++; } argv[argc]=NULL; execvp(argv[0],argv); fprintf(stderr,_("%s: unable to execute the remote shell command '%s'.\n"), progbasename,argv[0]); exit(2); } /* this is the normal command execution: */ else { char **argv; int i,argc; argc=par->c.argc; argv=(char **)xmalloc(sizeof(char *)*(argc+1)); for ( i=0 ; ic.argv[i]; } argv[argc]=NULL; execvp(argv[0],argv); fprintf(stderr,_("%s: unable to execute the command '%s'.\n"), progbasename,argv[0]); exit(2); } } return(-7); /* unreachable point, however */ } int send_task(paralleldata *p,parameter *par,child *cc) { char **args,*token; int a,i; args=(char **)xmalloc(sizeof(char *)*16); for ( a=0 ; a<16 ; a++ ) { args[a]=NULL; } a=0; strappendf(&args[a],"execute");a++; strappendf(&args[a],"identifier=%d",par->id);a++; if ( p->envvarname != NULL && par->name != NULL ) { strappendf(&args[a],"envname=%s",p->envvarname);a++; strappendf(&args[a],"envvalue=%s",par->name);a++; } if ( p->in != NULL ) { char *inname; inname=fileformat_replace(p->in,par); strappendf(&args[a],"in=%s",inname);a++; free(inname); } if ( p->out != NULL && p->fwout==NULL ) { char *outname; outname=fileformat_replace(p->out,par); strappendf(&args[a],"out=%s",outname);a++; free(outname); } else if ( p->fwout != NULL ) { strappendf(&args[a],"out=-");a++; } if ( p->err != NULL && p->fwerr==NULL ) { char *errname; errname=fileformat_replace(p->err,par); strappendf(&args[a],"err=%s",errname);a++; free(errname); } else if ( p->fwerr != NULL ) { strappendf(&args[a],"err=-");a++; } if ( par->c.is_shell ) { strappendf(&args[a],"shell=%s",p->shell);a++; strappendf(&args[a],"-");a++; args[a]=concatenate_arguments(par->c.argc,par->c.argv);a++; } else { strappendf(&args[a],"-");a++; args=(char **)xrealloc(args,sizeof(char *)*(16+par->c.argc)); for ( i=0 ; ic.argc ; i++ ) { args[a]=xstrdup(par->c.argv[i]); a++; } } args[a]=NULL; for ( i=0 ; irs->fhsend,"%s ",token); else hprintf(cc->rs->fhsend,"%s\n",token); /* fprintf(stderr,"send_task(): token: %s\n",token); */ free(token); free(args[i]); } free(args); return(0); } size_t read_fd_block(int fd,void *data,size_t size) { char *cdata; ssize_t rd; size_t tr; cdata=data; tr=0; while ( size>0 ) { rd=read(fd,cdata,size); /* fprintf(stderr,"read_fd_block(): read:%d size=%d\n",(int)rd,(int)size); */ if ( rd<0 && errno==EINTR ) /* can be interrupted by SIGCHLD */ continue; else if ( rd<=0 ) /* otherwise, something is wrong, or */ { /* fprintf(stderr,"error: errno=%d '%s'\n",errno,strerror(errno)); */ return(0); } else /* or... everything is fine... */ { size-=rd; cdata+=rd; tr+=rd; } }; return(tr); } int read_signalinfo(int fd,signalinfo *sci) { return((int)read_fd_block(fd,sci,sizeof(signalinfo))); } int write_out_line(FILE *fw,char *format,char *lbuffer, parameter *p,int omit_newlines) { char *outline; size_t len; outline=format_replace(format,1, 'k',FORMAT_INTEGER,p->id, 'd',FORMAT_INTEGER,p->id+1, 's',FORMAT_STRING,p->name, 'l',FORMAT_STRING,lbuffer, NULL); if ( outline != NULL ) { len=strlen(outline); if ( omit_newlines ) fwrite(outline,1,len,fw); else fprintf(fw,"%s\n",outline); fflush(fw); free(outline); } return(0); } int write_output(char *buff,size_t n,FILE *fw, char *format,int omit_newlines,linebuffer *lb,parameter *p) { char *line; if ( fw==NULL ) return(0); if ( buff==NULL ) n=0; if ( format==NULL || lb==NULL ) { if ( n>0 && buff != NULL ) { fwrite(buff,1,n,fw); fflush(fw); } return(0); } else if ( format != NULL && lb != NULL ) { linebuffer_concatenate(lb,buff,n); while ( (line=linebuffer_fetch(lb)) != NULL || (buff==NULL && (line=linebuffer_flush(lb)) != NULL) ) { write_out_line(fw,format,line,p,omit_newlines); free(line); } return(0); } else return(-1); } int imutex_cleanup(imutex *mx,int qid,void *data) { int i,j,r; for ( ; mx != NULL ; mx=mx->next ) { if ( mx->pclients==NULL || mx->npclient<=0 ) continue; r=0; for ( i=0 ; inpclient ; i++ ) { if ( mx->pclients[i].qid==qid && mx->pclients[i].data==data ) { mx->pclients[i].qid=-1; mx->pclients[i].data=NULL; r++; } } if ( r==mx->npclient ) { free(mx->pclients); mx->pclients=NULL; mx->npclient=0; } else if ( r ) { for ( i=0,j=0 ; inpclient ; i++ ) { if ( ! ( mx->pclients[i].qid<0 && mx->pclients[i].data==NULL ) ) { mx->pclients[j]=mx->pclients[i]; j++; } } mx->npclient=j; } } return(0); } int imutex_lock_get_params(char **cmd,char **rname,int *rmaxnum) { char *name; int i,maxnum; name=NULL; maxnum=1; for ( i=1 ; cmd[i] != NULL ; i++ ) { if ( ( strcmp(cmd[i],"-m")==0 || strcmp(cmd[i],"--maximum")==0 ) && cmd[i+1] != NULL ) { i++; sscanf(cmd[i],"%d",&maxnum); } else if ( cmd[i][0]=='-' ) return(1); else if ( name==NULL ) name=cmd[i]; else return(1); } *rname=name; *rmaxnum=maxnum; return(0); } int imutex_unlock_get_params(char **cmd,char **rname) { char *name; int i; name=NULL; for ( i=1 ; cmd[i] != NULL ; i++ ) { if ( cmd[i][0]=='-' ) return(1); else if ( name==NULL ) name=cmd[i]; else return(1); } *rname=name; return(0); } int imutex_mutex_get_params(char **cmd,char **rname) { char *name; int i; name=NULL; for ( i=1 ; cmd[i] != NULL ; i++ ) { if ( cmd[i][0]=='-' ) return(1); else if ( name==NULL ) name=cmd[i]; else return(1); } *rname=name; return(0); } int remote_client_master_parse_command_tokens(char **cmd,parallelstatus *ps,int qid,void *dd) { time_t tc; int i,ret; remoteshell *rs; client *cl; if ( qid>=0 ) { rs=(remoteshell *)dd; cl=NULL; } else { rs=NULL; cl=(client *)dd; } if ( cmd==NULL || cmd[0]==NULL ) return(0); else if ( strcmp(cmd[0],"status")==0 ) { time(&tc); if ( qid >=0 && rs != NULL ) { hprintf(rs->fhsend,"remote %d status %d/%d/%d %d %d\n", qid, ps->nfinished,ps->npending,ps->nparam, (int)ps->t0,(int)tc); /* fprintf(stderr,"qid=%d: status sent [%d,%d,%d]\n",qid,ps->nfinished,ps->npending,ps->nparam); */ } else if ( cl != NULL ) { hprintf(cl->peer,"status %d/%d/%d %d %d\n", ps->nfinished,ps->npending,ps->nparam, (int)ps->t0,(int)tc); } ret=0; } else if ( strcmp(cmd[0],"lock")==0 ) { char *name; int maxnum; imutex *mx; name=NULL; maxnum=0; i=imutex_lock_get_params(cmd,&name,&maxnum); /* fprintf(stderr,"pexec: %d: lock request: '%s'.\n",(int)getpid(),name); */ if ( i || name==NULL ) hprintf(cl->peer,"error unexpected arguments for '%s'\n",cmd[0]); else if ( (mx=get_imutex_by_name(ps->imutexlist,name)) != NULL ) { mx->pclients=(pendingclient *)xrealloc(mx->pclients,sizeof(pendingclient)*(mx->npclient+1)); mx->pclients[mx->npclient].qid=qid; mx->pclients[mx->npclient].data=dd; mx->npclient++; mx->state++; } else { mx=list_new(imutex); list_insert_first(ps->imutexlist,mx); mx->name=xstrdup(name); mx->state=1; mx->pclients=NULL; mx->npclient=0; if ( qid>=0 && rs != NULL ) hprintf(rs->fhsend,"remote %d locked \"%s\"\n",qid,mx->name); else if ( cl != NULL ) hprintf(cl->peer,"locked \"%s\"\n",mx->name); } ret=0; } else if ( strcmp(cmd[0],"unlock")==0 ) { char *name; imutex *mx; pendingclient pcw; int is_pcw_set; name=NULL; i=imutex_unlock_get_params(cmd,&name); if ( (!i) && name != NULL && (mx=get_imutex_by_name(ps->imutexlist,name)) != NULL ) { mx->state--; if ( mx->pclients != NULL && mx->npclient>0 ) { memcpy(&pcw,&mx->pclients[0],sizeof(pendingclient)); is_pcw_set=1; if ( mx->npclient>1 ) memmove(mx->pclients,mx->pclients+1,sizeof(pendingclient)*(mx->npclient-1)); else { free(mx->pclients); mx->pclients=NULL; } mx->npclient--; } else is_pcw_set=0; if ( is_pcw_set ) { if ( pcw.qid>=0 && pcw.data != NULL ) hprintf(((remoteshell *)pcw.data)->fhsend,"remote %d locked \"%s\"\n",pcw.qid,mx->name); else if ( pcw.data != NULL ) hprintf(((client *)pcw.data)->peer,"locked \"%s\"\n",mx->name); } if ( mx->state <= 0 ) { free(mx->name); list_remove(ps->imutexlist,mx); free(mx); } } ret=0; } else if ( strcmp(cmd[0],"mutex")==0 ) { imutex *mx; char *name; int lcnt; name=NULL; i=imutex_mutex_get_params(cmd,&name); if ( i || name==NULL ) hprintf(cl->peer,"error unexpected arguments for '%s'\n",cmd[0]); else { if ( (mx=get_imutex_by_name(ps->imutexlist,name)) != NULL ) lcnt=mx->npclient; else lcnt=0; if ( qid>=0 && rs != NULL ) hprintf(rs->fhsend,"remote %d mutex \"%s\" %d\n",qid,name,lcnt); else if ( cl != NULL ) hprintf(cl->peer,"mutex \"%s\" %d\n",name,lcnt); } ret=0; } else if ( strcmp(cmd[0],"exit")==0 ) { hprintf(cl->peer,"bye\n"); ret=1; } else { hprintf(cl->peer,"error unexpected command '%s'\n",cmd[0]); ret=0; } return(ret); } int remote_client_master_parse_command(char *line,parallelstatus *ps,int qid,void *dd) { int ret; char **cmd; cmd=tokenize_spaces_dyn(line); if ( cmd==NULL ) return(0); else if ( cmd[0]==NULL ) { free(cmd); return(0); } ret=remote_client_master_parse_command_tokens(cmd,ps,qid,dd); free(cmd); return(ret); } int pexec_submit(paralleldata *p,parallelstatus *ps, numhashtable *ntp,numhashtable *ntf, remoteshell *rs,parameter *cp,int n) { child *cc; cc=list_new(child); cc->fdstdout=-1; cc->fdstderr=-1; list_insert_first(ps->childlist,cc); ps->achild++; rs->achild++; cc->rs=rs; if ( ! rs->num_processes ) rs->estatus=0; linebuffer_reset(&cc->lout); linebuffer_reset(&cc->lerr); /* remote submission: */ if ( rs->pid >= 0 ) { cc->id=n; cc->pid=-1; send_task(p,cp,cc); ps->npending++; numhash_add(ntp,n,NULL); } /* local submission: */ else { cc->id=n; cc->pid=submit_task(p,cp,cc,0,ps); ps->npending++; numhash_add(ntp,n,NULL); if ( cc->pid < 0 ) { ps->nfinished++; numhash_add(ntf,n,NULL); log_message(p->log,1,cp,"error while invoking task:" " %s",logmsg_submit_task[-cc->pid]); list_remove(ps->childlist,cc); free(cc); ps->achild--; rs->achild--; } } return(0); } remoteshell *pexec_get_free_remote_shell(remoteshell *rshells,int nrshell) { remoteshell *rs; int r; /* check if max number of processes has been reached... */ for ( r=0,rs=rshells ; rnum_processes && rs->achild < rs->num_processes ) || rs->estatus>=2 ) return(rs); } return(NULL); } int pexec_do_parallelized_execution(paralleldata *p, parameter *params,int nparam, remoteshell *rshells,int nrshell, int sock,int hsck) { child *cc; struct sigaction chldact; signalinfo sci; numhashtable ntp,ntf; /* pending & finished jobs */ int i,n,r; parameter *cp; fd_set set; int spipe,max,status; char *buff; int buffsize; remoteshell *rs; client *cl; parallelstatus ps; linebuffer lhyp; if ( pipe(sig_pipe)<0 ) return(-1); spipe=sig_pipe[0]; chldact.sa_handler=sig_act_child; sigemptyset(&chldact.sa_mask); chldact.sa_flags=(SA_NOCLDSTOP|SA_RESTART); sigaction(SIGCHLD,&chldact,NULL); ps.childlist=NULL; ps.achild=0; /* just to be sure, [*].achild must be init'ed by remote_shell_init(): */ for ( r=0,rs=rshells ; rachild=0; rs->estatus=0; } ps.nfinished=0; numhash_init(&ntf,get_bit_size(nparam),4); ps.npending =0; numhash_init(&ntp,get_bit_size(nparam),4); ps.nparam=nparam; buffsize=getpagesize(); /* some natural buffer size */ buff=(char *)xmalloc(buffsize); ps.sock=sock; /* inherit the same socket fd */ ps.hsck=hsck; /* hypervisor client socket fd */ ps.clientlist=NULL; /* no clients */ ps.imutexlist=NULL; /* no mutexes */ linebuffer_reset(&lhyp); time(&ps.t0); while ( ps.nfinished < ps.nparam ) { while ( 1 ) { n=numhash_get_smallest_free(&ntp); /* fprintf(stderr,"numhash_get_smallest_free()=%d\n",n); */ /* nothing to do... */ if ( n<0 || n>=nparam ) break; rs=pexec_get_free_remote_shell(rshells,nrshell); if ( rs==NULL ) break; /* here we know that the remote shell 'rs' is */ /* free for submission a new submission: */ cp=¶ms[n]; pexec_submit(p,&ps,&ntp,&ntf,rs,cp,n); } for ( rs=rshells,r=0 ; rnum_processes && ! rs->estatus ) { rs->estatus=1; if ( rs->pid >=0 ) hprintf(rs->fhsend,"request\n"); else if ( hsck>=0 ) hprintf(hsck,"request\n"); } } /* This would happen if many of the submit_task()'s fail yielding */ /* an unexpected increase of "finished" tasks. If the increment was */ /* too high and all children have been exited yet, the select() */ /* would block forever (i.e. we have to stop the main loop here). */ if ( ps.nfinished >= nparam ) break; FD_ZERO(&set); FD_SET(spipe,&set); max=spipe; for ( cc=ps.childlist ; cc != NULL ; cc=cc->next ) { if ( cc->id<0 || cc->pid<0 ) continue; /* ignore invalid or non-local childeren */ if ( cc->fdstdout >= 0 ) { FD_SET(cc->fdstdout,&set); if ( maxfdstdout ) max=cc->fdstdout; } if ( cc->fdstderr >= 0 ) { FD_SET(cc->fdstderr,&set); if ( maxfdstderr ) max=cc->fdstderr; } } for ( rs=rshells,r=0 ; rpid < 0 || rs->fhsend<0 || rs->fhrecv<0 ) continue; /* ignore local "remote shells" */ FD_SET(rs->fhrecv,&set); if ( maxfhrecv ) max=rs->fhrecv; } if ( sock>=0 ) { FD_SET(sock,&set); if ( max=0 ) { FD_SET(hsck,&set); if ( maxnext ) { FD_SET(cl->peer,&set); if ( maxpeer ) max=cl->peer; } i=select(max+1,&set,NULL,NULL,NULL); if ( i<0 && errno==EINTR ) continue; /* somebody is dying: */ if ( FD_ISSET(spipe,&set) ) { if ( ! (read_signalinfo(spipe,&sci)>0) ) { fprintf(stderr,_("%s: fatal error: read_signalinfo() failed.\n"),progbasename); exit(1); } /* fprintf(stderr,"read_signalinfo(): pid=%d signal=%d exit=%d\n",sci.pid,sci.exitsignal,sci.exitstatus); */ /* normal termination, successful: */ if ( sci.exitsignal<0 ) { cc=get_child_by_pid(ps.childlist,sci.pid); n=cc->id; cc->id =-1; cc->pid=-1; cp=¶ms[n]; numhash_add(&ntf,n,NULL); ps.nfinished++; /* LOG */ if ( cc->fdstdout>=0 && p->fwout != NULL ) { while ( fd_avail(cc->fdstdout) ) { n=read(cc->fdstdout,buff,buffsize); if ( n>0 ) write_output(buff,n,p->fwout,p->formatout,p->omit_newlines,&cc->lout,cp); else if ( ! ( n<0 && errno==EINTR ) ) break; } write_output(NULL,0,p->fwout,p->formatout,p->omit_newlines,&cc->lout,cp); close(cc->fdstdout); cc->fdstdout=-1; } if ( cc->fdstderr>=0 && p->fwerr != NULL ) { while ( fd_avail(cc->fdstderr) ) { n=read(cc->fdstderr,buff,buffsize); if ( n>0 ) write_output(buff,n,p->fwerr,p->formaterr,p->omit_newlines,&cc->lerr,cp); else if ( ! ( n<0 && errno==EINTR ) ) break; } write_output(NULL,0,p->fwerr,p->formaterr,p->omit_newlines,&cc->lerr,cp); close(cc->fdstderr); cc->fdstderr=-1; } list_remove(ps.childlist,cc); cc->rs->achild--; ps.achild--; if ( ! cc->rs->num_processes && hsck>=0 ) hprintf(hsck,"ready\n"); free(cc); } /* abnormal termination, caused by some discrepancy: */ else if ( p->fallback_to_die ) { close(sig_pipe[0]); sig_pipe[0]=-1; close(sig_pipe[1]); sig_pipe[1]=-1; for ( cc=ps.childlist ; cc != NULL ; cc=cc->next ) { if ( cc->pid < 0 ) continue; /* ignore nonlocal */ kill(cc->pid,SIGKILL); waitpid(cc->pid,&status,0); free(cc); } ps.childlist=NULL; ps.achild=0; return(1); } /* resubmit after the abnormal termination: */ else { cc=get_child_by_pid(ps.childlist,sci.pid); numhash_remove(&ntp,n); ps.npending--; list_remove(ps.childlist,cc); cc->rs->achild--; ps.achild--; free(cc); } } /* if ( FD_ISSET(spipe,&set) ) */ for ( cc=ps.childlist ; cc != NULL ; cc=cc->next ) { if ( cc->id<0 || cc->pid<0 ) continue; /* skip invalid or non-local children */ cp=¶ms[cc->id]; if ( cc->fdstdout >= 0 && p->fwout != NULL && FD_ISSET(cc->fdstdout,&set) ) { n=read(cc->fdstdout,buff,buffsize); if ( n>0 ) write_output(buff,n,p->fwout,p->formatout,p->omit_newlines,&cc->lout,cp); else if ( ! ( n<0 && errno==EINTR ) ) { close(cc->fdstdout); cc->fdstdout=-1; } } if ( cc->fdstderr >= 0 && p->fwerr != NULL && FD_ISSET(cc->fdstderr,&set) ) { n=read(cc->fdstderr,buff,buffsize); if ( n>0 ) write_output(buff,n,p->fwerr,p->formaterr,p->omit_newlines,&cc->lerr,cp); else if ( ! ( n<0 && errno==EINTR ) ) { close(cc->fdstderr); cc->fdstderr=-1; } } } /* for ( cc=ps.childlist ; cc != NULL ; cc=cc->next ) */ /* some data has been received from the tunnel of the remote pexec: */ for ( rs=rshells,r=0 ; rpid < 0 || rs->fhsend<0 || rs->fhrecv<0 ) continue; /* ignore local "remote shells" */ if ( ! FD_ISSET(rs->fhrecv,&set) ) continue; n=read(rs->fhrecv,buff,buffsize); /* the remote shell process terminated unexpectedly: */ if ( n==0 ) { /* TBD */ break; } /* nothing, just a signal interrupted the reading, go on...*/ else if ( n<0 && errno==EINTR ) continue; linebuffer_concatenate(&rs->lrsh,buff,n); while ( (line=linebuffer_fetch(&rs->lrsh)) != NULL ) { /* fprintf(stderr,"pexec: %d: remote shell: received: '%s'\n",(int)getpid(),line); */ cmd=tokenize_spaces_dyn(line); if ( cmd != NULL && cmd[0] != NULL ) { if ( strcmp(cmd[0],"output")==0 && cmd[1] != NULL && cmd[2] != NULL ) { sscanf(cmd[1],"%d",&n); cc=get_child_by_id(ps.childlist,n); cp=¶ms[n]; len=daemon_commandtoken_unescape(cmd[2]); write_output(cmd[2],len,p->fwout,p->formatout,p->omit_newlines,&cc->lout,cp); } else if ( strcmp(cmd[0],"error")==0 && cmd[1] != NULL && cmd[2] != NULL ) { sscanf(cmd[1],"%d",&n); cc=get_child_by_id(ps.childlist,n); cp=¶ms[n]; len=daemon_commandtoken_unescape(cmd[2]); write_output(cmd[2],len,p->fwerr,p->formaterr,p->omit_newlines,&cc->lerr,cp); } else if ( strcmp(cmd[0],"finish")==0 && cmd[1] != NULL ) { sscanf(cmd[1],"%d",&n); cc=get_child_by_id(ps.childlist,n); numhash_add(&ntf,n,NULL); ps.nfinished++; list_remove(ps.childlist,cc); cc->rs->achild--; ps.achild--; if ( ! cc->rs->num_processes ) hprintf(cc->rs->fhsend,"ready\n"); free(cc); } else if ( strcmp(cmd[0],"remote")==0 && cmd[1] != NULL && cmd[2] != NULL ) { int qid; void *dd; if ( sscanf(cmd[1],"%d",&qid)==1 ) { if ( qid>=0 ) dd=(void *)rs; else dd=NULL; remote_client_master_parse_command_tokens(cmd+2,&ps,qid,dd); } } else if ( strcmp(cmd[0],"acknowledged")==0 ) rs->estatus=2; /* TBD: handle unexpected data: */ /* else { } */ } if ( cmd != NULL ) free(cmd); free(line); } } /* for ( rs=rshells,r=0 ; rnext ) { char *line; int closepeer; if ( ! FD_ISSET(cl->peer,&set) ) continue; n=read(cl->peer,buff,buffsize); if ( n==0 ) { close(cl->peer); linebuffer_free(&cl->lcli); imutex_cleanup(ps.imutexlist,-1,(void *)cl); list_remove(ps.clientlist,cl); free(cl); break; } else if ( n<0 && errno==EINTR ) continue; linebuffer_concatenate(&cl->lcli,buff,n); closepeer=0; while ( (line=linebuffer_fetch(&cl->lcli)) != NULL ) { closepeer=remote_client_master_parse_command(line,&ps,-1,(void *)cl); free(line); if ( closepeer ) break; }; if ( closepeer ) { close(cl->peer); linebuffer_free(&cl->lcli); imutex_cleanup(ps.imutexlist,-1,(void *)cl); list_remove(ps.clientlist,cl); free(cl); break; } } /* for ( cl=ps.clientlist ; cl != NULL ; cl=cl->next ) */ if ( hsck>=0 && FD_ISSET(hsck,&set) ) { char *line,**cmd; n=read(hsck,buff,buffsize); if ( n>0 ) linebuffer_concatenate(&lhyp,buff,n); while ( (line=linebuffer_fetch(&lhyp)) != NULL ) { cmd=tokenize_spaces_dyn(line); if ( cmd != NULL ) { if ( strcmp(cmd[0],"acknowledged")==0 ) { for ( rs=rshells,r=0 ; rnum_processes ) rs->estatus=2; } } free(cmd); } free(line); } } /* if ( hsck>=0 && FD_ISSET(hsck,&set) ) */ if ( sock>=0 && FD_ISSET(sock,&set) ) { cl=list_new(client); cl->peer=accept(sock,NULL,NULL); linebuffer_reset(&cl->lcli); list_insert_first(ps.clientlist,cl); cl->status=0; } /* if ( sock>=0 && FD_ISSET(sock,&set) ) */ } for ( rs=rshells,r=0 ; rnum_processes ) { if ( rs->pid >=0 ) hprintf(rs->fhsend,"completed\n"); else if ( hsck>=0 ) hprintf(hsck,"completed\n"); } } free(buff); numhash_free(&ntp); numhash_free(&ntf); signal(SIGCHLD,SIG_DFL); close(sig_pipe[0]); close(sig_pipe[1]); return(0); } int remote_client_daemon_parse_command(char *line,client *cl,parallelstatus *ps,int fhsend) { int i,ret; char **cmd; cmd=tokenize_spaces_dyn(line); if ( cmd==NULL ) return(0); else if ( cmd[0]==NULL ) { free(cmd); return(0); } else if ( strcmp(cmd[0],"status")==0 ) { dqueue *dq; dq=list_new(dqueue); dq->id=ps->iqueue; dq->qclient=cl; list_insert_first(ps->dqueuelist,dq); hprintf(fhsend,"remote %d status\n",dq->id); ps->iqueue++; ret=0; } else if ( strcmp(cmd[0],"lock")==0 ) { char *name; int maxnum; dqueue *dq; name=NULL; maxnum=0; i=imutex_lock_get_params(cmd,&name,&maxnum); if ( i || name==NULL ) hprintf(cl->peer,"error unexpected arguments for '%s'\n",cmd[0]); else { dq=list_new(dqueue); dq->id=ps->iqueue; dq->qclient=cl; list_insert_first(ps->dqueuelist,dq); hprintf(fhsend,"remote %d lock \"%s\"\n",dq->id,name); ps->iqueue++; } ret=0; } else if ( strcmp(cmd[0],"unlock")==0 ) { char *name; name=NULL; i=imutex_unlock_get_params(cmd,&name); if ( ! ( i || name==NULL ) ) hprintf(fhsend,"remote -1 unlock \"%s\"\n",name); ret=0; } else if ( strcmp(cmd[0],"mutex")==0 ) { char *name; dqueue *dq; name=NULL; i=imutex_mutex_get_params(cmd,&name); if ( i || name==NULL ) hprintf(cl->peer,"error unexpected arguments for '%s'\n",cmd[0]); else { dq=list_new(dqueue); dq->id=ps->iqueue; dq->qclient=cl; list_insert_first(ps->dqueuelist,dq); hprintf(fhsend,"remote %d mutex \"%s\"\n",dq->id,name); ps->iqueue++; } ret=0; } else if ( strcmp(cmd[0],"exit")==0 ) { hprintf(cl->peer,"bye\n"); ret=1; } else { hprintf(cl->peer,"error unexpected command '%s'\n",cmd[0]); ret=0; } free(cmd); return(ret); } dqueue *dqueue_get_queue_by_id(parallelstatus *ps,int id) { dqueue *dq; for ( dq=ps->dqueuelist ; dq != NULL ; dq=dq->next ) { if ( dq->id == id ) return(dq); } return(NULL); } int daemon_process_command(parallelstatus *ps,int fhsend,char **cmd) { int i,n,id,zeroarg; char *shell,*in,*out,*err,*envname,*envvalue,*eoc; paralleldata p; parameter par; child *cc; dqueue *dq; if ( cmd==NULL || cmd[0]==NULL ) return(0); for ( n=0 ; cmd[n] != NULL ; ) n++; if ( strcmp(cmd[0],"exit")==0 ) return(1); else if ( strcmp(cmd[0],"remote")==0 && n>=3 ) { int qid,j; char *buff; if ( sscanf(cmd[1],"%d",&qid)<1 ) qid=-1; dq=dqueue_get_queue_by_id(ps,qid); if ( dq != NULL ) { buff=NULL; strappendf(&buff,"%s",cmd[2]); if ( strcmp(cmd[2],"locked")==0 || strcmp(cmd[2],"mutex")==0 ) { strappendf(&buff," \"%s\"",(cmd[3]!=NULL?cmd[3]:"-")); if ( cmd[3] != NULL ) j=4; else j=3; } else j=3; for ( ; cmd[j] != NULL ; j++ ) strappendf(&buff," %s",cmd[j]); hprintf(dq->qclient->peer,"%s\n",buff); if ( buff != NULL ) free(buff); list_remove(ps->dqueuelist,dq); free(dq); } /* else fprintf(stderr,"daemon pexec: %d: unexpected queue id: %d\n",(int)getpid(),qid); */ return(0); } else if ( strcmp(cmd[0],"execute")==0 ) { shell=NULL; in=NULL; out=NULL; err=NULL; envname=NULL; envvalue=NULL; id=-1; zeroarg=-1; for ( i=1 ; i=n ) { hprintf(fhsend,"message \"command specification is missing near '%s'\"\n",cmd[0]); return(0); } if ( in==NULL ) p.in=NULL; else p.in=in; if ( out==NULL ) { p.out=NULL; p.fwout=NULL; } else if ( strcmp(out,"-")==0 ) { p.out=out; p.fwout=stdout; /* just something which is definitely not NULL */ } else { p.out=out; p.fwout=NULL; } if ( err==NULL ) { p.err=NULL; p.fwerr=NULL; } else if ( strcmp(err,"-")==0 ) { p.err=err; p.fwerr=stderr; /* just something which is definitely not NULL */ } else { p.err=err; p.fwerr=NULL; } if ( envname != NULL && envvalue != NULL ) { p.envvarname=envname; par.name=envvalue; } else { p.envvarname=NULL; par.name=NULL; } if ( shell != NULL ) { p.shell=shell; par.c.is_shell=1; par.c.argc=n-zeroarg; par.c.argv=cmd+zeroarg; } else { p.shell=NULL; par.c.is_shell=0; par.c.argc=n-zeroarg; par.c.argv=cmd+zeroarg; } par.no_touch_std=0; cc=list_new(child); cc->fdstdout=-1; cc->fdstderr=-1; cc->id=id; /* it was: submit_task(&p,&par,cc,!0,NULL); */ cc->pid=submit_task(&p,&par,cc,!0,ps); if ( cc->pid<0 ) { hprintf(fhsend,"message \"unable to execute, reason code: %d\"\n",cc->pid); free(cc); return(0); } else { list_insert_first(ps->childlist,cc); return(0); } } else if ( strcmp(cmd[0],"request")==0 ) { if ( ps->hsck < 0 ) { hprintf(fhsend,"message \"unexpected 'request': hypervisor has not been connected to daemon\"\n"); } else { hprintf(ps->hsck,"request\n"); } return(0); } else if ( strcmp(cmd[0],"ready")==0 ) { if ( ps->hsck < 0 ) { hprintf(fhsend,"message \"unexpected 'ready': hypervisor has not been connected to daemon\"\n"); } else { hprintf(ps->hsck,"ready\n"); } return(0); } else if ( strcmp(cmd[0],"completed")==0 ) { if ( ps->hsck < 0 ) { hprintf(fhsend,"message \"unexpected 'completed': hypervisor has not been connected to daemon\"\n"); } else { hprintf(ps->hsck,"completed\n"); } return(0); } else { hprintf(fhsend,"message \"invalid command: %s\"\n",cmd[0]); return(0); } } int daemon_send_data(int fhsend,char *streamname,int id,char *buff,int size) { char *out; if ( buff==NULL ) return(0); out=daemon_commandtoken_escape(buff,size); hprintf(fhsend,"%s %d ",streamname,id); write(fhsend,out,strlen(out)); free(out); hprintf(fhsend,"\n"); return(0); } int daemon_send_output(int fhsend,int id,char *buff,int size) { return(daemon_send_data(fhsend,"output",id,buff,size)); } int daemon_send_error(int fhsend,int id,char *buff,int size) { return(daemon_send_data(fhsend,"error",id,buff,size)); } int pexec_daemon_main_loop(int fhrecv,int fhsend, int num_processes, int sock,int hsck) { fd_set set; parallelstatus ps; child *cc; struct sigaction chldact; signalinfo sci; int spipe,max,status; int buffsize,i,n; char *buff,**cmd,*line; int is_in_loop,ret; linebuffer lcmd,lhyp; client *cl; hprintf(fhsend,"initialization num_processes=%d\n",num_processes); buffsize=getpagesize(); /* some natural buffer size */ buff=(char *)xmalloc(buffsize); if ( pipe(sig_pipe)<0 ) return(-1); spipe=sig_pipe[0]; chldact.sa_handler=sig_act_child; sigemptyset(&chldact.sa_mask); chldact.sa_flags=(SA_NOCLDSTOP|SA_RESTART); sigaction(SIGCHLD,&chldact,NULL); ps.childlist=NULL; ps.achild=0; ps.clientlist=NULL; ps.imutexlist=NULL; ps.dqueuelist=NULL; ps.iqueue=0; ps.sock=sock; /* remote control server socket */ ps.hsck=hsck; /* hypervisor client socket */ linebuffer_reset(&lcmd); linebuffer_reset(&lhyp); is_in_loop=1; while ( is_in_loop ) { FD_ZERO(&set); FD_SET(spipe,&set); max=spipe; FD_SET(fhrecv,&set); if ( maxnext ) { if ( cc->id<0 || cc->pid<0 ) continue; /* just to be sure... */ if ( cc->fdstdout >= 0 ) { FD_SET(cc->fdstdout,&set); if ( maxfdstdout ) max=cc->fdstdout; } if ( cc->fdstderr >= 0 ) { FD_SET(cc->fdstderr,&set); if ( maxfdstderr ) max=cc->fdstderr; } } if ( sock>=0 ) { FD_SET(sock,&set); if ( max=0 ) { FD_SET(hsck,&set); if ( maxnext ) { FD_SET(cl->peer,&set); if ( maxpeer ) max=cl->peer; } /* hprintf(1,"select(): waiting...\n"); */ i=select(max+1,&set,NULL,NULL,NULL); /* hprintf(1,"select(): done.\n"); */ /* somebody is dying: */ if ( FD_ISSET(spipe,&set) ) { /* hprintf(1,"read_signalinfo(): waiting...\n"); */ if ( ! (read_signalinfo(spipe,&sci)>0) ) { fprintf(stderr,_("%s: fatal error: read_signalinfo() failed.\n"),progbasename); exit(1); } /* hprintf(1,"read_signalinfo(): done.\n"); */ /* fprintf(stderr,"read_signalinfo(): pid=%d signal=%d exit=%d\n",sci.pid,sci.exitsignal,sci.exitstatus); */ /* normal termination, successful: */ if ( sci.exitsignal<0 ) { cc=get_child_by_pid(ps.childlist,sci.pid); /* LOG */ if ( cc->fdstdout>=0 ) { while ( fd_avail(cc->fdstdout) ) { n=read(cc->fdstdout,buff,buffsize); if ( n>0 ) daemon_send_output(fhsend,cc->id,buff,n); else if ( ! ( n<0 && errno==EINTR ) ) break; } close(cc->fdstdout); cc->fdstdout=-1; } if ( cc->fdstderr>=0 ) { while ( fd_avail(cc->fdstderr) ) { n=read(cc->fdstderr,buff,buffsize); if ( n>0 ) daemon_send_error(fhsend,cc->id,buff,n); else if ( ! ( n<0 && errno==EINTR ) ) break; } close(cc->fdstderr); cc->fdstderr=-1; } } hprintf(fhsend,"finish %d signal=%d status=%d\n",cc->id,sci.exitsignal,sci.exitstatus); list_remove(ps.childlist,cc); free(cc); ps.achild--; continue; } /* if ( FD_ISSET(spipe,&set) ) */ /* some data has been received from the tunnel of the parent pexec: */ if ( FD_ISSET(fhrecv,&set) ) { /* hprintf(1,"read(fhrecv,...): waiting...\n"); */ n=read(fhrecv,buff,buffsize); if ( n==0 ) { is_in_loop=0; break; } else if ( n<0 && errno==EINTR ) continue; linebuffer_concatenate(&lcmd,buff,n); while ( (line=linebuffer_fetch(&lcmd)) != NULL ) { cmd=tokenize_spaces_dyn(line); if ( cmd != NULL ) { for ( i=0 ; cmd[i] != NULL ; i++ ) daemon_commandtoken_unescape(cmd[i]); ret=daemon_process_command(&ps,fhsend,cmd); free(cmd); free(line); if ( ret>0 ) { is_in_loop=0; break; } } else free(line); } continue; } /* if ( FD_ISSET(fhrecv,&set) ) */ for ( cc=ps.childlist ; cc != NULL ; cc=cc->next ) { if ( cc->id<0 || cc->pid<0 ) continue; if ( cc->fdstdout >= 0 && FD_ISSET(cc->fdstdout,&set) ) { n=read(cc->fdstdout,buff,buffsize); if ( n>0 ) daemon_send_output(fhsend,cc->id,buff,n); else if ( ! ( n<0 && errno==EINTR ) ) { close(cc->fdstdout); cc->fdstdout=-1; } } if ( cc->fdstderr >= 0 && FD_ISSET(cc->fdstderr,&set) ) { n=read(cc->fdstderr,buff,buffsize); if ( n>0 ) daemon_send_error(fhsend,cc->id,buff,n); else if ( ! ( n<0 && errno==EINTR ) ) { close(cc->fdstderr); cc->fdstderr=-1; } } } /* for ( cc in ps.childlist ) */ for ( cl=ps.clientlist ; cl != NULL ; cl=cl->next ) { char *line; int closepeer; if ( ! FD_ISSET(cl->peer,&set) ) continue; n=read(cl->peer,buff,buffsize); if ( n==0 ) { close(cl->peer); linebuffer_free(&cl->lcli); list_remove(ps.clientlist,cl); free(cl); break; } else if ( n<0 && errno==EINTR ) continue; linebuffer_concatenate(&cl->lcli,buff,n); closepeer=0; while ( (line=linebuffer_fetch(&cl->lcli)) != NULL ) { /* fprintf(stderr,"daemon pexec: %d: line[%d]='%s'\n",(int)getpid(),cl->peer,line); */ closepeer=remote_client_daemon_parse_command(line,cl,&ps,fhsend); free(line); if ( closepeer ) break; }; if ( closepeer ) { close(cl->peer); linebuffer_free(&cl->lcli); list_remove(ps.clientlist,cl); free(cl); break; } } /* for ( cl in ps.clientlist ) */ if ( hsck>=0 && FD_ISSET(hsck,&set) ) { n=read(hsck,buff,buffsize); if ( n>0 ) linebuffer_concatenate(&lhyp,buff,n); while ( (line=linebuffer_fetch(&lhyp)) != NULL ) { cmd=tokenize_spaces_dyn(line); if ( cmd != NULL ) { if ( strcmp(cmd[0],"acknowledged")==0 ) { hprintf(fhsend,"acknowledged\n"); } free(cmd); } free(line); } } /* if ( hsck>=0 && FD_ISSET(hsck,&set) ) */ if ( sock>=0 && FD_ISSET(sock,&set) ) { cl=list_new(client); cl->peer=accept(sock,NULL,NULL); linebuffer_reset(&cl->lcli); list_insert_first(ps.clientlist,cl); cl->status=0; } /* is sock>=0 && FD_ISSET(sock) */ } linebuffer_free(&lcmd); free(buff); signal(SIGCHLD,SIG_DFL); close(sig_pipe[0]); sig_pipe[0]=-1; close(sig_pipe[1]); sig_pipe[1]=-1; for ( cc=ps.childlist ; cc != NULL ; cc=cc->next ) { if ( cc->pid < 0 ) continue; kill(cc->pid,SIGKILL); waitpid(cc->pid,&status,0); free(cc); } ps.childlist=NULL; ps.achild=0; return(0); } /*****************************************************************************/ int parse_host_data(char *arg,remotehost **rrhosts,int *rnrhost) { char *hostlist,**hosts,*eoc; int j,n,r; remotehost *rhosts; int nrhost; if ( arg==NULL || *arg==0 ) return(-1); hostlist=xstrdup(arg); hosts=tokenize_char_dyn(hostlist,','); rhosts=NULL; nrhost=0; for ( j=0 ; hosts != NULL && hosts[j] != NULL ; j++ ) { eoc=strchr(hosts[j],':'); rhosts=(remotehost *)xrealloc(rhosts,sizeof(remotehost)*(nrhost+1)); if ( eoc==NULL ) { if ( strcmp(hosts[j],PEXEC_ISTR_AUTO)==0 ) { rhosts[nrhost].hostspec=NULL; rhosts[nrhost].num_processes=PEXEC_MNP_AUTO; } else if ( strcmp(hosts[j],PEXEC_ISTR_MANAGED)==0 ) { rhosts[nrhost].hostspec=NULL; rhosts[nrhost].num_processes=PEXEC_MNP_MANAGED; } else if ( strcmp(hosts[j],PEXEC_ISTR_NCPU)==0 ) { rhosts[nrhost].hostspec=NULL; rhosts[nrhost].num_processes=PEXEC_MNP_NCPU; } else if ( sscanf(hosts[j],"%d",&n)==1 && n>0 ) { rhosts[nrhost].hostspec=NULL; rhosts[nrhost].num_processes=n; } else { rhosts[nrhost].hostspec=xstrdup(hosts[j]); rhosts[nrhost].num_processes=PEXEC_MNP_AUTO; } /* else { free(rhosts); return(1); } */ } else if ( eoc==hosts[j] ) { free(rhosts); return(1); } else { *eoc=0; if ( strcmp(eoc+1,PEXEC_ISTR_AUTO)==0 ) n=PEXEC_MNP_AUTO; else if ( strcmp(eoc+1,PEXEC_ISTR_MANAGED)==0 ) n=PEXEC_MNP_MANAGED; else if ( strcmp(eoc+1,PEXEC_ISTR_NCPU)==0 ) n=PEXEC_MNP_NCPU; else if ( (r=sscanf(eoc+1,"%d",&n))==0 || (r==1 && n<=0) ) { free(rhosts); free(hostlist); return(1); } rhosts[nrhost].hostspec=xstrdup(hosts[j]); rhosts[nrhost].num_processes=n; } nrhost++; } free(hosts); free(hostlist); *rrhosts=rhosts; *rnrhost=nrhost; return(0); } int remote_shell_init(char *rsh,char **rshargs,char *pexec_self,char *ctrlport, int timeout,remotehost *rh,remoteshell *rs,int prio) { int pipesend[2],piperecv[2]; int pid; if ( rh->hostspec==NULL ) { rs->pid=-1; rs->fhsend=rs->fhrecv=-1; rs->num_processes=rh->num_processes; rs->achild=0; linebuffer_reset(&rs->lrsh); return(0); } if ( pipe(pipesend)<0 ) return(-1); /* creation of pipe failed */ if ( pipe(piperecv)<0 ) return(-1); /* creation of pipe failed */ pid=fork(); if ( pid<0 ) return(-2); /* fork failed */ else if ( pid>0 ) { char *line,**tokens; rs->pid=pid; rs->fhsend=pipesend[1]; close(pipesend[0]); rs->fhrecv=piperecv[0]; close(piperecv[1]); rs->achild=0; linebuffer_reset(&rs->lrsh); line=linebuffer_read_line(rs->fhrecv,&rs->lrsh,timeout); if ( line==NULL ) return(-3); /* data retrieval failed */ /* fprintf(stderr,"received: %s\n",line); */ tokens=tokenize_spaces_dyn(line); if ( tokens != NULL && tokens[0] != NULL && strcmp(tokens[0],"initialization")==0 && tokens[1] != NULL && sscanf(tokens[1],"num_processes=%d",&rs->num_processes)==1 && rs->num_processes >= 0 ) { free(tokens); free(line); return(0); /* successful */ } else { if ( tokens != NULL ) free(tokens); free(line); return(-4); /* unexpected data received */ } } else { int i,n; char **argv,num_buff[32],pri_buff[32]; close(pipesend[1]); close(piperecv[0]); close(0); dup2(pipesend[0],0); close(pipesend[0]); close(1); dup2(piperecv[1],1); close(piperecv[1]); close(2); dup2(1,2); for ( n=0 ; rshargs[n] != NULL ; ) n++; argv=(char **)xmalloc(sizeof(char *)*(n+32)); for ( i=0 ; ihostspec; argv[i++]=pexec_self; argv[i++]="--tunnel"; if ( rh->num_processes>0 ) { argv[i++]="--number"; sprintf(num_buff,"%d",rh->num_processes); argv[i++]=num_buff; } else if ( rh->num_processes == PEXEC_MNP_AUTO ) { argv[i++]="--number"; argv[i++]=PEXEC_ISTR_AUTO; } else if ( rh->num_processes == PEXEC_MNP_MANAGED ) { argv[i++]="--number"; argv[i++]=PEXEC_ISTR_MANAGED; } else if ( rh->num_processes == PEXEC_MNP_NCPU ) { argv[i++]="--number"; argv[i++]=PEXEC_ISTR_NCPU; } if ( prio > 0 ) { argv[i++]="--nice"; sprintf(pri_buff,"%d",prio-128); argv[i++]=pri_buff; } if ( ctrlport != NULL ) { argv[i++]="--bind"; argv[i++]=ctrlport; } argv[i++]=NULL; execvp(rsh,argv); fprintf(stdout,"initialization execution=failed\n"); exit(1); return(0); } } /*****************************************************************************/ #ifndef UNIX_PATH_MAX #define UNIX_PATH_MAX 108 #endif int is_unix_socket_name(char *name) { if ( strchr(name,'/') != NULL ) return(1); else return(0); } /* or :, works only for ipv4: */ int is_inet_socket_name(char *name) { int port; char *colon; if ( sscanf(name,"%d",&port)==1 ) return(1); else if ( sscanf(name,"*:%d",&port)==1 ) return(1); else if ( (colon=strchr(name,':')) != NULL && sscanf(colon+1,"%d",&port)==1 ) return(2); else return(0); } int remote_control_port_bind(char *ctrlport,char **rctrlport, int allow_auto,int fail_on_existing) { int sock,port,ret,pid; char buff[256],*colon; struct stat st; if ( ctrlport==NULL ) return(-1); else if ( allow_auto && strcmp(ctrlport,"inet")==0 ) { struct sockaddr_in inaddr; sock=socket(PF_INET,SOCK_STREAM,0); if ( sock<0 ) return(-1); for ( port=11228,ret=-1 ; port<16384 ; port++ ) { inaddr.sin_family=AF_INET; inaddr.sin_port=htons(port); inaddr.sin_addr.s_addr=INADDR_ANY; ret=bind(sock,(struct sockaddr *)(&inaddr),(socklen_t)(sizeof(inaddr))); if ( ! ret ) break; } if ( ret<0 ) { close(sock); return(-1); } sprintf(buff,"%d",port); if ( rctrlport != NULL ) *rctrlport=xstrdup(buff); return(sock); } else if ( sscanf(ctrlport,"%d",&port)==1 || sscanf(ctrlport,"*:%d",&port)==1 ) { struct sockaddr_in inaddr; sock=socket(PF_INET,SOCK_STREAM,0); if ( sock<0 ) return(-1); inaddr.sin_family=AF_INET; inaddr.sin_port=htons(port); inaddr.sin_addr.s_addr=INADDR_ANY; ret=bind(sock,(struct sockaddr *)(&inaddr),(socklen_t)(sizeof(inaddr))); if ( ret<0 ) { close(sock); return(-1); } sprintf(buff,"%d",port); if ( rctrlport != NULL ) *rctrlport=xstrdup(buff); return(sock); } else if ( (colon=strchr(ctrlport,':')) != NULL && sscanf(colon+1,"%d",&port)==1 ) { struct sockaddr_in inaddr; char *hostname; struct hostent *peer; hostname=xmalloc((size_t)(colon-ctrlport)+1); memcpy(hostname,ctrlport,(colon-ctrlport)); hostname[(colon-ctrlport)]=0; peer=gethostbyname(hostname); free(hostname); if ( peer==NULL || peer->h_addrtype != AF_INET ) return(-1); sock=socket(PF_INET,SOCK_STREAM,0); if ( sock<0 ) return(-1); inaddr.sin_family=AF_INET; inaddr.sin_port=htons(port); memcpy(&inaddr.sin_addr.s_addr,peer->h_addr,peer->h_length); ret=bind(sock,(struct sockaddr *)(&inaddr),(socklen_t)(sizeof(inaddr))); if ( ret<0 ) { close(sock); return(-1); } if ( rctrlport != NULL ) *rctrlport=xstrdup(ctrlport); return(sock); } else if ( allow_auto && strcmp(ctrlport,"unix")==0 ) { struct sockaddr_un unaddr; sock=socket(PF_UNIX,SOCK_STREAM,0); if ( sock<0 ) return(-1); unaddr.sun_family=AF_UNIX; pid=(int)getpid(); sprintf(unaddr.sun_path,"/tmp/pexec.%d.sock",pid); if ( ! stat(unaddr.sun_path,&st) && S_ISSOCK(st.st_mode) ) unlink(unaddr.sun_path); ret=bind(sock,(struct sockaddr *)(&unaddr),(socklen_t)(sizeof(unaddr))); if ( ret<0 ) { close(sock); return(-1); } if ( rctrlport != NULL ) *rctrlport=xstrdup(unaddr.sun_path); return(sock); } else if ( is_unix_socket_name(ctrlport) ) { struct sockaddr_un unaddr; sock=socket(PF_UNIX,SOCK_STREAM,0); if ( sock<0 ) return(-1); unaddr.sun_family=AF_UNIX; strncpy(unaddr.sun_path,ctrlport,UNIX_PATH_MAX-1); unaddr.sun_path[UNIX_PATH_MAX-1]=0; if ( fail_on_existing && (! stat(unaddr.sun_path,&st)) ) { close(sock); return(-1); } else if ( (! stat(unaddr.sun_path,&st)) && S_ISSOCK(st.st_mode) ) unlink(unaddr.sun_path); ret=bind(sock,(struct sockaddr *)(&unaddr),(socklen_t)(sizeof(unaddr))); if ( ret<0 ) { close(sock); return(-1); } if ( rctrlport != NULL ) *rctrlport=xstrdup(unaddr.sun_path); return(sock); } else return(-1); } int bind_variable_export(char *envvar,char *ctrlport) { if ( ctrlport==NULL ) return(-1); env_export(envvar,ctrlport); return(0); } int remote_control_port_connect(char *ctrlport) { int sock,port,ret; struct sockaddr_in inaddr; struct sockaddr_un unaddr; char *sc; if ( ctrlport==NULL || (! ctrlport[0]) ) return(-1); else if ( is_unix_socket_name(ctrlport) ) { if ( (sock=socket(PF_UNIX,SOCK_STREAM,0))<0 ) return(-1); unaddr.sun_family=AF_UNIX; strncpy(unaddr.sun_path,ctrlport,UNIX_PATH_MAX-1); unaddr.sun_path[UNIX_PATH_MAX-1]=0; ret=connect(sock,(struct sockaddr *)(&unaddr),(socklen_t)(sizeof(unaddr))); if ( ret<0 ) { close(sock); return(-1); } return(sock); } else { inaddr.sin_family=AF_INET; sc=strchr(ctrlport,':'); if ( sc==NULL ) { if ( sscanf(ctrlport,"%d",&port)<1 ) return(-1); inaddr.sin_addr.s_addr=htonl(INADDR_LOOPBACK); inaddr.sin_port=htons(port); } else { char *hostname; int len; struct hostent *peer; if ( sscanf(sc+1,"%d",&port)<1 ) return(-1); len=(int)(sc-ctrlport); hostname=(char *)xmalloc(len+1); memcpy(hostname,ctrlport,len); hostname[len]=0; peer=gethostbyname(hostname); free(hostname); if ( peer==NULL) return(-1); memcpy(&inaddr.sin_addr.s_addr,peer->h_addr,peer->h_length); inaddr.sin_port=htons(port); } if ( (sock=socket(PF_INET,SOCK_STREAM,0))<0 ) return(-1); ret=connect(sock,(struct sockaddr *)(&inaddr),(socklen_t)(sizeof(inaddr))); if ( ret<0 ) { close(sock); return(-1); } return(sock); } } /*****************************************************************************/ int remote_status(int sock,FILE *fw) { linebuffer lrcv; char *line; hprintf(sock,"status --all\n"); linebuffer_reset(&lrcv); line=linebuffer_read_line(sock,&lrcv,0); if ( line != NULL ) { remove_newlines_and_comments(line); fprintf(fw,"%s\n",line); free(line); } return(0); } int remote_lock(int sock,FILE *fw,char *name) { linebuffer lrcv; char *line; hprintf(sock,"lock \"%s\"\n",name); linebuffer_reset(&lrcv); line=linebuffer_read_line(sock,&lrcv,0); if ( line != NULL ) { remove_newlines_and_comments(line); if ( fw != NULL ) fprintf(fw,"%s\n",line); free(line); } return(0); } int remote_unlock(int sock,FILE *fw,char *name) { hprintf(sock,"unlock \"%s\"\n",name); return(0); } int remote_copy(int sock,char *name,FILE *frin,FILE *fwout) { char *buff; int blksize,r,fd; fd_set set; FD_ZERO(&set); fd=fileno(frin); FD_SET(fd,&set); select(fd+1,&set,NULL,NULL,NULL); if ( sock>=0 && name != NULL ) remote_lock(sock,NULL,name); blksize=getpagesize(); buff=(char *)xmalloc(blksize); while ( ! feof(frin) ) { r=fread(buff,1,blksize,frin); if ( r<=0 ) break; else fwrite(buff,1,r,fwout); } free(buff); if ( sock>=0 && name != NULL ) remote_unlock(sock,NULL,name); return(0); } int remote_atomic_execute(int is_shell_commands,char *shell,int argc,char **argv,int sock) { int pid,status; pid=fork(); if ( pid>0 ) { waitpid(pid,&status,0); return(WEXITSTATUS(status)); } else { if ( sock>=0 ) close(sock); if ( is_shell_commands ) { char *largv[4]; largv[0]=shell; /* /bin/sh */ largv[1]="-c"; largv[2]=argv[0]; largv[3]=NULL; execv(shell,largv); fprintf(stderr,_("%s: unable to execute the script '%s'.\n"), shell,progbasename); exit(2); } else { char **largv; int i,largc; largc=argc; largv=(char **)xmalloc(sizeof(char *)*(argc+1)); for ( i=0 ; inrequest ; ) { if ( hs->requests[i].cl == cl ) { if ( inrequest-1 ) { memmove(hs->requests+i,hs->requests+i+1,sizeof(request)*(hs->nrequest-i-1)); } hs->nrequest--; } else i++; } if ( hs->nrequest <= 0 ) { free(hs->requests); hs->requests=NULL; hs->nrequest=0; } return(0); } int pexec_hypervisor_acknowledge_pending(hypervisorstatus *hs) { request *rw; while ( hs->nrequest>0 && hs->nrunning < hs->num_processes && pexec_hypervisor_check_load(hs->use_load) < hs->num_processes ) { if ( hs->use_fifo ) rw=&hs->requests[0]; else rw=&hs->requests[hs->nrequest-1]; hprintf(rw->cl->peer,"acknowledged\n"); hs->nrunning++; rw->cl->status++; if ( hs->nrequest>1 && hs->use_fifo ) { memmove(hs->requests,hs->requests+1,sizeof(request)*(hs->nrequest-1)); } hs->nrequest--; if ( hs->nrequest <= 0 ) { free(hs->requests); hs->requests=NULL; hs->nrequest=0; } } return(0); } int pexec_hypervisor_client_parse_command(char *line,hypervisorstatus *hs,client *cl) { char **cmd; request *rw; int ret; cmd=tokenize_spaces_dyn(line); if ( cmd==NULL ) return(0); else if ( cmd[0]==NULL ) { free(cmd); return(0); } if ( strcmp(cmd[0],"request")==0 ) { /* if ( hs->nrunning < hs->num_processes && pexec_hypervisor_check_load(hs->use_load) < hs->num_processes ) { hprintf(cl->peer,"acknowledged\n"); hs->nrunning++; cl->status++; } else { */ hs->requests=(request *)xrealloc(hs->requests,sizeof(request)*(hs->nrequest+1)); rw=&hs->requests[hs->nrequest]; rw->cl=cl; hs->nrequest++; pexec_hypervisor_acknowledge_pending(hs); /* } */ ret=0; } else if ( strcmp(cmd[0],"ready")==0 ) { hs->nrunning--; cl->status--; pexec_hypervisor_acknowledge_pending(hs); ret=0; } else if ( strcmp(cmd[0],"completed")==0 ) { ret=0; } else if ( strcmp(cmd[0],"status")==0 ) { double loadavg[3]; getloadavg(loadavg,3); hprintf(cl->peer,"status num_processes=%d use_load=%d use_fifo=%d nrunning=%d nrequest=%d load=%.2f,%.2f,%.2f\n", hs->num_processes,hs->use_load,hs->use_fifo,hs->nrunning,hs->nrequest, loadavg[0],loadavg[1],loadavg[2]); ret=0; } else if ( strcmp(cmd[0],"set")==0 ) { int i,w; char *invvar; invvar=NULL; for ( i=1 ; cmd[i] != NULL ; i++ ) { if ( sscanf(cmd[i],"num_processes=%d",&w)==1 ) { if ( w<0 ) w=0; hs->num_processes=w; } else if ( sscanf(cmd[i],"use_load=%d",&w)==1 ) { if ( w<0 ) w=-1; else if ( w>2 ) w=2; hs->use_load=w; } else if ( sscanf(cmd[i],"use_fifo=%d",&w)==1 ) { if ( ! w ) w=0; else w=1; hs->use_fifo=w; } else invvar=cmd[i]; } if ( invvar != NULL ) { hprintf(cl->peer,"message \"invalid variable alternation '%s'\"\n",invvar); } ret=0; } else if ( strcmp(cmd[0],"close")==0 ) ret=1; else if ( strcmp(cmd[0],"terminate")==0 ) ret=-1; else { hprintf(cl->peer,"message \"invalid command '%s'\"\n",cmd[0]); ret=0; } free(cmd); return(ret); } int pexec_hypervisor_main_loop(int sock,int num_processes,int use_load,int use_fifo) { client *cl,*cnext; hypervisorstatus hs; fd_set set; int i,max,buffsize,n; char *buff; int is_in_loop; struct sigaction intact; signalinfo sci; int spipe; struct timeval tv; if ( sock<0 ) /* strange */ return(-1); hs.clientlist=NULL; hs.num_processes=num_processes; hs.use_load=use_load; hs.use_fifo=use_fifo; hs.requests=NULL; hs.nrequest=0; hs.nrunning=0; buffsize=getpagesize(); buff=(char *)xmalloc((size_t)buffsize); is_in_loop=1; if ( pipe(sig_pipe)<0 ) return(-1); intact.sa_handler=sig_act_interrupt; sigemptyset(&intact.sa_mask); intact.sa_flags=(SA_NOCLDSTOP|SA_RESTART); sigaction(SIGINT,&intact,NULL); spipe=sig_pipe[0]; while ( is_in_loop ) { FD_ZERO(&set); FD_SET(sock,&set); max=sock; for ( cl=hs.clientlist ; cl != NULL ; cl=cl->next ) { FD_SET(cl->peer,&set); if ( maxpeer ) max=cl->peer; } if ( spipe>=0 ) { FD_SET(spipe,&set); if ( max=0 ) { tv.tv_sec=PEXEC_LOAD_CHECK_PERIOD; tv.tv_usec=0; i=select(max+1,&set,NULL,NULL,&tv); } else i=select(max+1,&set,NULL,NULL,NULL); if ( i<0 && errno==EINTR ) continue; pexec_hypervisor_acknowledge_pending(&hs); /* check clients: */ for ( cl=hs.clientlist ; cl != NULL ; cl=cnext ) { char *line; int closepeer; cnext=cl->next; if ( ! FD_ISSET(cl->peer,&set) ) continue; n=read(cl->peer,buff,buffsize); if ( n<=0 ) closepeer=1; else closepeer=0; if ( n>0 && (! closepeer) ) linebuffer_concatenate(&cl->lcli,buff,n); while ( (line=linebuffer_fetch(&cl->lcli)) != NULL && ! closepeer ) { closepeer=pexec_hypervisor_client_parse_command(line,&hs,cl); free(line); if ( closepeer ) break; }; if ( closepeer ) { close(cl->peer); if ( cl->status>0 ) hs.nrunning -= cl->status; linebuffer_free(&cl->lcli); pexec_hypervisor_request_cleanup(&hs,cl); list_remove(hs.clientlist,cl); free(cl); pexec_hypervisor_acknowledge_pending(&hs); } if ( closepeer<0 ) /* ask for hypervisor termination too */ is_in_loop=0; } /* for ( cl=hs.clientlist ; cl != NULL ; cl=cnext ) */ /* multiplexed signal handling: */ if ( FD_ISSET(spipe,&set) ) { if ( ! (read_signalinfo(spipe,&sci)>0) ) { fprintf(stderr,_("%s: fatal error: read_signalinfo() failed.\n"),progbasename); exit(1); } /* interrupt from keyboard: */ if ( sci.signal==SIGINT && sci.exitsignal ) is_in_loop=0; } /* if ( FD_ISSET(spipe,&set) ) */ if ( FD_ISSET(sock,&set) ) { cl=list_new(client); cl->peer=accept(sock,NULL,NULL); linebuffer_reset(&cl->lcli); list_insert_first(hs.clientlist,cl); cl->status=0; } /* if ( FD_ISSET(sock,&set) ) */ } /* pexec_hypervisor_main_loop(): while ( is_in_loop ) */ signal(SIGINT,SIG_DFL); close(sig_pipe[0]); sig_pipe[0]=-1; close(sig_pipe[1]); sig_pipe[1]=-1; free(buff); return(0); } int pexec_hypervisor_stop(int sock) { hprintf(sock,"terminate\n"); return(0); } /*****************************************************************************/ int fprint_parameters(FILE *fw,parameter *params,int nparam) { int i,j; for ( i=0 ; i", "Full path (e.g. /bin/sh) of the shell or interpreter to be used " "for script execution." }, { "-c, --shell-command", "Use the specified shell to interpret the command(s) instead of " "direct execution." }, { "-m, --multiple-command", "Allow multiple individual shell command scripts to be executed " "in parallel with the variation of the parameters." }, { "-e, --environment ", "Name of an environmental variable which is set to the respective " "parameter before each execution." }, { "-n, --number ", "The maximal number of processes running simultaneously. The " "itself can even be a complex specification of remote hosts (see " "documentation for more details)." }, { "-C, --control ", "The control port of a hypervisor daemon (full path of a UNIX " "socket or an INET host specification)." }, { "-p, --list ", "The single-argument form of main parameter list." }, { "-r, --parameters ", "The multiple-argument form of the main parameter list." }, { "-f, --listfile ", "The main parameter list file." }, { "-w, --column ", "The column index from where the parameters should be taken if " "they are read from a parameter file." }, { "-t, --complete", "Threat the whole line as a single parameter if the " "parameters are read from a file." }, { "-z, --nice", "Sets the scheduling priority of pexec and all children " "(executed processes) to the priority defined by this nice value." }, { "--", "A marker after which the command to execute begins." } , { "Redirecting standard input, output and error:", NULL }, { "-i, --input ", "The (optionally formatted) name of the input file which is used " "for redirecting the standard input." }, { "-o, --output ", "The (optionally formatted) name of the output " "file which is used for redirecting the standard output." }, { "-u, --error ", "The (optionally formatted) name of the output " "error file, which is used for redirecting the standard error." }, { "-R, --normal-redirection", "Equivalent to specifying --output -, --error - and --input /dev/null." }, { "-a, --output-format ", "The format of the final standard output redirection if the output " "of all of the processes are gathered into the same file." }, { "-b, --error-format ", "The same final redirection format for the standard error." }, { "-x, --omit-newlines", "Disable automatic newlines after the output and error formats." }, { "Execution using remote hosts:", NULL }, { "-g, --remote-shell ", "The name or full path of the remote shell to be used for building " "the tunnel between the local and the peer host(s). " "Default: ``/usr/bin/ssh''." }, { "-P, --pexec ", "The full path of the pexec program on the remote hosts. " "If this option is omitted, pexec tries to figure out from the " "invoking syntax and/or the current path." }, { "-T, --tunnel", "Internal use only (pexec will start in tunnel daemon mode)." }, { "Remote control, mutual exclusions and atomic command execution:", NULL }, { "-y, --bind ", "This option lets pexec to be remote controlled via INET or " "UNIX domain sockets." }, { "-E, --pexec-connection-variable ", "This option overrides the default environment name PEXEC_REMOTE_PORT " "to the specified value, which is used by the ``-p|--connect auto'' " "combination to determine the control socket with which the running " "pexec instance can be controlled." }, { "-j, --remote", "Used to remote control and/or poll the status of other running " "instances of pexec." }, { "-p, --connect ", "Remote control port to connect to." }, { "-t, --status", "Prints the actual status of the running jobs in a " "human-readable form." }, { "-l, --lock ", "Locks the specified mutex (if the mutex is not locked by " "someone else, otherwise it will block until the mutex is released)." }, { "-u, --unlock ", "Unlocks the specified mutex." }, { "-m, --mutex ", "Name of the mutex." }, { "-d, --dump ", "Dump the content of the given file to standard output, " "if ``-m|--mutex'' is given, this will be atomic." }, { "-s, --save ", "Save the content of standard input to the given file, " "if ``-m|--mutex'' is given, this will be atomic." }, { "-a, --atomic ", "Execute the given command. If ``-m|--mutex'' is given, the " "exectution is going to be atomic with respect to that mutex." }, { "Hypervisor mode:",NULL }, { "-H, --hypervisor", "Starts pexec in hypervisor mode." }, { "-C, --control ", "The control port used by the hypervisor." }, { "-l, --load ", "Use load also to limit the number of simultaneous processes " "with the specified load average interval (0, 1 or 2, or 1min, " "5min or 15min, respectively)." }, { "-f, --fifo", "First in first out queue processing." }, { "-s, --lifo", "Last in first out (stack) queue processing (default)." }, { "Logging:",NULL }, { "-L, --log ", "The name of the log file." }, { "-W, --log-level ", "The logging level." }, { "-V, --verbose", "Increase the log level by one." }, { NULL, NULL } }; int fprint_pexec_long_help(FILE *fw) { fprintf(fw, "Usage:\tpexec [options] [-c|-m] [--] command [arguments] | 'compound command'\n" "Execute commands or shell scripts in parallel on a single host or\n" "on remote hosts using a remote shell.\n\n"); longhelp_fprint(fw,pexec_long_help,0,-1); fprintf(fw,"\n"); fprintf(fw,"Report bugs to \n"); return(0); } /* all flags: -abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ- */ /* available: ----d-----------------v-----AB-DEFG-IJK--NO-QRS-U--XYZ- */ int fprint_pexec_usage(FILE *fw) { fprintf(fw, "Usage:\tpexec" "\t[options] [--] command [arguments]\n" "\t\t[options] -c [--] 'compound command'\n" "\t\t[options] -m [--] 'compound command 1' 'compound command 2' ...\n"); fprintf(fw, "General Options:\n" "\t[-h|--help|--long-help] [--version]\n" "\t[-c|--shell-command] [-m|--multiple-command] [-s|--shell ]\n" "\t[-e|--environment ]\n"); fprintf(fw, "\t[-p|--list [-p ...] [-p ...]]\n" "\t[-r|--parameters {--|- [-w|--column |-t|--complete]]\n" "\t[-n|--number auto||managed|ncpu [-C|--control {|}]]\n" "\t[-l|--load|--use-load ] [-z|--nice ]\n"); fprintf(fw, "Redirecting input and output:\n" "\t[-i|--input ]\n" "\t[-o|--output ]\n" "\t[-u|--error ]\n" "\t[-a|--output-format [-x]]\n" "\t[-b|--error-format [-x|--omit-newlines]]\n" "\t[-R|--normal-redirection]\n"); fprintf(fw, "Parallelization using remote hosts:\n" "\t[-g|--remote-shell \"\"] [-q|--timeout ]\n" "\t-n|--number [:]{auto||managed|ncpu}[,...],[auto||...]\n" "\t[-P|--pexec ] [-k|--local-files]\n"); fprintf(fw, "Running as a tunnel daemon (only for internal use, see also the manual):\n" "\t-T|--tunnel [-z|--nice ]\n" "\t[-n|--number auto||managed|ncpu [-C|--control {|}]]\n"); fprintf(fw, "Remote control, mutual exclusions and atomic command execution:\n" "\t[-y|--bind inet|unix||/]\n" "\t-j|--remote [-p|--connect auto|/|[host:]] [-t|--status]\n" "\t[-E|--pexec-connection-variable ]\n" "\t[{-l|--lock|--mutex-lock | -u|--unlock|--mutex-unlock} ]\n" "\t[-m|--mutex {-d|--dump | -s|--save} ]\n" "\t[-m|--mutex -a|--atomic [-c|--shell-command] [--] command [...]]\n"); fprintf(fw, "Hypervisor mode and operations:\n" "\t-H|--hypervisor [-C|--control {|}] [start|stop]\n" "\t[-n|--number auto|] [-l|--load|--use-load ]\n" "\t[-f|--fifo | -s|--lifo|--stack]\n" "\t(default hypervisor socket: %s)\n",PEXEC_DEFAULT_HYPERVISOR_SOCKET); fprintf(fw, "Logging (for normal and hypervisor modes):\n" "\t[-L|--log ] [-W|--log-level | -V|--verbose [...]]\n" "Command specifications:\n" "\t[--] { command [args] | 'compound' | 'compound 1' ['compound 2'...] }\n"); fprintf(fw, "For more information, see --long-help or the full texinfo documentation.\n" "Examples can be found in the ``Examples'' section of the documentation.\n"); return(0); } int fprint_version(FILE *fw) { fprintf(fw,"%s %s (%s)\n", progbasename,PEXEC_VERSION,PEXEC_LAST_MODIFICATION); fprintf(fw,"Copyright (C) 2007, 2008-2009; Pal, Andras \n\n"); fprintf(fw, "This is free software. You may redistribute copies of it under the terms of\n" "the GNU General Public License .\n" "There is NO WARRANTY, to the extent permitted by law. \n\n"); fprintf(fw, "This software was written by Andras Pal. The core part was written \n" "while working for the Hungarian-made Automated Telescope (HAT) project \n" "to make the data processing more easier and therefore find many-many \n" "extrasolar planets. See more information about this project: \n" "http://hatnet.hu. Another internal libraries (e.g. numhash.[ch]) were \n" "primarily written for other projects.\n"); return(0); } int fprint_err_invarg0(char *arg) { fprintf(stderr,_("%s: error: invalid command line argument '%s'.\n"),progbasename,arg); return(0); } int fprint_err_invarg1(char *arg) { fprintf(stderr,_("%s: error: invalid or missing argument near '%s'.\n"),progbasename,arg); return(0); } int fprint_err_invarg2(char *arg) { fprintf(stderr,_("%s: error: special command line argument '%s' must be the first in the list.\n"),progbasename,arg); return(0); } int main(int argc,char *argv[]) { int is_shell_commands, /* -c */ is_multi_commands, /* -m */ zeroarg; /* -- */ remotehost *rhosts; /* -n */ int nrhost; char *list, /* -l */ *listfile, /* -f */ *logfile; /* -l */ int listcolumn; /* -w */ paralleldata p; /* -[ab] -[iou] -n */ logdata log; int ncmd; int llen; int i,ret,prio; parameter *params; int nparam; char **pnames; char *pexec_self,*ctrlport,*ctrlenv,*hypcport; int timeout,use_load; int mode; /* pexec execution mode */ is_shell_commands=0; is_multi_commands=0; zeroarg=-1; list=NULL; pnames=NULL; listfile=logfile=NULL; llen=0; rhosts=NULL; nrhost=PEXEC_MNP_AUTO; p.envvarname=NULL; p.out=p.err=p.in=NULL; p.shell=PEXEC_DEFAULT_SHELL; p.rshcmd=NULL; prio=0; p.formatout=NULL; p.formaterr=NULL; p.omit_newlines=0; log.loglevel=-1; log.fwlog=NULL; listcolumn=0; progbasename=strrchr(argv[0],'/'); if ( progbasename != NULL ) progbasename++; else progbasename=argv[0]; mode=PEXEC_MODE_DEFAULT; if ( strchr(argv[0],'/') != NULL ) pexec_self=argv[0]; else { /* pexec_self="/home/apal/bin/pexec"; */ pexec_self=progbasename; } timeout=60; ctrlport=NULL; ctrlenv=PEXEC_DEFAULT_ENVVARIABLE; hypcport=NULL; use_load=-1; for ( i=1 ; i=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } p.envvarname=argv[i]; } /* -s, --shell: full path of the shell which should understand '-c' */ else if ( strcmp(argv[i],"-s")==0 || strcmp(argv[i],"--shell")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } p.shell=argv[i]; } /* -g, --remote-shell: name (and optional arguments) for the remote shell */ else if ( strcmp(argv[i],"-g")==0 || strcmp(argv[i],"--remote-shell")==0 ) { if ( (i++)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } p.rshcmd=xstrdup(argv[i]); } /* -p, --list: list of parameters: space separated single arg */ else if ( strcmp(argv[i],"-p")==0 || strcmp(argv[i],"--list")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( list==NULL ) { list=xstrdup(argv[i]); llen=strlen(list); } else { int ilen; ilen=strlen(argv[i]); list=(char *)xrealloc(list,llen+ilen+2); strcpy(list+llen," ");llen++; strcpy(list+llen,argv[i]);llen+=ilen; } } /* -r, --parameters: list of parameters: multiple arguments */ else if ( strcmp(argv[i],"-r")==0 || strcmp(argv[i],"--parameters")==0 ) { i++; for ( ; i=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } listfile=argv[i]; } /* -w, --column: parameter column in the list file */ else if ( strcmp(argv[i],"-w")==0 || strcmp(argv[i],"--column")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( sscanf(argv[i],"%d",&listcolumn)<1 || listcolumn<=0 ) { fprint_err_invarg1(argv[i-1]); return(1); } listcolumn--; } /* -t, --complete: use the whole line of the list file as a param */ else if ( strcmp(argv[i],"-t")==0 || strcmp(argv[i],"--complete")==0 || strcmp(argv[i],"--complete-line")==0 ) listcolumn=-1; /* -n, --number: number of processes to execute simultaneously */ else if ( strcmp(argv[i],"-n")==0 || strcmp(argv[i],"--number")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( strcmp(argv[i],PEXEC_ISTR_AUTO)==0 ) { rhosts=NULL; nrhost=PEXEC_MNP_AUTO; } else if ( strcmp(argv[i],PEXEC_ISTR_MANAGED)==0 ) { rhosts=NULL; nrhost=PEXEC_MNP_MANAGED; } else if ( strcmp(argv[i],PEXEC_ISTR_NCPU)==0 ) { rhosts=NULL; nrhost=PEXEC_MNP_NCPU; } else if ( parse_host_data(argv[i],&rhosts,&nrhost) ) { fprint_err_invarg1(argv[i-1]); return(1); } } /* -M, --managed: equivalent to `-n|--number managed`: */ else if ( strcmp(argv[i],"-M")==0 || strcmp(argv[i],"--managed")==0 ) { rhosts=NULL; nrhost=PEXEC_MNP_MANAGED; } /* -l, --load: use load */ else if ( strcmp(argv[i],"-l")==0 || strcmp(argv[i],"--load")==0 || strcmp(argv[i],"--use-load")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( strcmp(argv[i],"0")==0 || strcmp(argv[i], "1m")==0 || strcmp(argv[i], "1min")==0 ) use_load=0; else if ( strcmp(argv[i],"1")==0 || strcmp(argv[i], "5m")==0 || strcmp(argv[i], "5min")==0 ) use_load=1; else if ( strcmp(argv[i],"2")==0 || strcmp(argv[i],"15m")==0 || strcmp(argv[i],"15min")==0 ) use_load=2; else { fprint_err_invarg1(argv[i-1]); return(1); } } /* -z, --nice: priority of pexec and the (initial) priority of the processes */ else if ( strcmp(argv[i],"-z")==0 || strcmp(argv[i],"--nice")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( sscanf(argv[i],"%d",&prio)<1 ) { fprint_err_invarg1(argv[i-1]); return(1); } prio+=128; } /* -q, --timeout: timeout in seconds for remote shell execution */ else if ( strcmp(argv[i],"-q")==0 || strcmp(argv[i],"--timeout")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( sscanf(argv[i],"%d",&timeout)<1 ) { fprint_err_invarg1(argv[i-1]);return(1); } if ( timeout<0 ) timeout=0; } /* -P, --pexec: full path to pexec on the remote hosts: */ else if ( strcmp(argv[i],"-P")==0 || strcmp(argv[i],"--pexec")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } pexec_self=argv[i]; } /* -E, --pexec-connection-variable : */ else if ( strcmp(argv[i],"-E")==0 || strcmp(argv[i],"--pexec-connection-variable")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } ctrlenv=argv[i]; } /* -i, --input: input file name(s) */ else if ( strcmp(argv[i],"-i")==0 || strcmp(argv[i],"--input")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } p.in=argv[i]; } /* -o, --output: output file name(s) or '-' or '-[12]' */ else if ( strcmp(argv[i],"-o")==0 || strcmp(argv[i],"--output")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } p.out=argv[i]; } /* -u, --error: error file name(s) or '-' or '-[12]' */ else if ( strcmp(argv[i],"-u")==0 || strcmp(argv[i],"--error")==0 || strcmp(argv[i],"--output-error")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } p.err=argv[i]; } /* -R, --normal-redirection: */ else if ( strcmp(argv[i],"-R")==0 || strcmp(argv[i],"--normal-redirection")==0 ) { p.in=NULL; p.out="-"; p.err="-"; } /* -a, --output-format: post-format of std output lines */ else if ( strcmp(argv[i],"-a")==0 || strcmp(argv[i],"--output-format")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } p.formatout=argv[i]; } /* -b, --error-format: post-format of error lines */ else if ( strcmp(argv[i],"-b")==0 || strcmp(argv[i],"--error-format")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } p.formaterr=argv[i]; } /* -x, --omit-newlines: omit newlines from the end of post-format */ else if ( strcmp(argv[i],"-x")==0 || strcmp(argv[i],"--omit-newlines")==0 ) p.omit_newlines=1; /* -y, --bind: control socket binding port or path */ else if ( strcmp(argv[i],"-y")==0 || strcmp(argv[i],"--bind")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } ctrlport=argv[i]; } /* -C, --control: hypervisor socket binding port or path */ else if ( strcmp(argv[i],"-C")==0 || strcmp(argv[i],"--control")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } hypcport=argv[i]; } /* -L, --log: name of output log file or '-' or '-[12]' */ else if ( strcmp(argv[i],"-L")==0 || strcmp(argv[i],"--log")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } logfile=argv[i]; } /* -V, --verbose: increase log level by one: */ else if ( strcmp(argv[i],"-V")==0 || strcmp(argv[i],"--verbose")==0 ) log.loglevel++; /* -W, --log-level: log level, some non-negative integer */ else if ( strcmp(argv[i],"-W")==0 || strcmp(argv[i],"--log-level")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( sscanf(argv[i],"%d",&log.loglevel)<1 || log.loglevel<0 ) { fprint_err_invarg1(argv[i-1]); return(1); } } /* -T, --tunnel: run pexec as a tunnel daemon: */ else if ( strcmp(argv[i],"-T")==0 || strcmp(argv[i],"--tunnel")==0 ) { if ( i>1 ) { fprint_err_invarg2(argv[i]); return(1); } zeroarg=i+1; mode=PEXEC_MODE_DAEMON; break; } /* -j, --remote: remote control */ else if ( strcmp(argv[i],"-j")==0 || strcmp(argv[i],"--remote")==0 ) { if ( i>1 ) { fprint_err_invarg2(argv[i]); return(1); } zeroarg=i+1; mode=PEXEC_MODE_REMOTECONTROL; break; } /* -H, --hypervisor: hypervisor mode */ else if ( strcmp(argv[i],"-H")==0 || strcmp(argv[i],"--hypervisor")==0 ) { if ( i>1 ) { fprint_err_invarg2(argv[i]); return(1); } zeroarg=i+1; mode=PEXEC_MODE_HYPERVISOR; break; } /* --: option delimiter */ else if ( strcmp(argv[i],"--")==0 ) { zeroarg=i+1; if ( zeroarg>=argc ) zeroarg=-1; break; } /* invalid argument */ else if ( argv[i][0]=='-' ) { fprint_err_invarg0(argv[i]); return(1); } /* the first real command */ else { zeroarg=i; break; } } /* command has not been supplied, exiting. */ if ( zeroarg<0 ) return(0); /* The default mode for pexec: execution of the command(s): */ if ( mode == PEXEC_MODE_DEFAULT ) { remoteshell *rshells,*rs; int nrshell,r; int status,sock,hsck; char *pctrlport; int is_rhosts_defined,no_touch_std; if ( rhosts==NULL ) { rhosts=(remotehost *)xmalloc(sizeof(remotehost)*1); rhosts[0].hostspec=NULL; rhosts[0].num_processes=nrhost; nrhost=1; is_rhosts_defined=0; } else is_rhosts_defined=!0; if ( p.rshcmd==NULL ) p.rshcmd=xstrdup(PEXEC_DEFAULT_RSH); p.rshargs=tokenize_spaces_dyn(p.rshcmd); p.rsh=p.rshargs[0]; /* only one parameter source can be defined: */ if ( list != NULL && listfile != NULL ) { fprintf(stderr,_("%s: error: both parameter list and list file are defined.\n"),progbasename); return(1); } /* parameters are taken from the command line argument(s): */ else if ( list != NULL ) { pnames=tokenize_spaces_dyn(list); for ( nparam=0 ; pnames != NULL && pnames[nparam] != NULL ; ) nparam++; params=(parameter *)xmalloc(sizeof(parameter)*nparam); for ( i=0 ; i0 ) ) { free(line); continue; } else if ( listcolumn<0 ) { params=(parameter *)xrealloc(params,sizeof(parameter)*(nparam+1)); params[nparam].name=xstrdup(line); free(line); nparam++; } else { tokens=tokenize_spaces_dyn(line); if ( tokens==NULL ) { free(line); continue; } for ( ntoken=0 ; tokens[ntoken] != NULL ; ) ntoken++; if ( listcolumn>=ntoken ) { free(tokens); free(line); continue; } params=(parameter *)xrealloc(params,sizeof(parameter)*(nparam+1)); params[nparam].name=xstrdup(tokens[listcolumn]); free(tokens); free(line); nparam++; } } /* fprintf(stderr,"nparam=%d\n",nparam); for ( i=0 ; i0 && is_multi_commands && nparam != ncmd ) { fprintf(stderr,_("%s: error: number of parameters and commands mismatch.\n"),progbasename); return(1); } else if ( is_multi_commands && nparam>0 ) { for ( i=0 ; i0 && is_shell_commands ) { for ( i=0 ; i0 ) { for ( i=0 ; i0 ) log.fwlog=stderr; else { log.fwlog=NULL; log.loglevel=0; } if ( prio > 0 ) { i=setpriority(PRIO_PROCESS,0,prio-128); if ( i<0 ) { fprintf(stderr,_("%s: warning: unable to set scheduling priority to %d.\n"),progbasename,prio-128); } } if ( ctrlport != NULL ) { sock=remote_control_port_bind(ctrlport,&pctrlport,1,1); if ( sock<0 ) { fprintf(stderr,_("%s: error: unable to create or bind control socket to %s.\n"),progbasename,ctrlport); return(1); } } else { sock=-1; pctrlport=NULL; } p.fallback_to_die=1; nrshell=nrhost; rshells=(remoteshell *)xmalloc(sizeof(remoteshell)*nrshell); hsck=-1; for ( i=0 ; i=0 ) listen(sock,256); p.log=&log; /* well, it's turned out to be necessary: */ signal(SIGPIPE,SIG_IGN); ret=pexec_do_parallelized_execution(&p,params,nparam,rshells,nrshell,sock,hsck); for ( i=0,rs=rshells ; ipid < 0 ) continue; /* send the exit command via the tunnel to stop child pexec: */ hprintf(rs->fhsend,"exit\n"); /* wait for the remote shell process to die: */ waitpid(rs->pid,&status,0); } if ( rshells != NULL ) free(rshells); if ( log.fwlog != NULL && fileno(log.fwlog) != 1 && fileno(log.fwlog) != 2 ) fclose(log.fwlog); if ( p.fwout != NULL && fileno(p.fwout) != 1 && fileno(p.fwout) != 2 ) fclose(p.fwout); if ( p.fwerr != NULL && fileno(p.fwerr) != 1 && fileno(p.fwerr) != 2 ) fclose(p.fwerr); if ( sock>=0 ) { close(sock); if ( pctrlport != NULL && is_unix_socket_name(pctrlport) ) unlink(pctrlport); } if ( hsck>=0 ) { hprintf(hsck,"close\n"); fdwait(hsck,0); i=close(hsck); /* fprintf(stderr,"pexec: default: hypervisor socket: close()=%d\n",i); */ } if ( pnames != NULL ) free(pnames); if ( list != NULL ) free(list); if ( params != NULL ) free(params); if ( pctrlport != NULL ) free(pctrlport); free(p.rshcmd); free(p.rshargs); for ( i=0 ; i=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( strcmp(argv[i],PEXEC_ISTR_AUTO)==0 ) num_processes=PEXEC_MNP_AUTO; else if ( strcmp(argv[i],PEXEC_ISTR_MANAGED)==0 ) num_processes=PEXEC_MNP_MANAGED; else if ( strcmp(argv[i],PEXEC_ISTR_NCPU)==0 ) num_processes=PEXEC_MNP_NCPU; else if ( sscanf(argv[i],"%d",&num_processes)<1 || num_processes <= 0 ) { fprint_err_invarg1(argv[i-1]); return(1); } } /* -y, --bind: control socket binding port or path */ else if ( strcmp(argv[i],"-y")==0 || strcmp(argv[i],"--bind")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } ctrlport=argv[i]; } /* -C, --control: hypervisor socket binding port or path */ else if ( strcmp(argv[i],"-C")==0 || strcmp(argv[i],"--control")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } hypcport=argv[i]; } /* -z, --nice: priority of pexec and the (initial) priority of the processes */ else if ( strcmp(argv[i],"-z")==0 || strcmp(argv[i],"--nice")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( sscanf(argv[i],"%d",&prio)<1 ) { fprint_err_invarg1(argv[i-1]); return(1); } prio+=128; } else { fprint_err_invarg0(argv[i]); return(1); } } if ( num_processes==PEXEC_MNP_AUTO || num_processes==PEXEC_MNP_MANAGED ) { if ( hypcport==NULL ) hypcport=PEXEC_DEFAULT_HYPERVISOR_SOCKET; hsck=remote_control_port_connect(hypcport); if ( hsck<0 && num_processes==PEXEC_MNP_MANAGED ) { fprintf(stderr,_("%s: error: unable to connect hypervisor socket '%s'.\n"),progbasename,hypcport); return(1); } else if ( hsck<0 ) { num_processes=PEXEC_MNP_NCPU; hsck=-1; } else num_processes=0; } else hsck=-1; /* num_processes can only be PEXEC_MNP_NCPU if negative: */ if ( num_processes < 0 ) num_processes=get_number_of_cpus(); if ( ctrlport != NULL ) { sock=remote_control_port_bind(ctrlport,&pctrlport,1,1); if ( sock<0 ) { fprintf(stderr,_("%s: error: unable to create or bind control socket to %s.\n"),progbasename,ctrlport); return(1); } } else { sock=-1; pctrlport=NULL; } fhrecv=fileno(stdin); /* always 0 */ fhsend=fileno(stdout); /* always 1 */ if ( pctrlport != NULL ) bind_variable_export(ctrlenv,pctrlport); if ( sock>=0 ) listen(sock,256); if ( prio > 0 ) { i=setpriority(PRIO_PROCESS,0,prio-128); /* if ( i<0 ) { fprintf(stderr,_("%s: warning: unable to set scheduling priority to %d.\n"),progbasename,prio-128); } */ } /* well, it's turned out to be necessary: */ signal(SIGPIPE,SIG_IGN); pexec_daemon_main_loop(fhrecv,fhsend,num_processes,sock,hsck); if ( sock>=0 ) { close(sock); if ( pctrlport != NULL && is_unix_socket_name(pctrlport) ) unlink(pctrlport); } if ( hsck>=0 ) { hprintf(hsck,"close\n"); fdwait(hsck,0); i=close(hsck); } if ( pctrlport != NULL ) free(pctrlport); return(0); } else if ( mode == PEXEC_MODE_REMOTECONTROL ) { char *ctrlport; int sock; int task; char *file,*name; FILE *fr,*fw; int azeroarg; ctrlport=NULL; task=PEXEC_REMOTE_STATUS; /* default */ name=NULL; file=NULL; is_shell_commands=0; azeroarg=-1; for ( i=zeroarg ; i=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } ctrlport=argv[i]; } else if ( strcmp(argv[i],"-t")==0 || strcmp(argv[i],"--status")==0 ) task=PEXEC_REMOTE_STATUS; else if ( strcmp(argv[i],"-l")==0 || strcmp(argv[i],"--lock")==0 || strcmp(argv[i],"--mutex-lock")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } task=PEXEC_REMOTE_LOCK; name=argv[i]; } else if ( strcmp(argv[i],"-u")==0 || strcmp(argv[i],"--unlock")==0 || strcmp(argv[i],"--mutex-unlock")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } task=PEXEC_REMOTE_UNLOCK; name=argv[i]; } else if ( strcmp(argv[i],"-m")==0 || strcmp(argv[i],"--mutex")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } name=argv[i]; } else if ( strcmp(argv[i],"-d")==0 || strcmp(argv[i],"--dump")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } task=PEXEC_REMOTE_DUMP; file=argv[i]; } else if ( strcmp(argv[i],"-s")==0 || strcmp(argv[i],"--save")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } task=PEXEC_REMOTE_SAVE; file=argv[i]; } else if ( strcmp(argv[i],"-c")==0 || strcmp(argv[i],"--shell-command")==0 ) is_shell_commands=1; else if ( strcmp(argv[i],"-a")==0 || strcmp(argv[i],"--atomic")==0 ) task=PEXEC_REMOTE_ATOMIC; else if ( strcmp(argv[i],"--")==0 && task==PEXEC_REMOTE_ATOMIC ) { azeroarg=i+1; break; } else if ( argv[i][0]=='-' ) { fprint_err_invarg0(argv[i]); return(1); } else if ( task==PEXEC_REMOTE_ATOMIC ) { azeroarg=i; break; } else { fprint_err_invarg0(argv[i]); return(1); } } if ( ctrlport==NULL || strcmp(ctrlport,PEXEC_ISTR_AUTO)==0 ) ctrlport=getenv(ctrlenv); if ( ctrlport==NULL ) { fprintf(stderr,_("%s: error: connection port has not been defined or set in the environment.\n"),progbasename); return(1); } sock=remote_control_port_connect(ctrlport); if ( sock<0 ) { fprintf(stderr,_("%s: error: unable to connect to '%s'.\n"),progbasename,ctrlport); return(1); } switch ( task ) { case PEXEC_REMOTE_STATUS: ret=remote_status(sock,stdout); break; case PEXEC_REMOTE_LOCK: ret=remote_lock(sock,NULL,name); break; case PEXEC_REMOTE_UNLOCK: ret=remote_unlock(sock,NULL,name); break; case PEXEC_REMOTE_DUMP: if ( file != NULL && (fr=fopen(file,"rb")) != NULL && name != NULL ) { ret=remote_copy(sock,name,fr,stdout); fclose(fr); } else { fprintf(stderr,_("%s: error: invalid or unspecified input file (%s).\n"),progbasename,(file==NULL?"-":file)); ret=1; } break; case PEXEC_REMOTE_SAVE: if ( file != NULL && (fw=fopen(file,"wb")) != NULL && name != NULL ) { ret=remote_copy(sock,name,stdin,fw); fclose(fw); } else { fprintf(stderr,_("%s: error: invalid or unspecified output file (%s).\n"),progbasename,(file==NULL?"-":file)); ret=1; } break; case PEXEC_REMOTE_ATOMIC: if ( name != NULL ) remote_lock(sock,NULL,name); if ( azeroarg=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( strcmp(argv[i],PEXEC_ISTR_AUTO)==0 || strcmp(argv[i],PEXEC_ISTR_NCPU)==0 ) num_processes=PEXEC_MNP_NCPU; else if ( sscanf(argv[i],"%d",&num_processes)<1 || num_processes <= 0 ) { fprint_err_invarg1(argv[i-1]); return(1); } } /* -l, --load: use load */ else if ( strcmp(argv[i],"-l")==0 || strcmp(argv[i],"--load")==0 || strcmp(argv[i],"--use-load")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( strcmp(argv[i],"0")==0 || strcmp(argv[i], "1m")==0 || strcmp(argv[i], "1min")==0 ) use_load=0; else if ( strcmp(argv[i],"1")==0 || strcmp(argv[i], "5m")==0 || strcmp(argv[i], "5min")==0 ) use_load=1; else if ( strcmp(argv[i],"2")==0 || strcmp(argv[i],"15m")==0 || strcmp(argv[i],"15min")==0 ) use_load=2; else { fprint_err_invarg1(argv[i-1]); return(1); } } /* -C, --control: hypervisor socket binding port or path */ else if ( strcmp(argv[i],"-C")==0 || strcmp(argv[i],"--control")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } hypcport=argv[i]; } /* -L, --log: name of output log file or '-' or '-[12]' */ else if ( strcmp(argv[i],"-L")==0 || strcmp(argv[i],"--log")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } logfile=argv[i]; } /* -V, --verbose: increase log level by one: */ else if ( strcmp(argv[i],"-V")==0 || strcmp(argv[i],"--verbose")==0 ) log.loglevel++; /* -W, --log-level: log level, some non-negative integer */ else if ( strcmp(argv[i],"-W")==0 || strcmp(argv[i],"--log-level")==0 ) { if ( (++i)>=argc ) { fprint_err_invarg1(argv[i-1]);return(1); } else if ( sscanf(argv[i],"%d",&log.loglevel)<1 || log.loglevel<0 ) { fprint_err_invarg1(argv[i-1]); return(1); } } /* -f, --fifo: first in first out queue processing: */ else if ( strcmp(argv[i],"-f")==0 || strcmp(argv[i],"--fifo")==0 ) use_fifo=1; else if ( strcmp(argv[i],"-s")==0 || strcmp(argv[i],"--lifo")==0 || strcmp(argv[i],"--stack")==0 ) use_fifo=0; /* start: start in daemon mode (i.e. detach from terminal): */ else if ( strcmp(argv[i],"start")==0 ) startstop=0; /* stop: stop running but detached pexec hypervisor: */ else if ( strcmp(argv[i],"stop")==0 ) startstop=1; else { fprint_err_invarg0(argv[i]); return(1); } } if ( num_processes <= 0 ) num_processes=get_number_of_cpus(); if ( hypcport==NULL ) hypcport=PEXEC_DEFAULT_HYPERVISOR_SOCKET; /* explicit stop: send stop request to the hypervisor daemon: */ if ( startstop>0 ) { sock=remote_control_port_connect(hypcport); if ( sock<0 ) { fprintf(stderr,_("%s: error: unable to connect to hypervisor control socket '%s' in order to stop the service.\n"),progbasename,hypcport); return(1); } pexec_hypervisor_stop(sock); close(sock); return(0); } sock=remote_control_port_bind(hypcport,NULL,0,1); if ( sock<0 ) { fprintf(stderr,_("%s: error: unable to create or bind control socket to %s.\n"),progbasename,hypcport); return(1); } /* explicit start: put the process into background: */ if ( ! (startstop<0) ) background(0,0); if ( sock>=0 ) listen(sock,256); /* well, it's turned out to be necessary: */ signal(SIGPIPE,SIG_IGN); pexec_hypervisor_main_loop(sock,num_processes,use_load,use_fifo); if ( is_unix_socket_name(hypcport) ) unlink(hypcport); return(0); } else { fprintf(stderr,_("%s: error: internal: invalid mode code %d.\n"),progbasename,mode); return(2); } } /*****************************************************************************/ pexec-1.0rc8/src/str.h0000644000175000017500000000470411103146274013263 0ustar apalapal/*****************************************************************************/ /* str.h */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Some functions related to (dynamic) string handling. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2006; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #ifndef __STR_H_INCLUDED #define __STR_H_INCLUDED 1 /*****************************************************************************/ /* strkcpy(): It works like strncpy() but ensures that 'out' is zero-terminated (therefore, the length of 'out' is always _less_ than 'max'). */ char * strkcpy(char *out,char *in,int max); /* strappend(): Appends the string 'cat' to the dynamically allocated string 'string'. 'string' can be NULL, in this case, the function works like strdup(). */ int strappend(char **string,char *cat); /* strappendf(): It is a combination of realloc(), strcat() and sprintf(). Appends the printf-formatted argument 'format' to the dynamically allocated string 'string'. It is a bit primitive, therefore use only if long-long strings could not occur (otherwise it also works, but can be slow). */ int strappendf(char **string,char *format,...); /* vstrappendf(): */ int vstrappendf(char **string,char *format,va_list ap); /*****************************************************************************/ #endif /*****************************************************************************/ pexec-1.0rc8/src/numhash.c0000644000175000017500000003667011104653046014121 0ustar apalapal/*****************************************************************************/ /* numhash.c */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Hash table for numerical (integer) keys */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2007; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #include #include #include #include "numhash.h" #ifdef HAVE_LIBINTL_H #include #define _(string) gettext(string) #else #define _(string) string #endif #define NUMHASH_ABORT_ON_MALLOC #ifdef NUMHASH_ABORT_ON_MALLOC #define realloc_check(ptr,size) \ do \ { if ( ptr==NULL && size>0 ) \ { fprintf(stderr,"numhash.c: %s.\n",_("memory exhausted"));\ abort(); \ } \ } while(0) #else #define realloc_check(ptr,size) #endif #define malloc_check(ptr) realloc_check(ptr,1) /*****************************************************************************/ #define NUMHASH_BIT(bitsize,depth,off,value) \ (((value)>>((depth)*((((bitsize)-1)/(depth))-(off))))&((1<<(depth))-1)) #define NUMHASH_IOF(bitsize,depth,off) \ ((off)<((bitsize)+(depth)-1)/(depth)) #define NUMHASH_LST(bitsize,depth,off) \ ((off)==((bitsize)-1)/(depth)) #define NUMHASH_RLF(bitsize,depth,off) \ ((off)<((bitsize)-1)/(depth)) #define NUMHASH_NTN(bitsize,depth,off) \ (1<<((off)?(depth):((bitsize)-(depth)*(((bitsize)-1)/(depth))))) #define NUMHASH_LCB(bitsize,depth,off) \ (1<<((depth)*(((bitsize)-1)/(depth)-(off)))) /*****************************************************************************/ int numhash_search(numhashtable *nt,int value,void **ret) { int off,bit; numhashnode *nh; if ( nt==NULL ) return(0); off=0; nh=&nt->table; if ( nt->bitsizebitsize)-1); do { /*shift=depth*(((bitsize-1)/depth)-off); bit=(value >> shift) & ((1<bitsize,nt->depth,off,value); if ( nh->node.leaves==NULL ) return(0); off++; nh=&nh->node.leaves[bit]; } while ( off*nt->depth < nt->bitsize ); if ( ret != NULL ) *ret=nh->node.data; return(nh->nchild); } /*****************************************************************************/ int numhash_init(numhashtable *nt,int bitsize,int depth) { nt->table.node.leaves=NULL; nt->table.node.data=NULL; nt->table.nchild=0; nt->depth=depth; nt->bitsize=bitsize; return(0); } /*****************************************************************************/ int numhash_add(numhashtable *nt,int value,void *data) { int off,bit,bitsize,depth,shift,tnode,nodesize; numhashnode *nh,*tree[64]; if ( nt==NULL ) return(-1); off=0; nh=&nt->table; depth=nt->depth; bitsize=nt->bitsize; tnode=0; if ( bitsize> shift) & ((1<node.leaves==NULL ) { nodesize=(1<node.leaves=malloc(sizeof(numhashnode)*nodesize); malloc_check(nh->node.leaves); memset(nh->node.leaves,0,sizeof(numhashnode)*nodesize); } off++; tree[tnode]=nh; tnode++; nh=&nh->node.leaves[bit]; } while ( off*depth < bitsize ); nh->node.data=data; if ( nh->nchild ) return(0); else { nh->nchild=1; while ( tnode>0 ) { tnode--; (tree[tnode]->nchild)++; }; return(1); } } /*****************************************************************************/ int numhash_total(numhashtable *nt) { return(nt->table.nchild); } /*****************************************************************************/ int numhash_remove(numhashtable *nt,int value) { int off,bit,bitsize,depth,shift,tnode; numhashnode *nh,*tree[64]; if ( nt==NULL ) return(0); off=0; nh=&nt->table; depth=nt->depth; bitsize=nt->bitsize; tnode=0; if ( bitsize> shift) & ((1<node.leaves==NULL ) return(0); off++; tree[tnode]=nh; tnode++; nh=&nh->node.leaves[bit]; } while ( off*depth < bitsize ); if ( nh->nchild <= 0 ) return(0); nh->nchild=0; while ( tnode>0 ) { tnode--; nh=tree[tnode]; nh->nchild--; if ( nh->nchild <= 0 ) { free(nh->node.leaves); nh->node.leaves=NULL; } }; return(1); } /*****************************************************************************/ static int numhash_get_terminal_free(numhashtable *nt,int dir) { int capacity,cdepth,i,k,off,shift; numhashnode *nh; if ( (1<bitsize) <= nt->table.nchild ) return(-1); /* no free node */ off=0; nh=&nt->table; if ( nh->node.leaves==NULL ) return(0); /* no root node: 0 is the smallest free */ for ( off=0,k=0 ; nh != NULL ; ) { shift=nt->depth*(((nt->bitsize-1)/nt->depth)-off); cdepth=(nt->bitsize-shiftdepth?nt->bitsize-shift:nt->depth); capacity=(1<=0 ) /* forward */ { for ( i=0 ; i<(1<node.leaves[i].nchild <= 0 ) return(k); else if ( nh->node.leaves[i].nchild < capacity ) break; else k+=capacity; } if ( i==(1<=0 ; i-- ) { if ( nh->node.leaves[i].nchild <= 0 ) return((1<bitsize)-1-k); else if ( nh->node.leaves[i].nchild < capacity ) break; else k+=capacity; } if ( i<0 ) return(-1); /* theoretically unreachable point */ } nh=&nh->node.leaves[i]; off++; }; return(-1); /* theoretically unreachable point */ } int numhash_get_smallest_free(numhashtable *nt) { return(numhash_get_terminal_free(nt,+1)); } int numhash_get_largest_free(numhashtable *nt) { return(numhash_get_terminal_free(nt,-1)); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ static int numhash_get_terminal_used(numhashtable *nt,int dir) { int capacity,cdepth,i,k,off,shift,tnd; numhashnode *nh; if ( nt->table.nchild <= 0 ) return(-1); /* no used node */ off=0; nh=&nt->table; if ( nh->node.leaves==NULL ) return(-1); /* no root node, so no used node */ tnd=(nt->bitsize-1)/nt->depth; for ( off=0,k=0 ; nh != NULL ; ) { shift=nt->depth*(((nt->bitsize-1)/nt->depth)-off); cdepth=(nt->bitsize-shiftdepth?nt->bitsize-shift:nt->depth); capacity=(1<=0 ) /* forward */ { for ( i=0 ; i<(1<node.leaves[i].nchild && offnode.leaves[i].nchild ) return(k); else k+=capacity; } if ( i==(1<=0 ; i-- ) { if ( nh->node.leaves[i].nchild && offnode.leaves[i].nchild ) return((1<bitsize)-1-k); else k+=capacity; } if ( i<0 ) return(-1); /* theoretically unreachable point */ } nh=&nh->node.leaves[i]; off++; }; return(-1); /* theoretically unreachable point */ } int numhash_get_smallest_used(numhashtable *nt) { return(numhash_get_terminal_used(nt,+1)); } int numhash_get_largest_used(numhashtable *nt) { return(numhash_get_terminal_used(nt,-1)); } /*****************************************************************************/ static int numhash_local_walk(numhashnode *nh,int off,int num, int depth,int bitsize,int (*callback)(int,void *,void *),void *param) { int shift,cdepth,i,ret; if ( nh->node.leaves==NULL ) return(0); shift=depth*(((bitsize-1)/depth)-off); cdepth=(bitsize-shift0 ) { for ( i=0 ; i<(1<node.leaves[i].node.leaves != NULL ) ret+=numhash_local_walk(&nh->node.leaves[i],off+1, num|(i<node.leaves[i].nchild>0 ) { callback(num+i,nh->node.leaves[i].node.data,param); ret++; } } } else { for ( i=0 ; i<(1<node.leaves[i].nchild>0 ) ret++; } } return(ret); } static int numhash_local_walk_desc(numhashnode *nh,int off,int num, int depth,int bitsize,int (*callback)(int,void *,void *),void *param) { int shift,cdepth,i,ret; if ( nh->node.leaves==NULL ) return(0); shift=depth*(((bitsize-1)/depth)-off); cdepth=(bitsize-shift0 ) { for ( i=(1<=0 ; i-- ) { if ( nh->node.leaves[i].node.leaves != NULL ) ret+=numhash_local_walk_desc(&nh->node.leaves[i],off+1, num|(i<=0 ; i-- ) { if ( nh->node.leaves[i].nchild>0 ) { callback(num+i,nh->node.leaves[i].node.data,param); ret++; } } } else { for ( i=0 ; i<(1<node.leaves[i].nchild>0 ) ret++; } } return(ret); } int numhash_walk(numhashtable *nt, int (*callback)(int,void *,void *),void *param) { int ret; ret=numhash_local_walk(&nt->table,0,0,nt->depth,nt->bitsize,callback,param); return(ret); } int numhash_walk_asc(numhashtable *nt, int (*callback)(int,void *,void *),void *param) { return(numhash_walk(nt,callback,param)); } int numhash_walk_desc(numhashtable *nt, int (*callback)(int,void *,void *),void *param) { int ret; ret=numhash_local_walk_desc(&nt->table,0,0,nt->depth,nt->bitsize,callback,param); return(ret); } int numhash_walk_dir(numhashtable *nt, int (*callback)(int,void *,void *),void *param,int dir) { int ret; if ( dir>=0 ) ret=numhash_local_walk(&nt->table,0,0,nt->depth,nt->bitsize,callback,param); else ret=numhash_local_walk_desc(&nt->table,0,0,nt->depth,nt->bitsize,callback,param); return(ret); } /*****************************************************************************/ int numhash_first(numhashtable *nt) { return(numhash_get_terminal_used(nt,+1)); } int numhash_first_wdata(numhashtable *nt,void **dret) { int c; c=numhash_get_terminal_used(nt,+1); if ( c>=0 && dret != NULL ) numhash_search(nt,c,dret); return(c); } int numhash_last(numhashtable *nt) { return(numhash_get_terminal_used(nt,-1)); } int numhash_last_wdata(numhashtable *nt,void **dret) { int c; c=numhash_get_terminal_used(nt,-1); if ( c>=0 && dret != NULL ) numhash_search(nt,c,dret); return(c); } static int numhash_local_first(numhashtable *nt,numhashnode *nh, int fcc,int off,void **dret) { int i,ntn,lcb,ret; if ( nh->node.leaves==NULL ) return(-1); ntn=NUMHASH_NTN(nt->bitsize,nt->depth,off); lcb=NUMHASH_LCB(nt->bitsize,nt->depth,off); ret=fcc; for ( i=0 ; inode.leaves[i].nchild ) { if ( NUMHASH_RLF(nt->bitsize,nt->depth,off) ) { nh=&nh->node.leaves[i]; off++; ntn=NUMHASH_NTN(nt->bitsize,nt->depth,off); i=0; lcb=lcb>>nt->depth; } else { if ( dret != NULL ) *dret=nh->node.leaves[i].node.data; return(ret); } } else { i++; ret+=lcb; } } return(-1); } static int numhash_local_last(numhashtable *nt,numhashnode *nh, int fcc,int off,void **dret) { int i,ntn,lcb,ret; if ( nh->node.leaves==NULL ) return(-1); ntn=NUMHASH_NTN(nt->bitsize,nt->depth,off); lcb=NUMHASH_LCB(nt->bitsize,nt->depth,off); ret=fcc+lcb*(ntn-1); for ( i=ntn-1 ; i>=0 ; ) { if ( nh->node.leaves[i].nchild ) { if ( NUMHASH_RLF(nt->bitsize,nt->depth,off) ) { nh=&nh->node.leaves[i]; off++; ntn=NUMHASH_NTN(nt->bitsize,nt->depth,off); i=ntn-1; lcb=lcb>>nt->depth; ret+=lcb*(ntn-1); } else { if ( dret != NULL ) *dret=nh->node.leaves[i].node.data; return(ret); } } else { i--; ret-=lcb; } } return(-1); } static int numhash_local_nextprev(numhashtable *nt,numhashnode *nh0, int value,int off,int fcc,int *ret,int dir,void **dret) { numhashnode *nh; int c,i,k,is_real_leaf,ntn,lcb; if ( nh0->node.leaves==NULL ) return(0); k =NUMHASH_BIT(nt->bitsize,nt->depth,off,value); nh=&nh0->node.leaves[k]; lcb=NUMHASH_LCB(nt->bitsize,nt->depth,off); is_real_leaf=NUMHASH_RLF(nt->bitsize,nt->depth,off); if ( nh->node.leaves != NULL && is_real_leaf ) { c=numhash_local_nextprev(nt,nh,value,off+1,fcc+k*lcb,ret,dir,dret); if ( c ) return(1); } ntn=NUMHASH_NTN(nt->bitsize,nt->depth,off); if ( dir>=0 ) /* next */ { for ( i=k+1 ; inode.leaves[i]; if ( ! is_real_leaf && nh->nchild ) { *ret=fcc+i; if ( dret != NULL ) *dret=nh->node.data; return(1); } else if ( is_real_leaf && nh->nchild ) { *ret=numhash_local_first(nt,nh,fcc+i*lcb,off+1,dret); return(1); } } } else /* prev */ { for ( i=k-1 ; i>=0 ; i-- ) { nh=&nh0->node.leaves[i]; if ( ! is_real_leaf && nh->nchild ) { *ret=fcc+i; if ( dret != NULL ) *dret=nh->node.data; return(1); } else if ( is_real_leaf && nh->nchild ) { *ret=numhash_local_last(nt,nh,fcc+i*lcb,off+1,dret); return(1); } } } return(0); } int numhash_next_wdata(numhashtable *nt,int value,void **dret) { int ret,c; c=numhash_local_nextprev(nt,&nt->table,value,0,0,&ret,+1,dret); if ( c ) return(ret); else return(-1); } int numhash_prev_wdata(numhashtable *nt,int value,void **dret) { int ret,c; c=numhash_local_nextprev(nt,&nt->table,value,0,0,&ret,-1,dret); if ( c ) return(ret); else return(-1); } int numhash_next(numhashtable *nt,int value) { int ret,c; c=numhash_local_nextprev(nt,&nt->table,value,0,0,&ret,+1,NULL); if ( c ) return(ret); else return(-1); } int numhash_prev(numhashtable *nt,int value) { int ret,c; c=numhash_local_nextprev(nt,&nt->table,value,0,0,&ret,-1,NULL); if ( c ) return(ret); else return(-1); } int numhash_loop_start(numhashtable *nt,int dir,void **ret) { if ( dir>=0 ) return(numhash_first_wdata(nt,ret)); else return(numhash_last_wdata(nt,ret)); } int numhash_loop_next(numhashtable *nt,int dir,int key,void **ret) { if ( dir>=0 ) return(numhash_next_wdata(nt,key,ret)); else return(numhash_prev_wdata(nt,key,ret)); } /*****************************************************************************/ static int numhash_local_free(numhashnode *nh,int off,int depth,int bitsize) { int shift,cdepth,i; if ( nh->node.leaves==NULL ) return(0); shift=depth*(((bitsize-1)/depth)-off); cdepth=(bitsize-shift0 ) { for ( i=0 ; i<(1<node.leaves[i].node.leaves != NULL ) numhash_local_free(&nh->node.leaves[i], off+1,depth,bitsize); } } free(nh->node.leaves); return(0); } int numhash_free(numhashtable *nt) { numhash_local_free(&nt->table,0,nt->depth,nt->bitsize); numhash_init(nt,nt->bitsize,nt->depth); return(0); } /*****************************************************************************/ pexec-1.0rc8/src/str.c0000644000175000017500000000620011104112572013242 0ustar apalapal/*****************************************************************************/ /* str.c */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Some functions related to (dynamic) string handling. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Copyright (C) 2006; Pal, A. (apal@szofi.elte.hu) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This library 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 the program. If not, see . */ /*****************************************************************************/ #include #include #include #include #include "str.h" #ifdef HAVE_LIBINTL_H #include #define _(string) gettext(string) #else #define _(string) string #endif #define STR_ABORT_ON_MALLOC #ifdef STR_ABORT_ON_MALLOC #define realloc_check(ptr,size) \ do \ { if ( ptr==NULL && size>0 ) \ { fprintf(stderr,"str.c: %s.\n",_("memory exhausted"));\ abort(); \ } \ } while(0) #else #define realloc_check(ptr,size) #endif #define malloc_check(ptr) realloc_check(ptr,1) /*****************************************************************************/ char * strkcpy(char *out,char *in,int size) { strncpy(out,in,size); out[size-1]=0; return(out); } /*****************************************************************************/ int strappend(char **str,char *cat) { int l1,l2; if ( str==NULL ) return(-1); else if ( *str==NULL ) { *str=strdup(cat); malloc_check(*str); return(0); } else { l1=strlen(*str); l2=strlen(cat); *str=realloc(*str,l1+l2+1); malloc_check(*str); strcpy((*str)+l1,cat); return(0); } } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ int vstrappendf(char **str,char *fmt,va_list ap) { int n,l,size; if ( str==NULL ) return(0); if ( *str==NULL ) l=0; else l=strlen(*str); size=128; *str=realloc(*str,l+size); realloc_check(*str,l+size); if ( *str==NULL ) return(-1); while ( 1 ) { n=vsnprintf((*str)+l,size,fmt,ap); if ( n>-1 && n-1 ) size=n+1; else size=size*2; if ( (*str=realloc(*str,l+size))==NULL ) return(-1); }; return(0); } int strappendf(char **str,char *fmt,...) { int ret; va_list ap; va_start(ap,fmt); ret=vstrappendf(str,fmt,ap); va_end(ap); return(ret); } /*****************************************************************************/ pexec-1.0rc8/COPYING0000644000175000017500000007733011077127614012562 0ustar apalapal GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS pexec-1.0rc8/configure.ac0000644000175000017500000000704511223130154013773 0ustar apalapal# Initialize autoconf: AC_INIT(pexec, 1.0rc8, apal@szofi.net) # our default $(CFLAGS) are: CFLAGS="-Wall -pedantic -O3 -D_GNU_SOURCE" # check compiler: AC_PROG_CC # check used headers: AC_CHECK_HEADERS(ctype.h) AC_CHECK_HEADERS(errno.h) AC_CHECK_HEADERS(signal.h) AC_CHECK_HEADERS(stdarg.h) AC_CHECK_HEADERS(time.h) AC_CHECK_HEADERS(sys/resource.h) AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/un.h) AC_CHECK_HEADERS(sys/wait.h) AC_CHECK_HEADERS(fcntl.h) AC_CHECK_HEADERS(netdb.h) AC_CHECK_HEADERS(netinet/in.h) AC_CHECK_HEADERS(sys/loadavg.h) AC_CHECK_HEADERS(libintl.h) # Some OS-dependent functions: AC_CHECK_LIB(c,setenv) AC_CHECK_LIB(c,putenv) AC_CHECK_LIB(c,socket) AC_CHECK_LIB(socket,socket) AC_CHECK_LIB(c,gethostbyname) AC_CHECK_LIB(nsl,gethostbyname) AC_CHECK_LIB(c,getloadavg) AC_CHECK_LIB(c,gettext) # Debian archiver: AC_MSG_CHECKING([for a debian archiver]) if dpkg-deb --version >/dev/null 2>&1 ; then AC_MSG_RESULT([dpkg-deb]) ac_cv_debian_archiver="yes" DPKG_DEB=dpkg-deb else AC_MSG_RESULT([no]) ac_cv_debian_archiver="no" DPKG_DEB=false fi # help2man utility: AC_MSG_CHECKING([help2man]) if help2man --version >/dev/null 2>&1 ; then AC_MSG_RESULT([help2man]) ac_cv_help2man="yes" HELP2MAN=help2man else AC_MSG_RESULT([no]) ac_cv_help2man="no" HELP2MAN=true fi # Groff: AC_MSG_CHECKING([for a roff formatter]) if groff --version >/dev/null 2>&1 ; then AC_MSG_RESULT([groff]) ac_cv_roff_groff="yes" ROFF=groff else AC_MSG_RESULT([no]) ac_cv_roff_groff="no" ROFF=false fi # Check paper size: AC_MSG_CHECKING([papersize]) if test -x /usr/bin/paperconf ; then PAPERSIZE=`/usr/bin/paperconf` PAPER_WIDTH=`/usr/bin/paperconf -w` PAPER_HEIGHT=`/usr/bin/paperconf -h` elif test -f /etc/papersize ; then PAPERSIZE=`grep -v "^\#" /etc/papersize | head -1` PAPER_WIDTH=0 PAPER_HEIGHT=0 else PAPERSIZE=letter PAPER_WIDTH=612 PAPER_HEIGHT=792 fi AC_MSG_RESULT([$PAPERSIZE: ${PAPER_WIDTH}x${PAPER_HEIGHT}]) xlibs="" if test "$ac_cv_lib_c_socket" == no && test "$ac_cv_lib_socket_socket" == no ; then AC_MSG_ERROR([no proper socket library is available]) elif test "$ac_cv_lib_socket_socket" == yes ; then AC_MSG_NOTICE([using -lsocket]) xlibs="${xlibs} -lsocket" fi if test "$ac_cv_lib_c_gethostbyname" == no && test "$ac_cv_lib_nsl_gethostbyname" == no ; then AC_MSG_ERROR([error: no proper gethostbyname function is available]) elif test "$ac_cv_lib_c_gethostbyname" == yes ; then true elif test "$ac_cv_lib_nsl_gethostbyname" == yes ; then AC_MSG_NOTICE([using -lnsl]) xlibs="${xlibs} -lnsl" fi if test "$ac_cv_lib_c_setenv" == yes ; then CFLAGS="${CFLAGS} -DHAVE_SETENV" fi if test "$ac_cv_header_libintl_h" == yes && test "$ac_cv_lib_c_gettext" == yes ; then CFLAGS="${CFLAGS} -DHAVE_LIBINTL_H" AC_MSG_NOTICE([with internationalization support]) else AC_MSG_NOTICE([no support for internationalization]) fi if test "$ac_cv_header_sys_loadavg_h" == yes ; then CFLAGS="${CFLAGS} -DHAVE_SYS_LOADAVG_H" fi AC_MSG_NOTICE([using CFLAGS: ${CFLAGS}]) DEB_ARCH=`uname -m | sed -e 's/x86_64/amd64/' -e 's/i486/i386/' -e 's/i586/i386/' -e 's/i686/i386/'` AC_MSG_NOTICE([using Debian architecture identifier: ${DEB_ARCH}]) DEB_VERSION=$PACKAGE_VERSION AC_SUBST(XLIBS, ${xlibs}) AC_SUBST(DEB_VERSION, ${DEB_VERSION}) AC_SUBST(DEB_ARCH, ${DEB_ARCH}) AC_SUBST(DPKG_DEB, ${DPKG_DEB}) AC_SUBST(HELP2MAN, ${HELP2MAN}) AC_SUBST(ROFF, ${ROFF}) AC_SUBST(PAPERSIZE, ${PAPERSIZE}) AC_SUBST(PAPER_WIDTH, ${PAPER_WIDTH}) AC_SUBST(PAPER_HEIGHT, ${PAPER_HEIGHT}) AC_OUTPUT([Makefile src/Makefile doc/Makefile]) pexec-1.0rc8/TODO0000644000175000017500000000224211105707075012202 0ustar apalapal PEXEC - List of things to be done. Plans, ideas, whatsoever. ************************************************************* Main code ========= Stuff related to single-host invocation: - handle signals carefully, esp. SIGINT and SIGTERM - poll the status with some signal (SIGUSR1, i.e. like for `dd`) Stuff related to invocation on multiple hosts: - check the termination of the child remote shells - stop all the children if some signal (SIGINT) has been received, incl. the sending of an appropriate command to the daemons for an explicit stop - remote and local files (--local-files): careful implementation Stuff related to hypervisor mode: - what should happen is the hypervisor disconnects? - some info about the current jobs/tasks (in ``machine readable'' form): * name and/or submitter of the job * start timestamp * total number of tasks to be done * number of tasks which are done * current timestamp the same kind of info about the finalized jobs: * name and/or submitter of the job * start & finish timestamp * total number of tasks to be done Generic: - IPv6 support Documentation ============= - more examples - hypervisor mode: examples pexec-1.0rc8/README0000644000175000017500000001051611223130124012357 0ustar apalapal PEXEC -- execute commands or shell scripts in parallel -- Version 1.0rc8 ************************************************************************ The main purpose of the program `pexec` is to execute the given command or shell script (e.g. parsed by `/bin/sh`) in parallel on the local host or on remote hosts, while some of the execution parameters, namely the redirected standard input, output or error and environmental variables can be varied. This program is therefore capable to replace the classic shell loop iterators (e.g. `for ~ in ~ done`, in `bash`) by executing the body of the loop in parallel. Thus, the program `pexec` implements shell level data parallelism in a barely simple form. The capabilities of the program is extended with additional features, such as allowing to define mutual exclusions, do atomic command executions and implement higher level resource and job control. The given program or script is executed as many times as how many parameters are specified in the command line or read from a given parameter file. Each parameter is a simple string which can be used either to pass to the program/script as the value of an environmental variable or it can be used in the format of the file names where the standard input, output or error are optionally redirected from or to. Moreover, more than one shell command script can also be passed to parallel execution, in this case there is no need for parameters or the number of the parameters taken from command line (or read from a parameter file) must be the same as the number of the distinct shell command scripts. The program is capable to automatically swallow the standard output and error (to /dev/null), or collecting them via pipes and dump to the invoker's standard output or error (with optional line headers or trailers which can be used to distinguish between the output of the distinctive processes). The execution on remote hosts is done using a remote shell which both builds a tunnel between the invoking and the remote host(s) and do the authentication and ensures the security (if a secure remote shell is used). Hence, there is no need to run standalone daemons on the remote side: the remote shell itself executes the `pexec` program in daemon mode when the standard input and output of the latter is bound to the remote shell to form a (secure and authenticated) tunnel. In order to avoid unexpected I/O load or to synchronize individual tasks, `pexec` supports mutual exclusions (mutexes) and atomic command executions. The maximum number of simultaneous tasks can be controlled by a hypervisor daemon: with such a daemon, concurrent pexec instances can be launched without an unexpectedly high load. Supported systems and requirements ---------------------------------- Actually, the program has been developed under GNU/Linux (Debian, i386, amd64), and it works on Sun/SunOS and Mac/OSX too. Documentation ------------- See the contents of the directory ./doc for further documentation. With the Makefile found in this directroy, one can generate Postscript and HTML manuals too. The `pexec` project also hosted on http://sourceforge.net. The project website is http://shellpexec.sourceforge.net, while the summary page is found at http://sourceforge.net/projects/shellpexec. Copyright --------- This software was written by Andras Pal. The core part was written while working for the Hungarian-made Automated Telescope (HAT) project to make the data processing more easier and therefore find many-many extrasolar planets. See more information about this project: http://hatnet.hu. Another internal libraries (e.g. numhash.[ch]) were primarily written for other projects. The program `pexec` is a free software, available under the terms of GPLv3 (see ./COPYING for a full license). This program 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. Bug reports, comments and ideas are welcomed, send these to apal@szofi.elte.hu or apal@cfa.harvard.edu.