From c76feb3d09f0c370873fe6182dac211fc166e7bd Mon Sep 17 00:00:00 2001 From: Mark Grondona <mgrondona@llnl.gov> Date: Wed, 20 Feb 2002 01:08:08 +0000 Subject: [PATCH] Initial revision --- Makefile.am | 8 + aclocal.m4 | 140 ++ autogen.sh | 13 + configure | 3560 ++++++++++++++++++++++++++++++++++++ configure.ac | 58 + doc/Makefile.am | 4 + doc/man/man1/srun.1 | 370 ++++ etc/SLURM.conf1 | 19 + etc/SLURM.conf2 | 15 + etc/sample.job.conf2 | 18 + etc/sample.node.conf | 17 + etc/sample.node.conf2 | 49 + etc/sample.part.conf | 12 + etc/sample.part.conf2 | 9 + src/Makefile.am | 7 + src/common/Makefile.am | 10 + src/popt/COPYING | 22 + src/popt/Makefile.am | 12 + src/popt/README | 18 + src/popt/findme.c | 42 + src/popt/findme.h | 10 + src/popt/popt.c | 941 ++++++++++ src/popt/popt.h | 146 ++ src/popt/poptconfig.c | 137 ++ src/popt/popthelp.c | 301 +++ src/popt/poptint.h | 87 + src/popt/poptparse.c | 99 + src/popt/system.h | 55 + src/scancel/Makefile.am | 1 + src/scontrol/Makefile.am | 2 + src/scontrol/Slurm_Admin.c | 318 ++++ src/slurmctld/Makefile.am | 10 + src/slurmd/Makefile.am | 2 + src/squeue/Makefile.am | 1 + src/srun/Makefile.am | 11 + src/srun/env.c | 34 + src/srun/env.h | 15 + src/srun/opt.c | 1018 +++++++++++ src/srun/opt.h | 136 ++ src/srun/srun.c | 36 + stamp-h.in | 1 + 41 files changed, 7764 insertions(+) create mode 100644 Makefile.am create mode 100644 aclocal.m4 create mode 100755 autogen.sh create mode 100755 configure create mode 100644 configure.ac create mode 100644 doc/Makefile.am create mode 100644 doc/man/man1/srun.1 create mode 100644 etc/SLURM.conf1 create mode 100644 etc/SLURM.conf2 create mode 100644 etc/sample.job.conf2 create mode 100644 etc/sample.node.conf create mode 100644 etc/sample.node.conf2 create mode 100644 etc/sample.part.conf create mode 100644 etc/sample.part.conf2 create mode 100644 src/Makefile.am create mode 100644 src/common/Makefile.am create mode 100644 src/popt/COPYING create mode 100644 src/popt/Makefile.am create mode 100644 src/popt/README create mode 100644 src/popt/findme.c create mode 100644 src/popt/findme.h create mode 100644 src/popt/popt.c create mode 100644 src/popt/popt.h create mode 100644 src/popt/poptconfig.c create mode 100644 src/popt/popthelp.c create mode 100644 src/popt/poptint.h create mode 100644 src/popt/poptparse.c create mode 100644 src/popt/system.h create mode 100644 src/scancel/Makefile.am create mode 100644 src/scontrol/Makefile.am create mode 100644 src/scontrol/Slurm_Admin.c create mode 100644 src/slurmctld/Makefile.am create mode 100644 src/slurmd/Makefile.am create mode 100644 src/squeue/Makefile.am create mode 100644 src/srun/Makefile.am create mode 100644 src/srun/env.c create mode 100644 src/srun/env.h create mode 100644 src/srun/opt.c create mode 100644 src/srun/opt.h create mode 100644 src/srun/srun.c create mode 100644 stamp-h.in diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000000..792213e19dd --- /dev/null +++ b/Makefile.am @@ -0,0 +1,8 @@ +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = auxdir include etc + +# don't include lib and doc 'til we have something there +#SUBDIRS = lib src doc + +SUBDIRS = src diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000000..77524b52ec8 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,140 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 + +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN([AM_CONFIG_HEADER], +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<<am_indx=1 +for am_file in <<$1>>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN([AM_MISSING_PROG], +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Define a conditional. + +AC_DEFUN([AM_CONDITIONAL], +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000000..144ac85456c --- /dev/null +++ b/autogen.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# +# $Id$ +# $Source$ +# +echo "running autoheader ... " +autoheader +echo "running automake --add-missing ... " +automake --add-missing +echo "running autoconf ... " +autoconf +echo "removing stale config.status and config.log" +rm -f config.status config.log diff --git a/configure b/configure new file mode 100755 index 00000000000..61aad220b10 --- /dev/null +++ b/configure @@ -0,0 +1,3560 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="src/common/slurm.h" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<EOF +\`configure' configures this package 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 \`..'] + +EOF + + cat <<EOF +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] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --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] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +EOF + + cat <<\EOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +EOF +fi + +if test -n "$ac_init_help"; then + + cat <<\EOF + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 <<EOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.52. Invocation command line was + + $ $0 $@ + +EOF +{ +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` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <<EOF +## ------------ ## +## Core tests. ## +## ------------ ## + +EOF + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:829: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:840: 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:848: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:864: 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:868: 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:874: 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:876: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:878: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:897: 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:899: 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 + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:919: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:922: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_aux_dir= +for ac_dir in auxdir $srcdir/auxdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:948: error: cannot find install-sh or install.sh in auxdir $srcdir/auxdir" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in auxdir $srcdir/auxdir" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:958: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:962: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:971: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:975: error: $ac_config_sub $ac_cv_build_alias failed." >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:980: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +echo "$as_me:987: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:996: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1001: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +echo "$as_me:1008: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:1017: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1022: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +# determine project/version +PROJECT="slurm" + +cat >>confdefs.h <<EOF +#define PROJECT "$PROJECT" +EOF + +VERSION="0.0" + +cat >>confdefs.h <<EOF +#define VERSION "$VERSION" +EOF + +ac_config_headers="$ac_config_headers config.h" + +ac_config_commands="$ac_config_commands default-1" + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:1065: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:1114: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:1125: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:1148: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { { echo "$as_me:1161: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest* +echo "$as_me:1168: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +echo "$as_me:1183: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:1203: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:1207: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +PACKAGE=PROJECT + +VERSION=VERSION + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { { echo "$as_me:1217: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +cat >>confdefs.h <<EOF +#define PACKAGE "$PACKAGE" +EOF + +cat >>confdefs.h <<EOF +#define VERSION "$VERSION" +EOF + +missing_dir=`cd $ac_aux_dir && pwd` +echo "$as_me:1231: checking for working aclocal" >&5 +echo $ECHO_N "checking for working aclocal... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$as_me:1238: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$as_me:1242: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1246: checking for working autoconf" >&5 +echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$as_me:1253: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$as_me:1257: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1261: checking for working automake" >&5 +echo $ECHO_N "checking for working automake... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$as_me:1268: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$as_me:1272: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1276: checking for working autoheader" >&5 +echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$as_me:1283: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$as_me:1287: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1291: checking for working makeinfo" >&5 +echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$as_me:1298: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$as_me:1302: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +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 +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:1314: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1329: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1337: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1340: 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:1349: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1364: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1372: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1375: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1388: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1403: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1411: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1414: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1423: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1438: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1446: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1449: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1462: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1482: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1504: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1507: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1518: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1533: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1541: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1544: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1557: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1572: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1580: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1583: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1595: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1600:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1603: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1606: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1608: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1611: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1613: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1616: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1620 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:1636: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1639: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1642: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1665: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1671: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1676: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1682: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1685: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1692: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1700: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1707: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1709: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1712: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1714: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1717: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1733: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1739: 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:1745: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1751 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1763: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1766: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1778: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1785: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1789: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1795 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1810: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1813: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1816: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1819: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1831: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1837: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1843 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1855: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1858: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1861: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1864: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:1874: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1901: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1904: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1907: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1910: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1922 "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1935: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1938: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1941: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1944: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1954 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1966: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1969: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1972: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1975: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:2002: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:2022: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:2026: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:2034: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:2049: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:2057: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:2060: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:2069: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:2084: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:2093: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:2096: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +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:2110: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2131 "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:2136: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2142: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2165 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:2169: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2175: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:2212: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2222 "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:2227: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2233: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2256 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:2260: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2266: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:2294: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +for ac_header in popt.h mcheck.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:2308: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2314 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2318: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2324: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2343: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +for ac_header in strings.h values.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:2356: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2362 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2366: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2372: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2391: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:2402: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_pattern="Autoconf.*'x'" + cat >conftest.$ac_ext <<_ACEOF +#line 2409 "configure" +#include "confdefs.h" +#include <sgtty.h> +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + if test $ac_cv_prog_gcc_traditional = no; then + cat >conftest.$ac_ext <<_ACEOF +#line 2424 "configure" +#include "confdefs.h" +#include <termio.h> +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +echo "$as_me:2437: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +for ac_func in strerror mtrace +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:2447: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2453 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2484: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2487: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2490: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2493: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:2503: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:2513: checking for library containing pthread_create" >&5 +echo $ECHO_N "checking for library containing pthread_create... $ECHO_C" >&6 +if test "${ac_cv_search_pthread_create+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_pthread_create=no +cat >conftest.$ac_ext <<_ACEOF +#line 2521 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create (); +int +main () +{ +pthread_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2540: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2543: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2546: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2549: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_pthread_create="none required" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_pthread_create" = no; then + for ac_lib in pthread c_r cr; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 2561 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create (); +int +main () +{ +pthread_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2580: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2583: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2586: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2589: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_pthread_create="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:2602: result: $ac_cv_search_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_search_pthread_create" >&6 +if test "$ac_cv_search_pthread_create" != no; then + test "$ac_cv_search_pthread_create" = "none required" || LIBS="$ac_cv_search_pthread_create $LIBS" + +else + { { echo "$as_me:2608: error: Error: Cannot find the pthread library" >&5 +echo "$as_me: error: Error: Cannot find the pthread library" >&2;} + { (exit 1); exit 1; }; } +fi + +echo "$as_me:2613: checking for poptGetNextOpt in -lpopt" >&5 +echo $ECHO_N "checking for poptGetNextOpt in -lpopt... $ECHO_C" >&6 +if test "${ac_cv_lib_popt_poptGetNextOpt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpopt $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2621 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char poptGetNextOpt (); +int +main () +{ +poptGetNextOpt (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2640: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2643: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2646: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2649: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_popt_poptGetNextOpt=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_popt_poptGetNextOpt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2660: result: $ac_cv_lib_popt_poptGetNextOpt" >&5 +echo "${ECHO_T}$ac_cv_lib_popt_poptGetNextOpt" >&6 +if test $ac_cv_lib_popt_poptGetNextOpt = yes; then + got_popt=yes +else + got_popt=no +fi + +if test x$got_popt = xno; then + USE_INCLUDED_POPT_TRUE= + USE_INCLUDED_POPT_FALSE='#' +else + USE_INCLUDED_POPT_TRUE='#' + USE_INCLUDED_POPT_FALSE= +fi +if test "$got_popt" = "no"; then + echo "$as_me:2676: result: using included popt package..." >&5 +echo "${ECHO_T}using included popt package..." >&6 + POPT_LIBS="src/popt/libpopt.a" + POPT_INCLUDES="-Isrc/popt" +else + POPT_LIBS="-lpopt" +fi + +ac_config_files="$ac_config_files Makefile src/Makefile src/common/Makefile src/popt/Makefile src/srun/Makefile src/slurmd/Makefile src/slurmctld/Makefile src/scancel/Makefile src/squeue/Makefile src/scontrol/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 overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:2764: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <bug-autoconf@gnu.org>." +EOF + +cat >>$CONFIG_STATUS <<EOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.52, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +EOF + +cat >>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <<EOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +EOF +cat >>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:2940: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:2959: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<EOF +# +# INIT-COMMANDS section. +# + +EOF + +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/common/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/common/Makefile" ;; + "src/popt/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/popt/Makefile" ;; + "src/srun/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/srun/Makefile" ;; + "src/slurmd/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/slurmd/Makefile" ;; + "src/slurmctld/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/slurmctld/Makefile" ;; + "src/scancel/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/scancel/Makefile" ;; + "src/squeue/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/squeue/Makefile" ;; + "src/scontrol/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/scontrol/Makefile" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:3013: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <<EOF + +# +# 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 + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@PROJECT@,$PROJECT,;t t +s,@VERSION@,$VERSION,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@CPP@,$CPP,;t t +s,@USE_INCLUDED_POPT_TRUE@,$USE_INCLUDED_POPT_TRUE,;t t +s,@USE_INCLUDED_POPT_FALSE@,$USE_INCLUDED_POPT_FALSE,;t t +s,@POPT_LIBS@,$POPT_LIBS,;t t +s,@POPT_INCLUDES@,$POPT_INCLUDES,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:3247: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:3265: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:3278: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <<EOF + sed "$ac_vpsub +$extrasub +EOF +cat >>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:3339: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:3350: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:3363: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +EOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\EOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +EOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:3480: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + + case $ac_dest in + default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; + esac +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000000..8bf85707e6a --- /dev/null +++ b/configure.ac @@ -0,0 +1,58 @@ +# This file is to be processed with autoconf to generate a configure script + +AC_INIT(src/common/slurm.h) +AC_CONFIG_AUX_DIR(auxdir) +AC_CANONICAL_SYSTEM + +# determine project/version +dnl XXX fill this in from ./META or something ... +PROJECT="slurm" +AC_DEFINE_UNQUOTED(PROJECT, "$PROJECT", [Define the project's name.]) +AC_SUBST(PROJECT) +VERSION="0.0" +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the project's version.]) +AC_SUBST(VERSION) + +dnl Automake stuff. +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(PROJECT, VERSION) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET +AC_PROG_RANLIB + +dnl Checks for libraries + +dnl Checks for header files. +AC_CHECK_HEADERS(popt.h mcheck.h unistd.h) +AC_CHECK_HEADERS(strings.h values.h) + +dnl Checks for types. +AC_GCC_TRADITIONAL + +dnl Checks for structures. + +dnl Checks for compiler characteristics. + +dnl checks for library functions. +AC_CHECK_FUNCS(strerror mtrace) +AC_SEARCH_LIBS([pthread_create], [pthread c_r cr], [], + [AC_MSG_ERROR([Error: Cannot find the pthread library])]) + +AC_CHECK_LIB(popt, poptGetNextOpt, [got_popt=yes], [got_popt=no]) +AM_CONDITIONAL(USE_INCLUDED_POPT, test x$got_popt = xno) +if test "$got_popt" = "no"; then + AC_MSG_RESULT([using included popt package...]) + POPT_LIBS="src/popt/libpopt.a" + POPT_INCLUDES="-Isrc/popt" +else + POPT_LIBS="-lpopt" +fi +AC_SUBST(POPT_LIBS) +AC_SUBST(POPT_INCLUDES) + +dnl checks for system services. + + +AC_OUTPUT([Makefile src/Makefile src/common/Makefile src/popt/Makefile src/srun/Makefile src/slurmd/Makefile src/slurmctld/Makefile src/scancel/Makefile src/squeue/Makefile src/scontrol/Makefile]) diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 00000000000..0ebac1a019d --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,4 @@ + +EXTRA_DIST = txt html + +SUBDIRS = pubdesign diff --git a/doc/man/man1/srun.1 b/doc/man/man1/srun.1 new file mode 100644 index 00000000000..af2e8d40749 --- /dev/null +++ b/doc/man/man1/srun.1 @@ -0,0 +1,370 @@ +.TH SRUN "1" "February 2002" "srun 0.1" "slurm components" +.SH "NAME" +srun \- run parallel jobs +.SH SYNOPSIS +.B srun +[\fIOPTIONS\fR...] \fIexecutable \fR[\fIargs\fR...] +.br +.B srun +\-\-allocate [\fIOPTIONS\fR...] [job_script] +.br +.B srun +\-\-attach=jobid +.SH DESCRIPTION +Allocate resources and optionally initiate parallel jobs on +clusters managed by SLURM. +.TP +parallel run options +.TP +\fB\-n\fR, \fB\-\-nprocs\fR=\fInprocs\fR +Specify the number of processes to run. Request that +.B srun +allocate \fInprocs\fR processes. Specification of the number of processes +per node may be achieved with the +.B -c +and +.B -N +options. If unspecified, the default is one process. +.TP +\fB\-c\fR, \fB\-\-cpus\fR=\fIncpus\fR +Request that \fIncpus\fR be allocated \fBper process\fR. This may be +useful if the job will be multithreaded and requires more than one cpu +per task for optimal performance. The default is one cpu per process. +.TP +\fB\-N\fR, \fB\-\-nodes\fR=\fInnodes\fR +Request that \fInnodes\fR nodes be allocated to this job. The default +is to allocate one cpu per process, such that nodes with one cpu will +run one process, nodes with 2 cpus will be allocated 2 processes, etc. +The distribution of processes across nodes may be controlled using this +option along with the +.B -n +and +.B -c +options. +.TP +\fB\-p\fR, \fB\-\-partition\fR=\fIpartition\fR +Request resources from partition "\fIpartition\fR." Partitions +are created by the slurm administrator. +.TP +\fB\-\-cddir\fR=\fIpath\fR +have the remote processes do a chdir to \fIpath\fR before beginning +execution. The default is to chdir to the current working directory +of the \fBsrun\fR process. +.TP +\fB\-I\fR, \fB\-\-immediate\fR +exit if resources are not immediately +available. By default, \fB\-\-immediate\fR is off, and +.B srun +will block until resources become available. +.TP +\fB\-O\fR, \fB\-\-overcommit\fR +overcommit resources. Normally, +.B srun +will not allocate more than one process to a cpu. By specifying +\fB\-\-overcommit\fR you are explicitly allowing more than one process +per cpu. +.TP +\fB\-l\fR, \fB\-\-label\fR +prepend task number to lines of stdout/err. Normally, stdout and stderr +from remote tasks is line-buffered directly to the stdout and stderr of +.B srun +. The \fB\-\-label\fR option will prepend lines of output with the remote +task id. +.TP +\fB\-m\fR, \fB\-\-distribution\fR=(\fIblock\fR|\fIcyclic\fR) +Specify an alternate distribution method for remote processes. +.RS +.TP +.B block +The block method of distribution will allocate processes in-order to +the cpus on a node. This is the default behavior. +.TP +.B cyclic +The cyclic method distributes processes in a round-robin fashion across +the allocated nodes. That is, process 1 will be allocated to the first +node, process 2 to the second, and so on. +.RE +.TP +\fB\-J\fR, \fB\-\-job\-name\fR=\fIjobname\fR +Specify a name for the job. The specified name will appear along with +the job id number when querying running jobs on the system. The default +is an empty name. +.TP +\fB\-o\fR, \fB\-\-output\fR=\fIout\fR +Specify how stdout is to be directed. By default, +.B srun +collects stdout from all tasks and line buffers this output to +the attached terminal. With \fB\-\-output\fR stdout may be redirected +to a file, to one file per task, or to /dev/null. See \fBIO Redirection\fR +below. +.TP +\fB\-i\fR, \fB\-\-input\fR=\fIin\fR +Specify how stdin is to redirected. By default, +.B srun +redirects stdin to all tasks from /dev/null. See \fBIO Redirection\fR +below for more options. +.TP +\fB\-e\fR, \fB\-\-error\fR=\fIerr\fR +Specify how stderr is to be redirected. By default, +.B srun +redirects stderr to the same file as stdout, if one is specified. The +\fB\-\-error\fR option is provided to allow stdout and stderr to be +redirected to different locations. +See \fBIO Redirection\fR below for more options. +.TP +\fB\-b\fR, \fB\-\-batch\fR +Submit in "batch mode." \fBsrun\fR will allocate resources and "detach" - +starting another \fBsrun\fR on the first allocated node to manage the +job. stdin will be redirected from /dev/null, stdout and stderr will be +redirected to a file (default is \fIjobname\fR.out or \fIjobid\fR.out in +current working directory, see \fB\-o\fR for other IO options). +.TP +\fB\-v\fR, \fB\-\-verbose\fR +verbose operation. Multiple \fB-v\fR's will further increase the verbosity of +.B srun. +.TP +\fB\-d\fR, \fB\-\-debug\fR +enable debug output. Multiple \fB-d\fR's increase the debug level of +.B srun +.PP +Allocate options: +.TP +\fB\-A\fR, \fB\-\-allocate\fR +allocate resources and spawn a shell. When \fB\-\-allocate\fR is specified to +.B srun +, no remote tasks are started. Instead a subshell is started that has access +to the allocated resources. Multiple jobs can then be run on the same cpus +from within this subshell. See \fBAllocate Mode\fR below. +.PP +Attach to running job: +.TP +\fB\-a\fR, \fB\-\-attach\fR=\fIid\fR +This option will attach +.B srun +to a running job with job id = \fIid\fR. Provided that the calling user +has access to that running job, stdout and stderr will be redirected to the +current session and signals received by +.B srun +will be forwarded to the remote processes. +.TP +\fB\-j\fR, \fB\-\-join\fR +Join with running job. This will duplicate stdout/stderr to the calling +\fBsrun\fR. stdin and signals will not be propagated to the job. +\fB\-\-join\fR is only allowed with \fB\-\-attach\fR. +.TP +\fB\-s\fR, \fB\-\-steal\fR +Steal the connection to the running job. This will close any open +sessions with the specified job and allow stdin and signals to be propagated. +\fB\-\-steal\fR is only allowed with \fB\-\-attach\fR. +.PP +Constraint Options. The following options all put constraints on the nodes +that may be considered for the job: +.TP +\fB\-\-mincpus\fR=\fIn\fR +Specify minimum number of cpus per node +.TP +\fB\-\-mem\fR=\fIMB\fR +Specify a minimum amount of real memory +.TP +\fB\-\-vmem\fR=\fIMB\fR +Specify a minimum amount of virtual memory +.TP +\fB\-\-tmp\fR=\fIMB\fR +Specify a minimum amount of temporary disk space +.TP +\fB\-C\fR, \fB\-\-constraint\fR=\fIlist\fR +specify a list of constraints. The \fIlist\fR of constraints is +a comma separated list of features that have been assigned to the +nodes by the slurm administrator. If no nodes have the requested +feature, then the job will be rejected by the slurm job manager. +.TP +\fB\-\-contiguous\fR +demand a contiguous range of nodes. The default is on. Specify +--contiguous=no if a contiguous range of nodes is not a constraint. +.TP +\fB\-w\fR, \fB\-\-nodelist\fR=\fIhost1,host2,...\fR or \fIfilename\fR +request a specific list of hosts. The job will contain \fIat least\fR +these hosts. The list may be specified as a comma-separated list of +hosts, a range of hosts (host[1-5,7,...] for example), or a filename. +The host list will be assumed to be a filename if it contains a "/" +character. +.PP +Help options +.TP +-?, \fB\-\-help\fR +Show this help message +.TP +\fB\-\-usage\fR +Display brief usage message +.PP +Other options +.TP +\fB\-V\fR, \fB\-\-version\fR +output version information and exit +.PP +Unless the \fB\-a\fR (\fB\-\-attach\fR) or \fB-A\fR (\fB\-\-allocate\fR) +options are specified (see \fBAllocate mode\fR and \fBAttaching to jobs\fR +below), +.B srun +will submit the job request to the slurm job controller, then initiate all +processes on the remote nodes. If the request cannot be met immediately, +.B srun +will block until the resources are free to run the job. If the +\fB\-I\fR (\fB\-\-immediate\fR) option is specified +.B srun +will terminate if resources are not immediately available. +.PP +When initiating remote processes +.B srun +will propagate the current working directory, unless +\fB\-\-cddir\fR=\fIpath\fR is specified, in which case \fIpath\fR will +become the working directory for the remote processes. +.PP +The \fB-n\fB, \fB-c\fR, and \fB-N\fR options control how CPUs and +nodes will be allocated to the job. When specifying only the number +of processes to run with \fB-n\fR, a default of one CPU per process +is allocated. By specifying the number of CPUs required per task (\fB-c\fR), +more than one CPU may be allocated per process. If the number of nodes +is specified with \fB-N\fR, +.B srun +will attempt to allocate \fIat least\fR the number of nodes specified. +.PP +Combinations of the above three options may be used to change how +processes are distributed across nodes and cpus. For instance, by specifying +both the number of processes and number of nodes on which to run, the +number of processes per node is implied. However, if the number of CPUs +per process is more important then number of processes (\fB-n\fR) and the +number of CPUs per process (\fB-c\fR) should be specified. +.PP +.B srun +will refuse to allocate more than one process per CPU unless +\fB\-\-overcommit\fR (\fB\-O\fR) is also specified. +.PP +.B srun +will attempt to meet the above specifications "at a minimum." That is, +if 16 nodes are requested for 32 processes, and some nodes do not have +2 CPUs, the allocation of nodes will be increased in order to meet the +demand for CPUs. In other words, a \fIminimum\fR of 16 nodes are being +requested. However, if 16 nodes are requested for 15 processes, +.B srun +will consider this an error, as 15 processes cannot run across 16 nodes. +.PP +.B "IO Redirection" +.PP +By default stdout and stderr will be redirected from all tasks to the +stdout and stderr of +.B srun +, and stdin will be redirected from /dev/null to all tasks. This +behavior may be changed with the \fB\-\-output\fR, \fB\-\-error\fR, +and \fB\-\-input\fR (\fB\-o\fR, \fB\-e\fR, \fB\-i\fR) options. Valid +arguments to these options are +.TP 10 +all +stdout stderr is redirected from all tasks to srun (This is the default). +stdin is forwarded to all tasks. +.TP +none +stdout and stderr are redirected to /dev/null. +stdin is redirected from /dev/null (This is the default for stdin) +.TP +filename +stdout and stderr are redirected to the named file (relative to the +current working directory of the job). stdin is redirected from the +named file. +.TP +format string +If a format string is provided (such as "output.%d"), +.B srun +will open one file per task passing the task id as the argument to +the format string. The format specifier may be any valid printf +format, as long as it takes a numeric argument. +.PP +.PP +.B "Allocate Mode" +.PP +When the allocate option is specified (\fB\-A\fR, \fB\-\-allocate\fR) +\fBsrun\fR will not initiate any remote processes after acquiring +resources. Instead, \fBsrun\fR will spawn a subshell which has access +to the acquired resources. Subsequent instances of \fBsrun\fR from within +this subshell will then run on these resources. +.PP +If the name of a script is specified on the +commandline with \fB\-\-allocate\fR, the spawned shell will run the +specified script. Resources allocated in this way will only be freed +when the subshell terminates. +.PP +.B "Attaching to a running job" +.PP +Use of the \fB-a\fR \fIjobid\fR (or \fB\-\-attach\fR) option allows +\fBsrun\fR to reattach to a running job, receiving stdout and stderr +from the job and forwarding signals to the job, just as if the current +session of \fBsrun\fR had started the job. (stdin, however, cannot +be forwarded to the job). +.PP +There are two ways to reattach to a running job. The default method +is to steal any current connections to the job. In this case, the +\fBsrun\fR process currently managing the job will be terminated, and +control will be relegated to the caller. To allow the current +\fBsrun\fR to continue managing the running job, the \fB\-j\fB +(\fB\-\-join\fR) option may be specified. When joining with the +running job, stdout and stderr are duplicated to the new \fBsrun\fR +session, but signals are not forwarded to the remote job. +.PP +Node and CPU selection options do not make sense when specifying +\fB\-\-attach\fR, and it is an error to use \fB-n\fR, \fB-c\fR, +or \fB-N\fR in attach mode. +.PP +.SH "ENVIRONMENT VARIABLES" +.PP +Some +.B srun +options may be set via environment variables. These environment +variables, along with their corresponding options, are listed below. +(Note: commandline options will always override these settings) +.TP 20 +SLURM_NPROCS +\fB\-n, \-\-nprocs\fR=\fIn\fR +.TP +SLURM_CPUS_PER_TASK +\fB\-c, \-\-ncpus\fR=\fIn\fR +.TP +SLURM_NNODES +\fB\-N, \-\-nodes\fR=\fIn\fR +.TP +SLURM_PARTITION +\fB\-p, --partition\fR=\fIpartition\fR +.TP +SLURM_STDOUTMODE +\fB\-o, \-\-output\fR=\fImode\fR +.TP +SLURM_STDINMODE +\fB\-i, \-\-input\fR=\fImode\fR +.TP +SLURM_STDERRMODE +\fB\-e, \-\-error\fR=\fImode\fR +.TP +SLURM_DISTRIBUTION +\fB\-m, \-\-distribution\fR=(\fIblock|cyclic\fR) +.TP +SLURM_DEBUG +\fB\-d, \-\-debug\fR +.PP +Additionally, +.B srun +will set some environment variables in the environment of the +executing tasks on the remote compute nodes. These environment variables +are: +.TP 20 +SLURM_JOBID +job id of the executing job. +.TP +SLURM_RANK +the MPI rank of the current process +.TP +SLURM_NPROCS +total number of processes in the current job +.TP +SLURM_NODELIST +list of nodes that the slurm job is executing on. +.TP +.SH "SEE ALSO" diff --git a/etc/SLURM.conf1 b/etc/SLURM.conf1 new file mode 100644 index 00000000000..35e54a134dc --- /dev/null +++ b/etc/SLURM.conf1 @@ -0,0 +1,19 @@ +# +# Sample /etc/SLURM.conf +# Author: John Doe +# Date: 11/06/2001 +# +Administrators=cdunlap,garlick,grondo,jette +# +ControlMachine=linux +BackupController=lx02 +# +NodeSpecConf=/usr/local/SLURM/NodeSpecConf +PartitionConf=/usr/local/SLURM/PartitionConf +# +MasterDaemon=/usr/local/SLURM/Slurmd.Master" +InitProgram=/usr/local/SLURM/Slurmd.Prolog" +ControlDaemon=/usr/local/SLURM/Slurmd.Control" +ServerDaemon=/usr/local/SLURM/Slurmd.Server" +ControllerTimeout=120 +ServerTimeout=90 diff --git a/etc/SLURM.conf2 b/etc/SLURM.conf2 new file mode 100644 index 00000000000..7d206c9427d --- /dev/null +++ b/etc/SLURM.conf2 @@ -0,0 +1,15 @@ +# +# Sample /etc/SLURM.conf2 +# Author: John Doe +# Date: 11/06/2001 +# +Administrators=cdunlap,garlick,grondo,jette +# +ControlMachine=linux +BackupController=blue199.pacific.llnl.gov +# +NodeSpecConf=/g/g0/jette/slurm-code/etc/sample.node.conf2 +PartitionConf=/g/g0/jette/slurm-code/etc/sample.part.conf2 +# +ControlDaemon=/g/g0/jette/slurm-code/Controller +ServerDaemon=/g/g0/jette/slurm-code/Server diff --git a/etc/sample.job.conf2 b/etc/sample.job.conf2 new file mode 100644 index 00000000000..e6c3c4f6bcb --- /dev/null +++ b/etc/sample.job.conf2 @@ -0,0 +1,18 @@ +# +# Sample sample.job.conf2 +# Author: John Doe +# Date: 12/20/2001 +# +User=FAILS_Node_Down JobType=INTERACTIVE NodeCount=1 MaxTime=40 NodeList=lx01 +User=jette JobType=INTERACTIVE NodeCount=2 MaxTime=40 NodeList=lx11,lx12 +User=userforlx08-09 JobType=INTERACTIVE NodeCount=2 MaxTime=40 MinTmpDisk=8000 +User=anyuser JobType=BATCH NodeCount=2 MaxTime=40 NodeList=lx11,lx12 +User=FAILS_JobType JobType=Batch NodeCount=2 MinTmpDisk=1000 MaxTime=40 NodeList=lx07,lx12 +User=FAILS_Tmp_Disk JobType=BATCH NodeCount=2 MinTmpDisk=8000 MaxTime=40 NodeList=lx07,lx12 +User=jette JobType=BATCH NodeCount=4 Partition=pbatch MinRealMemory=2048 Comment=lx13-16 +User=userfor_lx14 JobType=BATCH NodeCount=1 Partition=pbatch MinCpus=32 +User=userfor_lx12-14 JobType=BATCH NodeCount=3 Partition=pbatch MinVirtualMemory=4000 +User=jette JobType=BATCH NodeCount=29 +User=anyuser JobType=BATCH NodeCount=4 MinRealMemory=2048 Continguous=FALSE Comment=lx13-16 +User=userforlx13-16 JobType=BATCH NodeCount=4 MinRealMemory=2048 Continguous=TRUE +User=userforlx18-25 JobType=BATCH NodeCount=8 Partition=pbatch diff --git a/etc/sample.node.conf b/etc/sample.node.conf new file mode 100644 index 00000000000..6ff17bea35f --- /dev/null +++ b/etc/sample.node.conf @@ -0,0 +1,17 @@ +# +# Sample sample.node.conf +# Author: John Doe +# Date: 11/06/2001 +# +Name=DEFAULT OS=Linux.2.4.7-1 CPUs=2 Speed=1.0 RealMemory=2048 VirtualMemory=4096 TmpDisk=16384 Partition=1 +# +Name=lx01 Partition= +Name=lx02 +Name=lx03 Speed=1.5 RealMemory=3072 Partition=1,2 +Name=lx04 CPUs=1 Speed=1.3 Partition=1,3 +Name=lx05 +Name=lx06 +# +Name=DEFAULT OS=Linux3.0 CPUs=4 Speed=1.6, Partition=9 +Name=mx01 +Name=mx02 Pool=5 RealMemory=567 diff --git a/etc/sample.node.conf2 b/etc/sample.node.conf2 new file mode 100644 index 00000000000..274beea34bc --- /dev/null +++ b/etc/sample.node.conf2 @@ -0,0 +1,49 @@ +# +# Sample sample.node.conf2 +# Author: John Doe +# Date: 11/06/2001 +# +Name=DEFAULT OS=Linux.2.4.7-1 CPUs=16 Speed=345.0 RealMemory=2048 VirtualMemory=4096 TmpDisk=16384 State=IDLE +# +# lx01-lx02 for login only, no state is DOWN for SLURM initiated jobs +Name=lx01 State=DOWN +Name=lx02 State=DOWN +# +# lx03-lx09 for partitions 1 (debug) and 3 (super) +Name=DEFAULT Partition=1,3 +Name=lx03 +Name=lx04 +Name=lx05 +Name=lx06 +Name=lx07 TmpDisk=4096 +Name=lx08 +Name=lx09 +# +# lx10-lx30 for partitions 0 (pbatch) and 3 (super) +Name=DEFAULT Partition=0,3 +Name=lx10 +Name=lx11 VirtualMemory=2048 +Name=lx12 RealMemory=1024 +Name=lx13 +Name=lx14 CPUs=32 +Name=lx15 +Name=lx16 +Name=lx17 State=DOWN +Name=lx18 +Name=lx19 +Name=lx20 +Name=lx21 +Name=lx22 CPUs=8 +Name=lx23 +Name=lx24 +Name=lx25 +Name=lx26 +Name=lx27 +Name=lx28 +Name=lx29 +Name=lx30 +# +# lx31-lx32 for partitions 4 (class) and 3 (super) +Name=DEFAULT Partition=3,4 +Name=lx31 +Name=lx32 diff --git a/etc/sample.part.conf b/etc/sample.part.conf new file mode 100644 index 00000000000..23674909d4b --- /dev/null +++ b/etc/sample.part.conf @@ -0,0 +1,12 @@ +# +# Example sample.part.conf +# Author: John Doe +# Date: 12/14/2001 +# +Name=DEFAULT JobType=Batch +# +Name=DEFAULT JobType=INTERACTIVE MaxCpus=16 +Name=pbatch Number=0 JobType=BATCH MaxCpus=128 MaxTime=UNLIMITED +Name=debug Number=1 MaxCpus=4 MaxTime=60 +Name=super Number=3 JobType=BATCH MaxCpus=256 AllowUsers=cdunlap,garlick,jette +Name=class Number=4 JobType=ALL MaxCpus=UNLIMITED AllowUsers=student1,student2,student3 diff --git a/etc/sample.part.conf2 b/etc/sample.part.conf2 new file mode 100644 index 00000000000..c3dcee8eaa0 --- /dev/null +++ b/etc/sample.part.conf2 @@ -0,0 +1,9 @@ +# +# Example sample.part.conf2 +# Author: John Doe +# Date: 12/14/2001 +# +Name=pbatch Number=0 JobType=BATCH MaxCpus=128 MaxTime=UNLIMITED +Name=debug Number=1 JobType=INTERACTIVE MaxCpus=16 MaxTime=60 +Name=super Number=3 JobType=ALL MaxCpus=UNLIMITED MaxTime=UNLIMITED AllowUsers=cdunlap,garlick,jette +Name=class Number=4 JobType=ALL MaxCpus=16 MaxTime=10 AllowUsers=student1,student2,student3 diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 00000000000..44bbba39fe2 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,7 @@ +popt_dirs = +if USE_INCLUDED_POPT + popt_dirs = popt +endif + +# add subdirs "scancel", "squeue", and "slurmd" as soon as something is there: +SUBDIRS = common slurmctld srun $(popt_dirs) diff --git a/src/common/Makefile.am b/src/common/Makefile.am new file mode 100644 index 00000000000..bf124f14f53 --- /dev/null +++ b/src/common/Makefile.am @@ -0,0 +1,10 @@ +# Makefile for common library + +AUTOMAKE_OPTIONS = foreign + +noinst_LIBRARIES = libcommon.a + +libcommon_a_SOURCES = list.c + +noinst_HEADERS = list.h slurm.h + diff --git a/src/popt/COPYING b/src/popt/COPYING new file mode 100644 index 00000000000..b4c7ca876c6 --- /dev/null +++ b/src/popt/COPYING @@ -0,0 +1,22 @@ +Copyright (c) 1998 Red Hat Software + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. diff --git a/src/popt/Makefile.am b/src/popt/Makefile.am new file mode 100644 index 00000000000..6d99f5acb88 --- /dev/null +++ b/src/popt/Makefile.am @@ -0,0 +1,12 @@ +# Makefile for popt. + +EXTRA_DIST = README COPYING + +#INCLUDES = -I$(top_srcdir) -I$(includedir) +INCLUDES = + +noinst_LIBRARIES = libpopt.a + +libpopt_a_SOURCES = popt.c findme.c poptparse.c popthelp.c poptconfig.c + +noinst_HEADERS = popt.h system.h findme.h poptint.h diff --git a/src/popt/README b/src/popt/README new file mode 100644 index 00000000000..7fccc836ffa --- /dev/null +++ b/src/popt/README @@ -0,0 +1,18 @@ +This is the popt command line option parsing library. While it is similiar +to getopt(3), it contains a number of enhancements, including: + + 1) popt is fully reentrant + 2) popt can parse arbitrary argv[] style arrays while + getopt(2) makes this quite difficult + 3) popt allows users to alias command line arguments + 4) popt provides convience functions for parsting strings + into argv[] style arrays + +popt is used by rpm, the Red Hat install program, and many other Red Hat +utilities, all of which provide excellent examples of how to use popt. +Complete documentation on popt is available in popt.ps (included in this +tarball), which is excerpted with permission from the book "Linux +Application Development" by Michael K. Johnson and Erik Troan (availble +from Addison Wesley in May, 1998). + +Comments on popt should be addressed to ewt@redhat.com. diff --git a/src/popt/findme.c b/src/popt/findme.c new file mode 100644 index 00000000000..8518be13cc9 --- /dev/null +++ b/src/popt/findme.c @@ -0,0 +1,42 @@ +/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING + file accompanying popt source distributions, available from + ftp://ftp.redhat.com/pub/code/popt */ + +#include "system.h" +#include "findme.h" + +const char * findProgramPath(const char * argv0) { + char * path = getenv("PATH"); + char * pathbuf; + char * start, * chptr; + char * buf; + + /* If there is a / in the argv[0], it has to be an absolute path */ + if (strchr(argv0, '/')) + return xstrdup(argv0); + + if (!path) return NULL; + + start = pathbuf = alloca(strlen(path) + 1); + buf = malloc(strlen(path) + strlen(argv0) + sizeof("/")); + strcpy(pathbuf, path); + + chptr = NULL; + do { + if ((chptr = strchr(start, ':'))) + *chptr = '\0'; + sprintf(buf, "%s/%s", start, argv0); + + if (!access(buf, X_OK)) + return buf; + + if (chptr) + start = chptr + 1; + else + start = NULL; + } while (start && *start); + + free(buf); + + return NULL; +} diff --git a/src/popt/findme.h b/src/popt/findme.h new file mode 100644 index 00000000000..5e93963d603 --- /dev/null +++ b/src/popt/findme.h @@ -0,0 +1,10 @@ +/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING + file accompanying popt source distributions, available from + ftp://ftp.redhat.com/pub/code/popt */ + +#ifndef H_FINDME +#define H_FINDME + +const char * findProgramPath(const char * argv0); + +#endif diff --git a/src/popt/popt.c b/src/popt/popt.c new file mode 100644 index 00000000000..384fe30ccba --- /dev/null +++ b/src/popt/popt.c @@ -0,0 +1,941 @@ +/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING + file accompanying popt source distributions, available from + ftp://ftp.redhat.com/pub/code/popt */ + +#undef MYDEBUG + +#include "system.h" + +#include <config.h> /* include top level config, -mag */ +#include <math.h> + +#ifdef HAVE_VALUES_H +# include <values.h> +#endif + +#include "findme.h" +#include "poptint.h" + +#ifndef HAVE_STRERROR +static char * strerror(int errno) { + extern int sys_nerr; + extern char * sys_errlist[]; + + if ((0 <= errno) && (errno < sys_nerr)) + return sys_errlist[errno]; + else + return POPT_("unknown errno"); +} +#endif + +void poptSetExecPath(poptContext con, const char * path, int allowAbsolute) { + if (con->execPath) xfree(con->execPath); + con->execPath = xstrdup(path); + con->execAbsolute = allowAbsolute; +} + +static void invokeCallbacksPRE(poptContext con, const struct poptOption * opt) +{ + for (; opt->longName || opt->shortName || opt->arg; opt++) { + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { + /* Recurse on included sub-tables. */ + invokeCallbacksPRE(con, opt->arg); + } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK && + (opt->argInfo & POPT_CBFLAG_PRE)) + { poptCallbackType cb = (poptCallbackType)opt->arg; + /* Perform callback. */ + cb(con, POPT_CALLBACK_REASON_PRE, NULL, NULL, opt->descrip); + } + } +} + +static void invokeCallbacksPOST(poptContext con, const struct poptOption * opt) +{ + for (; opt->longName || opt->shortName || opt->arg; opt++) { + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { + /* Recurse on included sub-tables. */ + invokeCallbacksPOST(con, opt->arg); + } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK && + (opt->argInfo & POPT_CBFLAG_POST)) + { poptCallbackType cb = (poptCallbackType)opt->arg; + /* Perform callback. */ + cb(con, POPT_CALLBACK_REASON_POST, NULL, NULL, opt->descrip); + } + } +} + +static void invokeCallbacksOPTION(poptContext con, + const struct poptOption * opt, + const struct poptOption * myOpt, + const void * myData, int shorty) +{ + const struct poptOption * cbopt = NULL; + + for (; opt->longName || opt->shortName || opt->arg; opt++) { + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { + /* Recurse on included sub-tables. */ + invokeCallbacksOPTION(con, opt->arg, myOpt, myData, shorty); + } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK && + !(opt->argInfo & POPT_CBFLAG_SKIPOPTION)) { + /* Save callback info. */ + cbopt = opt; + } else if (cbopt != NULL && + ((myOpt->shortName && opt->shortName && shorty && + myOpt->shortName == opt->shortName) || + (myOpt->longName && opt->longName && + !strcmp(myOpt->longName, opt->longName))) + ) + { poptCallbackType cb = (poptCallbackType)cbopt->arg; + const void * cbData = (cbopt->descrip ? cbopt->descrip : myData); + /* Perform callback. */ + cb(con, POPT_CALLBACK_REASON_OPTION, myOpt, + con->os->nextArg, cbData); + /* Terminate (unless explcitly continuing). */ + if (!(cbopt->argInfo & POPT_CBFLAG_CONTINUE)) + return; + } + } +} + +poptContext poptGetContext(const char * name, int argc, const char ** argv, + const struct poptOption * options, int flags) +{ + poptContext con = malloc(sizeof(*con)); + + memset(con, 0, sizeof(*con)); + + con->os = con->optionStack; + con->os->argc = argc; + con->os->argv = argv; + con->os->argb = NULL; + + if (!(flags & POPT_CONTEXT_KEEP_FIRST)) + con->os->next = 1; /* skip argv[0] */ + + con->leftovers = calloc( (argc + 1), sizeof(char *) ); + con->options = options; + con->aliases = NULL; + con->numAliases = 0; + con->flags = flags; + con->execs = NULL; + con->numExecs = 0; + con->finalArgvAlloced = argc * 2; + con->finalArgv = calloc( con->finalArgvAlloced, sizeof(*con->finalArgv) ); + con->execAbsolute = 1; + con->arg_strip = NULL; + + if (getenv("POSIXLY_CORRECT") || getenv("POSIX_ME_HARDER")) + con->flags |= POPT_CONTEXT_POSIXMEHARDER; + + if (name) + con->appName = strcpy(malloc(strlen(name) + 1), name); + + invokeCallbacksPRE(con, con->options); + + return con; +} + +static void cleanOSE(struct optionStackEntry *os) +{ + if (os->nextArg) { + xfree(os->nextArg); + os->nextArg = NULL; + } + if (os->argv) { + xfree(os->argv); + os->argv = NULL; + } + if (os->argb) { + PBM_FREE(os->argb); + os->argb = NULL; + } +} + +void poptResetContext(poptContext con) { + int i; + + while (con->os > con->optionStack) { + cleanOSE(con->os--); + } + if (con->os->argb) { + PBM_FREE(con->os->argb); + con->os->argb = NULL; + } + con->os->currAlias = NULL; + con->os->nextCharArg = NULL; + con->os->nextArg = NULL; + con->os->next = 1; /* skip argv[0] */ + + con->numLeftovers = 0; + con->nextLeftover = 0; + con->restLeftover = 0; + con->doExec = NULL; + + for (i = 0; i < con->finalArgvCount; i++) { + if (con->finalArgv[i]) { + xfree(con->finalArgv[i]); + con->finalArgv[i] = NULL; + } + } + + con->finalArgvCount = 0; + + if (con->arg_strip) { + PBM_FREE(con->arg_strip); + con->arg_strip = NULL; + } +} + +/* Only one of longName, shortName may be set at a time */ +static int handleExec(poptContext con, char * longName, char shortName) { + int i; + + i = con->numExecs - 1; + if (longName) { + while (i >= 0 && (!con->execs[i].longName || + strcmp(con->execs[i].longName, longName))) i--; + } else { + while (i >= 0 && + con->execs[i].shortName != shortName) i--; + } + + if (i < 0) return 0; + + if (con->flags & POPT_CONTEXT_NO_EXEC) + return 1; + + if (con->doExec == NULL) { + con->doExec = con->execs + i; + return 1; + } + + /* We already have an exec to do; remember this option for next + time 'round */ + if ((con->finalArgvCount + 1) >= (con->finalArgvAlloced)) { + con->finalArgvAlloced += 10; + con->finalArgv = realloc(con->finalArgv, + sizeof(*con->finalArgv) * con->finalArgvAlloced); + } + + i = con->finalArgvCount++; + { char *s = malloc((longName ? strlen(longName) : 0) + 3); + if (longName) + sprintf(s, "--%s", longName); + else + sprintf(s, "-%c", shortName); + con->finalArgv[i] = s; + } + + return 1; +} + +/* Only one of longName, shortName may be set at a time */ +static int handleAlias(poptContext con, const char * longName, char shortName, + /*@keep@*/ const char * nextCharArg) { + int i; + + if (con->os->currAlias && con->os->currAlias->longName && longName && + !strcmp(con->os->currAlias->longName, longName)) + return 0; + if (con->os->currAlias && shortName && + shortName == con->os->currAlias->shortName) + return 0; + + i = con->numAliases - 1; + if (longName) { + while (i >= 0 && (!con->aliases[i].longName || + strcmp(con->aliases[i].longName, longName))) i--; + } else { + while (i >= 0 && + con->aliases[i].shortName != shortName) i--; + } + + if (i < 0) return 0; + + if ((con->os - con->optionStack + 1) == POPT_OPTION_DEPTH) + return POPT_ERROR_OPTSTOODEEP; + + if (nextCharArg && *nextCharArg) + con->os->nextCharArg = nextCharArg; + + con->os++; + con->os->next = 0; + con->os->stuffed = 0; + con->os->nextArg = NULL; + con->os->nextCharArg = NULL; + con->os->currAlias = con->aliases + i; + poptDupArgv(con->os->currAlias->argc, con->os->currAlias->argv, + &con->os->argc, &con->os->argv); + con->os->argb = NULL; + + return 1; +} + +static void execCommand(poptContext con) { + const char ** argv; + int argc = 0; + const char ** sargv; + int sargc = 0; + + poptParseArgvString(con->doExec->script, &sargc, &sargv); + + if (sargv == NULL || sargc < 1 || + (!con->execAbsolute && strchr(sargv[0], '/'))) + return; + + argv = malloc(sizeof(*argv) * + (6 + sargc + con->numLeftovers + con->finalArgvCount)); + + if (!strchr(sargv[0], '/') && con->execPath) { + char *s = alloca(strlen(con->execPath) + strlen(sargv[0]) + sizeof("/")); + sprintf(s, "%s/%s", con->execPath, sargv[0]); + argv[argc] = s; + } else { + argv[argc] = findProgramPath(sargv[0]); + } + if (argv[argc++] == NULL) return; + + if (sargc > 1) { + memcpy(argv + argc, sargv + 1, sizeof(*argv) * (sargc - 1)); + argc += (sargc - 1); + } + + memcpy(argv + argc, con->finalArgv, sizeof(*argv) * con->finalArgvCount); + argc += con->finalArgvCount; + + if (con->numLeftovers) { + argv[argc++] = "--"; + memcpy(argv + argc, con->leftovers, sizeof(*argv) * con->numLeftovers); + argc += con->numLeftovers; + } + + argv[argc++] = NULL; + +#ifdef __hpux + setresuid(getuid(), getuid(),-1); +#else +/* + * XXX " ... on BSD systems setuid() should be preferred over setreuid()" + * XXX sez' Timur Bakeyev <mc@bat.ru> + * XXX from Norbert Warmuth <nwarmuth@privat.circular.de> + */ +#if defined(HAVE_SETUID) + setuid(getuid()); +#elif defined (HAVE_SETREUID) + setreuid(getuid(), getuid()); /*hlauer: not portable to hpux9.01 */ +#else + ; /* Can't drop privileges */ +#endif +#endif + + if (argv[0] == NULL) + return; +#ifdef MYDEBUG + { const char ** arg; + fprintf(stderr, "==> execvp(%s):", argv[0]); + for (arg = argv; *arg; arg++) + fprintf(stderr, " %s", *arg); + fprintf(stderr, "\n"); + } +#endif + + execvp(argv[0], (char *const *)argv); +} + +/*@observer@*/ static const struct poptOption * +findOption(const struct poptOption * opt, const char * longName, + char shortName, + /*@out@*/ poptCallbackType * callback, /*@out@*/ const void ** callbackData, + int singleDash) +{ + const struct poptOption * cb = NULL; + + /* This happens when a single - is given */ + if (singleDash && !shortName && !*longName) + shortName = '-'; + + for (; opt->longName || opt->shortName || opt->arg; opt++) { + + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { + const struct poptOption * opt2; + /* Recurse on included sub-tables. */ + opt2 = findOption(opt->arg, longName, shortName, callback, + callbackData, singleDash); + if (opt2) { + /* Sub-table data will be inheirited if no data yet. */ + if (*callback && *callbackData == NULL) + *callbackData = opt->descrip; + return opt2; + } + } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK) { + cb = opt; + } else if (longName && opt->longName && + (!singleDash || (opt->argInfo & POPT_ARGFLAG_ONEDASH)) && + !strcmp(longName, opt->longName)) { + break; + } else if (shortName && shortName == opt->shortName) { + break; + } + } + + if (!opt->longName && !opt->shortName) + return NULL; + *callbackData = NULL; + *callback = NULL; + if (cb) { + *callback = (poptCallbackType)cb->arg; + if (!(cb->argInfo & POPT_CBFLAG_INC_DATA)) + *callbackData = cb->descrip; + } + + return opt; +} + +static const char *findNextArg(poptContext con, unsigned argx, int delete) +{ + struct optionStackEntry * os = con->os; + const char * arg; + + do { + int i; + arg = NULL; + while (os->next == os->argc && os > con->optionStack) os--; + if (os->next == os->argc && os == con->optionStack) break; + for (i = os->next; i < os->argc; i++) { + if (os->argb && PBM_ISSET(i, os->argb)) continue; + if (*os->argv[i] == '-') continue; + if (--argx > 0) continue; + arg = os->argv[i]; + if (delete) { + if (os->argb == NULL) os->argb = PBM_ALLOC(os->argc); + PBM_SET(i, os->argb); + } + break; + } + if (os > con->optionStack) os--; + } while (arg == NULL); + return arg; +} + +static /*@only@*/ const char * expandNextArg(poptContext con, const char * s) +{ + const char *a; + size_t alen; + char *t, *te; + size_t tn = strlen(s) + 1; + char c; + + te = t = malloc(tn);; + while ((c = *s++) != '\0') { + switch (c) { +#if 0 /* XXX can't do this */ + case '\\': /* escape */ + c = *s++; + break; +#endif + case '!': + if (!(s[0] == '#' && s[1] == ':' && s[2] == '+')) + break; + if ((a = findNextArg(con, 1, 1)) == NULL) + break; + s += 3; + + alen = strlen(a); + tn += alen; + *te = '\0'; + t = realloc(t, tn); + te = t + strlen(t); + strncpy(te, a, alen); te += alen; + continue; + /*@notreached@*/ break; + default: + break; + } + *te++ = c; + } + *te = '\0'; + t = realloc(t, strlen(t)+1); /* XXX memory leak, hard to plug */ + return t; +} + +static void poptStripArg(poptContext con, int which) +{ + if (con->arg_strip == NULL) + con->arg_strip = PBM_ALLOC(con->optionStack[0].argc); + PBM_SET(which, con->arg_strip); +} + +static int poptSaveLong(const struct poptOption * opt, long aLong) { + if (opt->argInfo & POPT_ARGFLAG_NOT) + aLong = ~aLong; + switch (opt->argInfo & POPT_ARGFLAG_LOGICALOPS) { + case 0: + *((long *) opt->arg) = aLong; + break; + case POPT_ARGFLAG_OR: + *((long *) opt->arg) |= aLong; + break; + case POPT_ARGFLAG_AND: + *((long *) opt->arg) &= aLong; + break; + case POPT_ARGFLAG_XOR: + *((long *) opt->arg) ^= aLong; + break; + default: + return POPT_ERROR_BADOPERATION; + break; + } + return 0; +} + +static int poptSaveInt(const struct poptOption * opt, long aLong) { + if (opt->argInfo & POPT_ARGFLAG_NOT) + aLong = ~aLong; + switch (opt->argInfo & POPT_ARGFLAG_LOGICALOPS) { + case 0: + *((int *) opt->arg) = aLong; + break; + case POPT_ARGFLAG_OR: + *((int *) opt->arg) |= aLong; + break; + case POPT_ARGFLAG_AND: + *((int *) opt->arg) &= aLong; + break; + case POPT_ARGFLAG_XOR: + *((int *) opt->arg) ^= aLong; + break; + default: + return POPT_ERROR_BADOPERATION; + break; + } + return 0; +} + +#ifdef MYDEBUG +static void prtcon(const char *msg, poptContext con) +{ + if (msg) fprintf(stderr, "%s", msg); + fprintf(stderr, "\tcon %p os %p nextCharArg \"%s\" nextArg \"%s\" argv[%d] \"%s\"\n", + con, con->os, + (con->os->nextCharArg ? con->os->nextCharArg : ""), + (con->os->nextArg ? con->os->nextArg : ""), + con->os->next, + (con->os->argv && con->os->argv[con->os->next] + ? con->os->argv[con->os->next] : "")); +} +#endif + +/* returns 'val' element, -1 on last item, POPT_ERROR_* on error */ +int poptGetNextOpt(poptContext con) +{ + const struct poptOption * opt = NULL; + int done = 0; + + while (!done) { + const char * origOptString = NULL; + poptCallbackType cb = NULL; + const void * cbData = NULL; + const char * longArg = NULL; + int canstrip = 0; + int shorty = 0; + + while (!con->os->nextCharArg && con->os->next == con->os->argc + && con->os > con->optionStack) { + cleanOSE(con->os--); + } + if (!con->os->nextCharArg && con->os->next == con->os->argc) { + invokeCallbacksPOST(con, con->options); + if (con->doExec) execCommand(con); + return -1; + } + + /* Process next long option */ + if (!con->os->nextCharArg) { + char * localOptString, * optString; + int thisopt; + + if (con->os->argb && PBM_ISSET(con->os->next, con->os->argb)) { + con->os->next++; + continue; + } + thisopt = con->os->next; + origOptString = con->os->argv[con->os->next++]; + + if (con->restLeftover || *origOptString != '-') { + con->leftovers[con->numLeftovers++] = origOptString; + if (con->flags & POPT_CONTEXT_POSIXMEHARDER) + con->restLeftover = 1; + continue; + } + + /* Make a copy we can hack at */ + localOptString = optString = + strcpy(alloca(strlen(origOptString) + 1), + origOptString); + + if (!optString[0]) + return POPT_ERROR_BADOPT; + + if (optString[1] == '-' && !optString[2]) { + con->restLeftover = 1; + continue; + } else { + char *oe; + int singleDash; + + optString++; + if (*optString == '-') + singleDash = 0, optString++; + else + singleDash = 1; + + /* XXX aliases with arg substitution need "--alias=arg" */ + if (handleAlias(con, optString, '\0', NULL)) + continue; + if (handleExec(con, optString, '\0')) + continue; + + /* Check for "--long=arg" option. */ + for (oe = optString; *oe && *oe != '='; oe++) + ; + if (*oe == '=') { + *oe++ = '\0'; + /* XXX longArg is mapped back to persistent storage. */ + longArg = origOptString + (oe - localOptString); + } + + opt = findOption(con->options, optString, '\0', &cb, &cbData, + singleDash); + if (!opt && !singleDash) + return POPT_ERROR_BADOPT; + } + + if (!opt) { + con->os->nextCharArg = origOptString + 1; + } else { + if (con->os == con->optionStack && + opt->argInfo & POPT_ARGFLAG_STRIP) { + canstrip = 1; + poptStripArg(con, thisopt); + } + shorty = 0; + } + } + + /* Process next short option */ + if (con->os->nextCharArg) { + origOptString = con->os->nextCharArg; + + con->os->nextCharArg = NULL; + + if (handleAlias(con, NULL, *origOptString, + origOptString + 1)) { + continue; + } + if (handleExec(con, NULL, *origOptString)) { + /* Restore rest of short options for further processing */ + origOptString++; + if (*origOptString) con->os->nextCharArg = origOptString; + continue; + } + + opt = findOption(con->options, NULL, *origOptString, &cb, + &cbData, 0); + if (!opt) + return POPT_ERROR_BADOPT; + shorty = 1; + + origOptString++; + if (*origOptString) con->os->nextCharArg = origOptString; + } + + if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE) { + if (poptSaveInt(opt, 1L)) + return POPT_ERROR_BADOPERATION; + } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL) { + if (opt->arg) { + if (poptSaveInt(opt, (long)opt->val)) + return POPT_ERROR_BADOPERATION; + } + } else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) { + if (con->os->nextArg) { + xfree(con->os->nextArg); + con->os->nextArg = NULL; + } + if (longArg) { + con->os->nextArg = expandNextArg(con, longArg); + } else if (con->os->nextCharArg) { + con->os->nextArg = expandNextArg(con, con->os->nextCharArg); + con->os->nextCharArg = NULL; + } else { + while (con->os->next == con->os->argc && + con->os > con->optionStack) { + cleanOSE(con->os--); + } + if (con->os->next == con->os->argc) + return POPT_ERROR_NOARG; + + /* make sure this isn't part of a short arg or the + result of an alias expansion */ + if (con->os == con->optionStack && + opt->argInfo & POPT_ARGFLAG_STRIP && + canstrip) { + poptStripArg(con, con->os->next); + } + + con->os->nextArg = expandNextArg(con, con->os->argv[con->os->next++]); + } + + if (opt->arg) { + switch (opt->argInfo & POPT_ARG_MASK) { + case POPT_ARG_STRING: + /* XXX memory leak, hard to plug */ + *((const char **) opt->arg) = xstrdup(con->os->nextArg); + break; + + case POPT_ARG_INT: + case POPT_ARG_LONG: + { long aLong; + char *end; + + aLong = strtol(con->os->nextArg, &end, 0); + if (!(end && *end == '\0')) + return POPT_ERROR_BADNUMBER; + + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_LONG) { + if (aLong == LONG_MIN || aLong == LONG_MAX) + return POPT_ERROR_OVERFLOW; + if (poptSaveLong(opt, aLong)) + return POPT_ERROR_BADOPERATION; + } else { + if (aLong > INT_MAX || aLong < INT_MIN) + return POPT_ERROR_OVERFLOW; + if (poptSaveInt(opt, aLong)) + return POPT_ERROR_BADOPERATION; + } + } break; + + case POPT_ARG_FLOAT: + case POPT_ARG_DOUBLE: + { long aDouble; + char *end; + + aDouble = strtod(con->os->nextArg, &end); + if (*end) + return POPT_ERROR_BADNUMBER; + + if (aDouble == +HUGE_VAL || aDouble == -HUGE_VAL) + return POPT_ERROR_OVERFLOW; + if (aDouble == 0.0 && errno == ERANGE) + return POPT_ERROR_OVERFLOW; + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_DOUBLE) { + *((double *) opt->arg) = aDouble; + } else { +#ifdef ABS +#undef ABS +#endif +#define ABS(a) (((a) < 0) ? -(a) : (a)) + if (ABS(aDouble) > FLT_MAX) + return POPT_ERROR_OVERFLOW; + if (ABS(aDouble) < FLT_MIN) + return POPT_ERROR_OVERFLOW; + *((float *) opt->arg) = aDouble; + } + } break; + default: + fprintf(stdout, POPT_("option type (%d) not implemented in popt\n"), + opt->argInfo & POPT_ARG_MASK); + exit(EXIT_FAILURE); + } + } + } + + if (cb) + invokeCallbacksOPTION(con, con->options, opt, cbData, shorty); + else if (opt->val && ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL)) + done = 1; + + if ((con->finalArgvCount + 2) >= (con->finalArgvAlloced)) { + con->finalArgvAlloced += 10; + con->finalArgv = realloc(con->finalArgv, + sizeof(*con->finalArgv) * con->finalArgvAlloced); + } + + { char *s = malloc((opt->longName ? strlen(opt->longName) : 0) + 3); + if (opt->longName) + sprintf(s, "%s%s", + ((opt->argInfo & POPT_ARGFLAG_ONEDASH) ? "-" : "--"), + opt->longName); + else + sprintf(s, "-%c", opt->shortName); + con->finalArgv[con->finalArgvCount++] = s; + } + + if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE) + /*@-ifempty@*/ ; + else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL) + /*@-ifempty@*/ ; + else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) { + con->finalArgv[con->finalArgvCount++] = xstrdup(con->os->nextArg); + } + } + + return opt->val; +} + +const char * poptGetOptArg(poptContext con) { + const char * ret = con->os->nextArg; + con->os->nextArg = NULL; + return ret; +} + +const char * poptGetArg(poptContext con) { + const char * ret = (con->nextLeftover < con->numLeftovers) + ? con->leftovers[con->nextLeftover++] : NULL; + return ret; +} + +const char * poptPeekArg(poptContext con) { + const char * ret = (con->nextLeftover < con->numLeftovers) + ? con->leftovers[con->nextLeftover] : NULL; + return ret; +} + +const char ** poptGetArgs(poptContext con) { + if (con->numLeftovers == con->nextLeftover) return NULL; + + /* some apps like [like RPM ;-) ] need this NULL terminated */ + con->leftovers[con->numLeftovers] = NULL; + + return (con->leftovers + con->nextLeftover); +} + +void poptFreeContext(poptContext con) { + int i; + + poptResetContext(con); + if (con->os->argb) free(con->os->argb); + + for (i = 0; i < con->numAliases; i++) { + if (con->aliases[i].longName) xfree(con->aliases[i].longName); + free(con->aliases[i].argv); + } + + for (i = 0; i < con->numExecs; i++) { + if (con->execs[i].longName) xfree(con->execs[i].longName); + xfree(con->execs[i].script); + } + if (con->execs) xfree(con->execs); + + free(con->leftovers); + free(con->finalArgv); + if (con->appName) xfree(con->appName); + if (con->aliases) free(con->aliases); + if (con->otherHelp) xfree(con->otherHelp); + if (con->execPath) xfree(con->execPath); + if (con->arg_strip) PBM_FREE(con->arg_strip); + + free(con); +} + +int poptAddAlias(poptContext con, struct poptAlias newAlias, + /*@unused@*/ int flags) +{ + int aliasNum = con->numAliases++; + struct poptAlias * alias; + + /* SunOS won't realloc(NULL, ...) */ + if (!con->aliases) + con->aliases = malloc(sizeof(newAlias) * con->numAliases); + else + con->aliases = realloc(con->aliases, + sizeof(newAlias) * con->numAliases); + alias = con->aliases + aliasNum; + + alias->longName = (newAlias.longName) + ? strcpy(malloc(strlen(newAlias.longName) + 1), newAlias.longName) + : NULL; + alias->shortName = newAlias.shortName; + alias->argc = newAlias.argc; + alias->argv = newAlias.argv; + + return 0; +} + +const char * poptBadOption(poptContext con, int flags) { + struct optionStackEntry * os; + + if (flags & POPT_BADOPTION_NOALIAS) + os = con->optionStack; + else + os = con->os; + + return os->argv[os->next - 1]; +} + +const char *const poptStrerror(const int error) { + switch (error) { + case POPT_ERROR_NOARG: + return POPT_("missing argument"); + case POPT_ERROR_BADOPT: + return POPT_("unknown option"); + case POPT_ERROR_BADOPERATION: + return POPT_("mutually exclusive logical operations requested"); + case POPT_ERROR_OPTSTOODEEP: + return POPT_("aliases nested too deeply"); + case POPT_ERROR_BADQUOTE: + return POPT_("error in paramter quoting"); + case POPT_ERROR_BADNUMBER: + return POPT_("invalid numeric value"); + case POPT_ERROR_OVERFLOW: + return POPT_("number too large or too small"); + case POPT_ERROR_ERRNO: + return strerror(errno); + default: + return POPT_("unknown error"); + } +} + +int poptStuffArgs(poptContext con, const char ** argv) { + int argc; + + if ((con->os - con->optionStack) == POPT_OPTION_DEPTH) + return POPT_ERROR_OPTSTOODEEP; + + for (argc = 0; argv[argc]; argc++) + ; + + con->os++; + con->os->next = 0; + con->os->nextArg = NULL; + con->os->nextCharArg = NULL; + con->os->currAlias = NULL; + poptDupArgv(argc, argv, &con->os->argc, &con->os->argv); + con->os->argb = NULL; + con->os->stuffed = 1; + + return 0; +} + +const char * poptGetInvocationName(poptContext con) { + return con->os->argv[0]; +} + +int poptStrippedArgv(poptContext con, int argc, char **argv) +{ + int i,j=1, numargs=argc; + + for (i = 1; i < argc; i++) { + if (PBM_ISSET(i, con->arg_strip)) + numargs--; + } + + for (i = 1; i < argc; i++) { + if (PBM_ISSET(i, con->arg_strip)) + continue; + argv[j] = (j < numargs) ? argv[i] : '\0'; + j++; + } + + return numargs; +} diff --git a/src/popt/popt.h b/src/popt/popt.h new file mode 100644 index 00000000000..95d8ec0c9e8 --- /dev/null +++ b/src/popt/popt.h @@ -0,0 +1,146 @@ +/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING + file accompanying popt source distributions, available from + ftp://ftp.redhat.com/pub/code/popt */ + +#ifndef H_POPT +#define H_POPT + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdio.h> /* for FILE * */ + +#define POPT_OPTION_DEPTH 10 + +#define POPT_ARG_NONE 0 +#define POPT_ARG_STRING 1 +#define POPT_ARG_INT 2 +#define POPT_ARG_LONG 3 +#define POPT_ARG_INCLUDE_TABLE 4 /* arg points to table */ +#define POPT_ARG_CALLBACK 5 /* table-wide callback... must be + set first in table; arg points + to callback, descrip points to + callback data to pass */ +#define POPT_ARG_INTL_DOMAIN 6 /* set the translation domain + for this table and any + included tables; arg points + to the domain string */ +#define POPT_ARG_VAL 7 /* arg should take value val */ +#define POPT_ARG_FLOAT 8 /* arg should be converted to float */ +#define POPT_ARG_DOUBLE 9 /* arg should be converted to double */ + +#define POPT_ARG_MASK 0x0000FFFF +#define POPT_ARGFLAG_ONEDASH 0x80000000 /* allow -longoption */ +#define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /* don't show in help/usage */ +#define POPT_ARGFLAG_STRIP 0x20000000 /* strip this arg from argv (only applies to long args) */ + +#define POPT_ARGFLAG_OR 0x08000000 /* arg will be or'ed */ +#define POPT_ARGFLAG_NOR 0x09000000 /* arg will be nor'ed */ +#define POPT_ARGFLAG_AND 0x04000000 /* arg will be and'ed */ +#define POPT_ARGFLAG_NAND 0x05000000 /* arg will be nand'ed */ +#define POPT_ARGFLAG_XOR 0x02000000 /* arg will be xor'ed */ +#define POPT_ARGFLAG_NOT 0x01000000 /* arg will be negated */ +#define POPT_ARGFLAG_LOGICALOPS \ + (POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR) + +#define POPT_CBFLAG_PRE 0x80000000 /* call the callback before parse */ +#define POPT_CBFLAG_POST 0x40000000 /* call the callback after parse */ +#define POPT_CBFLAG_INC_DATA 0x20000000 /* use data from the include line, + not the subtable */ +#define POPT_CBFLAG_SKIPOPTION 0x10000000 /* don't callback with option */ +#define POPT_CBFLAG_CONTINUE 0x08000000 /* continue callbacks with option */ + +#define POPT_ERROR_NOARG -10 +#define POPT_ERROR_BADOPT -11 +#define POPT_ERROR_OPTSTOODEEP -13 +#define POPT_ERROR_BADQUOTE -15 /* only from poptParseArgString() */ +#define POPT_ERROR_ERRNO -16 /* only from poptParseArgString() */ +#define POPT_ERROR_BADNUMBER -17 +#define POPT_ERROR_OVERFLOW -18 +#define POPT_ERROR_BADOPERATION -19 + +/* poptBadOption() flags */ +#define POPT_BADOPTION_NOALIAS (1 << 0) /* don't go into an alias */ + +/* poptGetContext() flags */ +#define POPT_CONTEXT_NO_EXEC (1 << 0) /* ignore exec expansions */ +#define POPT_CONTEXT_KEEP_FIRST (1 << 1) /* pay attention to argv[0] */ +#define POPT_CONTEXT_POSIXMEHARDER (1 << 2) /* options can't follow args */ + +struct poptOption { + /*@observer@*/ /*@null@*/ const char * longName; /* may be NULL */ + char shortName; /* may be '\0' */ + int argInfo; + /*@shared@*/ /*@null@*/ void * arg; /* depends on argInfo */ + int val; /* 0 means don't return, just update flag */ + /*@shared@*/ /*@null@*/ const char * descrip; /* description for autohelp -- may be NULL */ + /*@shared@*/ /*@null@*/ const char * argDescrip; /* argument description for autohelp */ +}; + +struct poptAlias { + /*@owned@*/ /*@null@*/ const char * longName; /* may be NULL */ + char shortName; /* may be '\0' */ + int argc; + /*@owned@*/ const char ** argv; /* must be free()able */ +}; + +extern struct poptOption poptHelpOptions[]; +#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \ + 0, "Help options", NULL }, + +typedef struct poptContext_s * poptContext; +#ifndef __cplusplus +typedef struct poptOption * poptOption; +#endif + +enum poptCallbackReason { POPT_CALLBACK_REASON_PRE, + POPT_CALLBACK_REASON_POST, + POPT_CALLBACK_REASON_OPTION }; +typedef void (*poptCallbackType)(poptContext con, + enum poptCallbackReason reason, + const struct poptOption * opt, + const char * arg, const void * data); + +/*@only@*/ poptContext poptGetContext(/*@keep@*/ const char * name, + int argc, /*@keep@*/ const char ** argv, + /*@keep@*/ const struct poptOption * options, int flags); +void poptResetContext(poptContext con); + +/* returns 'val' element, -1 on last item, POPT_ERROR_* on error */ +int poptGetNextOpt(poptContext con); +/* returns NULL if no argument is available */ +/*@observer@*/ /*@null@*/ const char * poptGetOptArg(poptContext con); +/* returns NULL if no more options are available */ +/*@observer@*/ /*@null@*/ const char * poptGetArg(poptContext con); +/*@observer@*/ /*@null@*/ const char * poptPeekArg(poptContext con); +/*@observer@*/ /*@null@*/ const char ** poptGetArgs(poptContext con); +/* returns the option which caused the most recent error */ +/*@observer@*/ const char * poptBadOption(poptContext con, int flags); +void poptFreeContext( /*@only@*/ poptContext con); +int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv); +int poptAddAlias(poptContext con, struct poptAlias alias, int flags); +int poptReadConfigFile(poptContext con, const char * fn); +/* like above, but reads /etc/popt and $HOME/.popt along with environment + vars */ +int poptReadDefaultConfig(poptContext con, int useEnv); +/* argv should be freed -- this allows ', ", and \ quoting, but ' is treated + the same as " and both may include \ quotes */ +int poptDupArgv(int argc, const char **argv, + /*@out@*/ int * argcPtr, /*@out@*/ const char *** argvPtr); +int poptParseArgvString(const char * s, + /*@out@*/ int * argcPtr, /*@out@*/ const char *** argvPtr); +/*@observer@*/ const char *const poptStrerror(const int error); +void poptSetExecPath(poptContext con, const char * path, int allowAbsolute); +void poptPrintHelp(poptContext con, FILE * f, int flags); +void poptPrintUsage(poptContext con, FILE * f, int flags); +void poptSetOtherOptionHelp(poptContext con, const char * text); +/*@observer@*/ const char * poptGetInvocationName(poptContext con); +/* shuffles argv pointers to remove stripped args, returns new argc */ +int poptStrippedArgv(poptContext con, int argc, char **argv); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/popt/poptconfig.c b/src/popt/poptconfig.c new file mode 100644 index 00000000000..7a1a4c2bf9b --- /dev/null +++ b/src/popt/poptconfig.c @@ -0,0 +1,137 @@ +/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING + file accompanying popt source distributions, available from + ftp://ftp.redhat.com/pub/code/popt */ + +#include "system.h" +#include "poptint.h" + +static void configLine(poptContext con, char * line) { + int nameLength = strlen(con->appName); + char * opt; + struct poptAlias alias; + char * entryType; + char * longName = NULL; + char shortName = '\0'; + + if (strncmp(line, con->appName, nameLength)) return; + line += nameLength; + if (!*line || !isspace(*line)) return; + while (*line && isspace(*line)) line++; + entryType = line; + + while (!*line || !isspace(*line)) line++; + *line++ = '\0'; + while (*line && isspace(*line)) line++; + if (!*line) return; + opt = line; + + while (!*line || !isspace(*line)) line++; + *line++ = '\0'; + while (*line && isspace(*line)) line++; + if (!*line) return; + + if (opt[0] == '-' && opt[1] == '-') + longName = opt + 2; + else if (opt[0] == '-' && !opt[2]) + shortName = opt[1]; + + if (!strcmp(entryType, "alias")) { + if (poptParseArgvString(line, &alias.argc, &alias.argv)) return; + alias.longName = longName, alias.shortName = shortName; + poptAddAlias(con, alias, 0); + } else if (!strcmp(entryType, "exec")) { + con->execs = realloc(con->execs, + sizeof(*con->execs) * (con->numExecs + 1)); + if (longName) + con->execs[con->numExecs].longName = xstrdup(longName); + else + con->execs[con->numExecs].longName = NULL; + + con->execs[con->numExecs].shortName = shortName; + con->execs[con->numExecs].script = xstrdup(line); + + con->numExecs++; + } +} + +int poptReadConfigFile(poptContext con, const char * fn) { + char * file, * chptr, * end; + char * buf, * dst; + int fd, rc; + int fileLength; + + fd = open(fn, O_RDONLY); + if (fd < 0) { + if (errno == ENOENT) + return 0; + else + return POPT_ERROR_ERRNO; + } + + fileLength = lseek(fd, 0, SEEK_END); + (void) lseek(fd, 0, 0); + + file = alloca(fileLength + 1); + if (read(fd, file, fileLength) != fileLength) { + rc = errno; + close(fd); + errno = rc; + return POPT_ERROR_ERRNO; + } + close(fd); + + dst = buf = alloca(fileLength + 1); + + chptr = file; + end = (file + fileLength); + while (chptr < end) { + switch (*chptr) { + case '\n': + *dst = '\0'; + dst = buf; + while (*dst && isspace(*dst)) dst++; + if (*dst && *dst != '#') { + configLine(con, dst); + } + chptr++; + break; + case '\\': + *dst++ = *chptr++; + if (chptr < end) { + if (*chptr == '\n') + dst--, chptr++; + /* \ at the end of a line does not insert a \n */ + else + *dst++ = *chptr++; + } + break; + default: + *dst++ = *chptr++; + break; + } + } + + return 0; +} + +int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv) { + char * fn, * home; + int rc; + + if (!con->appName) return 0; + + rc = poptReadConfigFile(con, "/etc/popt"); + if (rc) return rc; + if (getuid() != geteuid()) return 0; + + if ((home = getenv("HOME"))) { + fn = alloca(strlen(home) + 20); + strcpy(fn, home); + strcat(fn, "/.popt"); + rc = poptReadConfigFile(con, fn); + if (rc) return rc; + } + + return 0; +} + diff --git a/src/popt/popthelp.c b/src/popt/popthelp.c new file mode 100644 index 00000000000..c36eceadd90 --- /dev/null +++ b/src/popt/popthelp.c @@ -0,0 +1,301 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING + file accompanying popt source distributions, available from + ftp://ftp.redhat.com/pub/code/popt */ + +#include "system.h" +#include "poptint.h" + +static void displayArgs(poptContext con, + /*@unused@*/ enum poptCallbackReason foo, + struct poptOption * key, + /*@unused@*/ const char * arg, /*@unused@*/ void * data) { + if (key->shortName== '?') + poptPrintHelp(con, stdout, 0); + else + poptPrintUsage(con, stdout, 0); + exit(0); +} + +struct poptOption poptHelpOptions[] = { + { NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL, NULL }, + { "help", '?', 0, NULL, '?', N_("Show this help message"), NULL }, + { "usage", '\0', 0, NULL, 'u', N_("Display brief usage message"), NULL }, + { NULL, '\0', 0, NULL, 0, NULL, NULL } +} ; + + +/*@observer@*/ /*@null@*/ static const char *const +getTableTranslationDomain(const struct poptOption *table) +{ + const struct poptOption *opt; + + for(opt = table; + opt->longName || opt->shortName || opt->arg; + opt++) { + if(opt->argInfo == POPT_ARG_INTL_DOMAIN) + return opt->arg; + } + + return NULL; +} + +/*@observer@*/ /*@null@*/ static const char *const +getArgDescrip(const struct poptOption * opt, const char *translation_domain) +{ + if (!(opt->argInfo & POPT_ARG_MASK)) return NULL; + + if (opt == (poptHelpOptions + 1) || opt == (poptHelpOptions + 2)) + if (opt->argDescrip) return POPT_(opt->argDescrip); + + if (opt->argDescrip) return D_(translation_domain, opt->argDescrip); + return POPT_("ARG"); +} + +static void singleOptionHelp(FILE * f, int maxLeftCol, + const struct poptOption * opt, + const char *translation_domain) { + int indentLength = maxLeftCol + 5; + int lineLength = 79 - indentLength; + const char * help = D_(translation_domain, opt->descrip); + int helpLength; + const char * ch; + char format[10]; + char * left; + const char * argDescrip = getArgDescrip(opt, translation_domain); + + left = malloc(maxLeftCol + 1); + *left = '\0'; + + if (opt->longName && opt->shortName) + sprintf(left, "-%c, --%s", opt->shortName, opt->longName); + else if (opt->shortName) + sprintf(left, "-%c", opt->shortName); + else if (opt->longName) + sprintf(left, "--%s", opt->longName); + if (!*left) return ; + if (argDescrip) { + strcat(left, "="); + strcat(left, argDescrip); + } + + if (help) + fprintf(f," %-*s ", maxLeftCol, left); + else { + fprintf(f," %s\n", left); + goto out; + } + + helpLength = strlen(help); + while (helpLength > lineLength) { + ch = help + lineLength - 1; + while (ch > help && !isspace(*ch)) ch--; + if (ch == help) break; /* give up */ + while (ch > (help + 1) && isspace(*ch)) ch--; + ch++; + + sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength); + fprintf(f, format, help, " "); + help = ch; + while (isspace(*help) && *help) help++; + helpLength = strlen(help); + } + + if (helpLength) fprintf(f, "%s\n", help); + +out: + free(left); +} + +static int maxArgWidth(const struct poptOption * opt, + const char * translation_domain) { + int max = 0; + int this; + const char * s; + + while (opt->longName || opt->shortName || opt->arg) { + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { + this = maxArgWidth(opt->arg, translation_domain); + if (this > max) max = this; + } else if (!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) { + this = opt->shortName ? 2 : 0; + if (opt->longName) { + if (this) this += 2; + this += strlen(opt->longName) + 2; + } + + s = getArgDescrip(opt, translation_domain); + if (s) + this += strlen(s) + 1; + if (this > max) max = this; + } + + opt++; + } + + return max; +} + +static void singleTableHelp(FILE * f, const struct poptOption * table, + int left, + const char *translation_domain) { + const struct poptOption * opt; + const char *sub_transdom; + + opt = table; + while (opt->longName || opt->shortName || opt->arg) { + if ((opt->longName || opt->shortName) && + !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) + singleOptionHelp(f, left, opt, translation_domain); + opt++; + } + + opt = table; + while (opt->longName || opt->shortName || opt->arg) { + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { + sub_transdom = getTableTranslationDomain(opt->arg); + if(!sub_transdom) + sub_transdom = translation_domain; + + if (opt->descrip) + fprintf(f, "\n%s\n", D_(sub_transdom, opt->descrip)); + + singleTableHelp(f, opt->arg, left, sub_transdom); + } + opt++; + } +} + +static int showHelpIntro(poptContext con, FILE * f) { + int len = 6; + const char * fn; + + fprintf(f, POPT_("Usage:")); + if (!(con->flags & POPT_CONTEXT_KEEP_FIRST)) { + fn = con->optionStack->argv[0]; + if (strchr(fn, '/')) fn = strchr(fn, '/') + 1; + fprintf(f, " %s", fn); + len += strlen(fn) + 1; + } + + return len; +} + +void poptPrintHelp(poptContext con, FILE * f, /*@unused@*/ int flags) { + int leftColWidth; + + showHelpIntro(con, f); + if (con->otherHelp) + fprintf(f, " %s\n", con->otherHelp); + else + fprintf(f, " %s\n", POPT_("[OPTION...]")); + + leftColWidth = maxArgWidth(con->options, NULL); + singleTableHelp(f, con->options, leftColWidth, NULL); +} + +static int singleOptionUsage(FILE * f, int cursor, + const struct poptOption * opt, + const char *translation_domain) { + int len = 3; + char shortStr[2] = { '\0', '\0' }; + const char * item = shortStr; + const char * argDescrip = getArgDescrip(opt, translation_domain); + + if (opt->shortName) { + if (!(opt->argInfo & POPT_ARG_MASK)) + return cursor; /* we did these already */ + len++; + *shortStr = opt->shortName; + shortStr[1] = '\0'; + } else if (opt->longName) { + len += 1 + strlen(opt->longName); + item = opt->longName; + } + + if (len == 3) return cursor; + + if (argDescrip) + len += strlen(argDescrip) + 1; + + if ((cursor + len) > 79) { + fprintf(f, "\n "); + cursor = 7; + } + + fprintf(f, " [-%s%s%s%s]", opt->shortName ? "" : "-", item, + argDescrip ? (opt->shortName ? " " : "=") : "", + argDescrip ? argDescrip : ""); + + return cursor + len + 1; +} + +static int singleTableUsage(FILE * f, int cursor, const struct poptOption * table, + const char *translation_domain) { + const struct poptOption * opt; + + opt = table; + while (opt->longName || opt->shortName || opt->arg) { + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INTL_DOMAIN) + translation_domain = (const char *)opt->arg; + else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) + cursor = singleTableUsage(f, cursor, opt->arg, + translation_domain); + else if ((opt->longName || opt->shortName) && + !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) + cursor = singleOptionUsage(f, cursor, opt, translation_domain); + + opt++; + } + + return cursor; +} + +static int showShortOptions(const struct poptOption * opt, FILE * f, + char * str) { + char s[300]; /* this is larger then the ascii set, so + it should do just fine */ + + s[0] = '\0'; + if (str == NULL) { + memset(s, 0, sizeof(s)); + str = s; + } + + while (opt->longName || opt->shortName || opt->arg) { + if (opt->shortName && !(opt->argInfo & POPT_ARG_MASK)) + str[strlen(str)] = opt->shortName; + else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) + showShortOptions(opt->arg, f, str); + + opt++; + } + + if (s != str || !*s) + return 0; + + fprintf(f, " [-%s]", s); + return strlen(s) + 4; +} + +void poptPrintUsage(poptContext con, FILE * f, /*@unused@*/ int flags) { + int cursor; + + cursor = showHelpIntro(con, f); + cursor += showShortOptions(con->options, f, NULL); + singleTableUsage(f, cursor, con->options, NULL); + + if (con->otherHelp) { + cursor += strlen(con->otherHelp) + 1; + if (cursor > 79) fprintf(f, "\n "); + fprintf(f, " %s", con->otherHelp); + } + + fprintf(f, "\n"); +} + +void poptSetOtherOptionHelp(poptContext con, const char * text) { + if (con->otherHelp) xfree(con->otherHelp); + con->otherHelp = xstrdup(text); +} diff --git a/src/popt/poptint.h b/src/popt/poptint.h new file mode 100644 index 00000000000..a1edb97c4b0 --- /dev/null +++ b/src/popt/poptint.h @@ -0,0 +1,87 @@ +/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING + file accompanying popt source distributions, available from + ftp://ftp.redhat.com/pub/code/popt */ + +#ifndef H_POPTINT +#define H_POPTINT + +/* Bit mask macros. */ +typedef unsigned int __pbm_bits; +#define __PBM_NBITS (8 * sizeof (__pbm_bits)) +#define __PBM_IX(d) ((d) / __PBM_NBITS) +#define __PBM_MASK(d) ((__pbm_bits) 1 << ((d) % __PBM_NBITS)) +typedef struct { + __pbm_bits bits[1]; +} pbm_set; +#define __PBM_BITS(set) ((set)->bits) + +#define PBM_ALLOC(d) calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits)) +#define PBM_FREE(s) free(s); +#define PBM_SET(d, s) (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d)) +#define PBM_CLR(d, s) (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d)) +#define PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0) + +struct optionStackEntry { + int argc; + /*@only@*/ const char ** argv; + /*@only@*/ pbm_set * argb; + int next; + /*@only@*/ const char * nextArg; + /*@keep@*/ const char * nextCharArg; + /*@dependent@*/ struct poptAlias * currAlias; + int stuffed; +}; + +struct execEntry { + const char * longName; + char shortName; + const char * script; +}; + +struct poptContext_s { + struct optionStackEntry optionStack[POPT_OPTION_DEPTH]; + /*@dependent@*/ struct optionStackEntry * os; + /*@owned@*/ const char ** leftovers; + int numLeftovers; + int nextLeftover; + /*@keep@*/ const struct poptOption * options; + int restLeftover; + /*@only@*/ const char * appName; + /*@only@*/ struct poptAlias * aliases; + int numAliases; + int flags; + struct execEntry * execs; + int numExecs; + /*@only@*/ const char ** finalArgv; + int finalArgvCount; + int finalArgvAlloced; + /*@dependent@*/ struct execEntry * doExec; + /*@only@*/ const char * execPath; + int execAbsolute; + /*@only@*/ const char * otherHelp; + pbm_set * arg_strip; +}; + +#define xfree(_a) free((void *)_a) + +#ifdef HAVE_LIBINTL_H +#include <libintl.h> +#endif + +#if defined(HAVE_GETTEXT) && !defined(__LCLINT__) +#define _(foo) gettext(foo) +#else +#define _(foo) (foo) +#endif + +#if defined(HAVE_DGETTEXT) && !defined(__LCLINT__) +#define D_(dom, str) dgettext(dom, str) +#define POPT_(foo) D_("popt", foo) +#else +#define POPT_(foo) (foo) +#define D_(dom, str) (str) +#endif + +#define N_(foo) (foo) + +#endif diff --git a/src/popt/poptparse.c b/src/popt/poptparse.c new file mode 100644 index 00000000000..7c9f06be395 --- /dev/null +++ b/src/popt/poptparse.c @@ -0,0 +1,99 @@ +/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING + file accompanying popt source distributions, available from + ftp://ftp.redhat.com/pub/code/popt */ + +#include "system.h" + +#define POPT_ARGV_ARRAY_GROW_DELTA 5 + +int poptDupArgv(int argc, const char **argv, + int * argcPtr, const char *** argvPtr) +{ + size_t nb = (argc + 1) * sizeof(*argv); + const char ** argv2; + char * dst; + int i; + + for (i = 0; i < argc; i++) { + if (argv[i] == NULL) + return POPT_ERROR_NOARG; + nb += strlen(argv[i]) + 1; + } + + dst = malloc(nb); + argv2 = (void *) dst; + dst += (argc + 1) * sizeof(*argv); + + for (i = 0; i < argc; i++) { + argv2[i] = dst; + dst += strlen(strcpy(dst, argv[i])) + 1; + } + argv2[argc] = NULL; + + *argvPtr = argv2; + *argcPtr = argc; + return 0; +} + +int poptParseArgvString(const char * s, int * argcPtr, const char *** argvPtr) +{ + const char * src; + char quote = '\0'; + int argvAlloced = POPT_ARGV_ARRAY_GROW_DELTA; + const char ** argv = malloc(sizeof(*argv) * argvAlloced); + int argc = 0; + int buflen = strlen(s) + 1; + char * buf = memset(alloca(buflen), 0, buflen); + + argv[argc] = buf; + + for (src = s; *src; src++) { + if (quote == *src) { + quote = '\0'; + } else if (quote) { + if (*src == '\\') { + src++; + if (!*src) { + free(argv); + return POPT_ERROR_BADQUOTE; + } + if (*src != quote) *buf++ = '\\'; + } + *buf++ = *src; + } else if (isspace(*src)) { + if (*argv[argc]) { + buf++, argc++; + if (argc == argvAlloced) { + argvAlloced += POPT_ARGV_ARRAY_GROW_DELTA; + argv = realloc(argv, sizeof(*argv) * argvAlloced); + } + argv[argc] = buf; + } + } else switch (*src) { + case '"': + case '\'': + quote = *src; + break; + case '\\': + src++; + if (!*src) { + free(argv); + return POPT_ERROR_BADQUOTE; + } + /*@fallthrough@*/ + default: + *buf++ = *src; + break; + } + } + + if (strlen(argv[argc])) { + argc++, buf++; + } + + (void) poptDupArgv(argc, argv, argcPtr, argvPtr); + + free(argv); + + return 0; +} diff --git a/src/popt/system.h b/src/popt/system.h new file mode 100644 index 00000000000..43ad70f9a96 --- /dev/null +++ b/src/popt/system.h @@ -0,0 +1,55 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <ctype.h> +#include <errno.h> +#include <fcntl.h> +#include <limits.h> + +#if HAVE_MCHECK_H +#include <mcheck.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#if HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef __NeXT +/* access macros are not declared in non posix mode in unistd.h - + don't try to use posix on NeXTstep 3.3 ! */ +#include <libc.h> +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#elif defined(__GNUC__) && defined(__STRICT_ANSI__) +#define alloca __builtin_alloca +#endif + +/*@only@*/ char * xstrdup (const char *str); + +#if HAVE_MCHECK_H && defined(__GNUC__) +#define vmefail() (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL) +#define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str))) +#else +#define xstrdup(_str) strdup(_str) +#endif /* HAVE_MCHECK_H && defined(__GNUC__) */ + + +#include "popt.h" diff --git a/src/scancel/Makefile.am b/src/scancel/Makefile.am new file mode 100644 index 00000000000..2fc11a07c27 --- /dev/null +++ b/src/scancel/Makefile.am @@ -0,0 +1 @@ +# Makefile for scancel diff --git a/src/scontrol/Makefile.am b/src/scontrol/Makefile.am new file mode 100644 index 00000000000..f180d69586c --- /dev/null +++ b/src/scontrol/Makefile.am @@ -0,0 +1,2 @@ +# Makefile for scontrol + diff --git a/src/scontrol/Slurm_Admin.c b/src/scontrol/Slurm_Admin.c new file mode 100644 index 00000000000..4838614b201 --- /dev/null +++ b/src/scontrol/Slurm_Admin.c @@ -0,0 +1,318 @@ +/* + * Slurm_Admin - Administration tool for SLURM. + * Provides interface to read, write, update, and configurations. + */ + +#include <errno.h> +#include <stdio.h> +#include <string.h> + +#define BUF_SIZE 1024 +#define DEBUG_MODULE 1 +#define MAX_INPUT_FIELDS 50 + +char *Command_Name; +int Exit_Flag; /* Program to terminate if =1 */ +int Quiet_Flag; /* Quiet=1, verbose=-1, normal=0 */ + +void Dump_Command(int argc, char *argv[]); +int Get_Command(int *argc, char *argv[]); +int Process_Command(int argc, char *argv[]); +void Usage(); + +main(int argc, char *argv[]) { + int i, j; + int Error_Code; + int Input_Field_Count; + char *Input_Fields[MAX_INPUT_FIELDS]; + + Command_Name = argv[0]; + Exit_Flag = 0; + Input_Field_Count = 0; + Quiet_Flag = 0; + + if ((argc-1) > MAX_INPUT_FIELDS) { + fprintf(stderr, "%s error: No more than %d input fields permitted\n", Command_Name, MAX_INPUT_FIELDS); + exit(E2BIG); + } /* if */ + + if (argc > 1) { + if (strcmp(argv[1], "-q") == 0) { + Quiet_Flag = 1; + i = 2; + } else if (strcmp(argv[1], "-v") == 0) { + Quiet_Flag = -1; + i = 2; + } else { + i = 1; + } /* else */ + + Input_Field_Count = argc - i; + if (Input_Field_Count > 0) Exit_Flag=1; + for (j=i; j<argc; j++) { + Input_Fields[j-i] = argv[j]; + } /* for */ + } /* if */ + if (Input_Field_Count == 0) Error_Code=Get_Command(&Input_Field_Count, Input_Fields); + + while (1) { +Dump_Command(Input_Field_Count, Input_Fields); + Error_Code = Process_Command(Input_Field_Count, Input_Fields); + if (Error_Code != 0) break; + if (Exit_Flag == 1) break; + Error_Code = Get_Command(&Input_Field_Count, Input_Fields); + if (Error_Code != 0) break; + } /* while */ + + exit(Error_Code); +} /* main */ + + +/* + * Dump_Command - Dump the user's command + * Input: argc - count of arguments + * argv - the arguments + */ +void Dump_Command(int argc, char *argv[]) { + int i; + + for (i=0; i<argc; i++) { + printf("Arg %d:%s:\n", i, argv[i]); + } /* for */ +} /* Dump_Command */ + + +/* + * Get_Command - Get a command from the user + * Input: argc - location to store count of arguments + * argv - location to store the argument list + * Output: returns error code, 0 if no problems + */ +int Get_Command(int *argc, char *argv[]) { + static char *In_Line; + static int In_Line_Size = 0; + int In_Line_Pos = 0; + int Temp_Char, i; + + if (In_Line_Size == 0) { + In_Line_Size += BUF_SIZE; + In_Line = (char *)malloc(In_Line_Size); + if (In_Line == NULL) { + fprintf(stderr, "%s: Error %d allocating memory\n", Command_Name, errno); + In_Line_Size = 0; + return errno; + } /* if */ + } /* if */ + + printf("slurm_admin: "); + *argc = 0; + In_Line_Pos = 0; + + while (1) { + Temp_Char = getc(stdin); + if (Temp_Char == EOF) break; + if (Temp_Char == (int)'\n') break; + if ((In_Line_Pos+2) >= In_Line_Size) { + In_Line_Size += BUF_SIZE; + In_Line = (char *)realloc(In_Line, In_Line_Size); + if (In_Line == NULL) { + fprintf(stderr, "%s: Error %d allocating memory\n", Command_Name, errno); + In_Line_Size = 0; + return errno; + } /* if */ + } /* if */ + In_Line[In_Line_Pos++] = (char)Temp_Char; + } /* while */ + In_Line[In_Line_Pos] = (char)NULL; + + for (i=0; i<In_Line_Pos; i++) { + if (isspace((int)In_Line[i])) continue; + if (((*argc)+1) > MAX_INPUT_FIELDS) { + fprintf(stderr, "%s: Over %d fields in line: %s\n", Command_Name, MAX_INPUT_FIELDS ,In_Line); + return E2BIG; + } /* if */ + argv[(*argc)++] = &In_Line[i]; + for (i++ ; i<In_Line_Pos; i++) { + if (!isspace((int)In_Line[i])) continue; + In_Line[i] = (char)NULL; + break; + } /* for */ + } /* for */ + return 0; +} /* Get_Command */ + + +/* + * Process_Command - Process the user's command + * Input: argc - count of arguments + * argv - the arguments + * Ourput: Return code is 0 or errno (ONLY for errors fatal to Slurm_Admin) + */ +int Process_Command(int argc, char *argv[]) { + + if ((strcmp(argv[0], "exit") == 0) || + (strcmp(argv[0], "quit") == 0)) { + if (argc > 1) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + } /* if */ + Exit_Flag = 1; + return 0; + } /* if exit */ + + if (strcmp(argv[0], "help") == 0) { + if (argc > 1) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + } /* if */ + Usage(); + return 0; + } /* if */ + + if (strcmp(argv[0], "quiet") == 0) { + if (argc > 1) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + } /* if */ + Quiet_Flag = 1; + return 0; + } /* if */ + +/* if (strcmp(argv[0], "quit") == 0) See "exit" above */ + + if (strcmp(argv[0], "reconfigure") == 0) { + if (argc > 2) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + printf("%s keyword not yet implemented\n", argv[0]); + return 0; + } /* if */ + + if (strcmp(argv[0], "restart") == 0) { + if (argc > 2) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + printf("%s keyword not yet implemented\n", argv[0]); + return 0; + } /* if */ + + if (strcmp(argv[0], "show") == 0) { + if (argc > 3) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + if (argc < 2) { + fprintf(stderr, "Too few arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + if ((strcmp(argv[1],"job") != 0) && + (strcmp(argv[1],"node") != 0) && (strcmp(argv[1],"partition") != 0)) { + fprintf(stderr, "Invalid entity %s for %s keyword\n", argv[1], argv[0]); + return 0; + } /* if */ + printf("%s keyword not yet implemented\n", argv[0]); + return 0; + } /* if */ + + if (strcmp(argv[0], "start") == 0) { + if (argc > 2) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + printf("%s keyword not yet implemented\n", argv[0]); + return 0; + } /* if */ + + if (strcmp(argv[0], "stop") == 0) { + if (argc > 2) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + printf("%s keyword not yet implemented\n", argv[0]); + return 0; + } /* if */ + + if (strcmp(argv[0], "update") == 0) { + if (argc < 3) { + fprintf(stderr, "Too few arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + if ((strcmp(argv[1],"job") != 0) && + (strcmp(argv[1],"node") != 0) && (strcmp(argv[1],"partition") != 0)) { + fprintf(stderr, "Invalid entity %s for %s keyword\n", argv[1], argv[0]); + return 0; + } /* if */ + printf("%s keyword not yet implemented\n", argv[0]); + return 0; + } /* if */ + + if (strcmp(argv[0], "upload") == 0) { + if (argc > 2) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + printf("%s keyword not yet implemented\n", argv[0]); + return 0; + } /* if */ + + if (strcmp(argv[0], "verbose") == 0) { + if (argc > 1) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + } /* if */ + Quiet_Flag = -1; + return 0; + } /* if */ + + if (strcmp(argv[0], "version") == 0) { + if (argc > 1) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + } /* if */ + printf("%s version 0.1\n", Command_Name); + return 0; + } /* if */ + + if (strcmp(argv[0], "write") == 0) { + if (argc > 3) { + fprintf(stderr, "Too many arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + if (argc < 3) { + fprintf(stderr, "Too few arguments for %s keyword\n", argv[0]); + return 0; + } /* if */ + if ((strcmp(argv[1],"job") != 0) && + (strcmp(argv[1],"node") != 0) && (strcmp(argv[1],"partition") != 0)) { + fprintf(stderr, "Invalid entity %s for %s keyword\n", argv[1], argv[0]); + return 0; + } /* if */ + printf("%s keyword not yet implemented\n", argv[0]); + return 0; + } /* if */ + + fprintf(stderr, "Invalid keyword: %s\n", argv[0]); + return 0; + +} /* Process_Command */ + + +/* Usage - Show the valid slurm_admin commands */ +void Usage() { + printf("%s [-q | -v] [<keyword>]\n", Command_Name); + printf(" -q is equivalent to the keyword \"quiet\" described below.\n"); + printf(" -v is equivalent to the keyword \"verbose\" described below.\n"); + printf(" <keyword> may be omitted from the execute line and %s will execute in interactive\n"); + printf(" mode to process multiple keywords (i.e. commands). Valid <keyword> values are:\n\n"); + printf(" exit Terminate this command.\n"); + printf(" help Print this description of use.\n"); + printf(" quiet Print no messages other than error messages.\n"); + printf(" quit Terminate this command.\n"); + printf(" reconfigure [<NodeName>] Re-read configuration files, default is all nodes.\n"); + printf(" restart [<NodeName>] Stop and restart daemons, default is all nodes\n"); + printf(" show <entity> [<ID>] Display state of identified entity, default is all records.\n"); + printf(" start [<NodeName>] Start daemons as needed, default is all nodes\n"); + printf(" stop [<NodeName>] Stop daemons, default is all nodes\n"); + printf(" update <entity> <options> Update state of identified entity.\n"); + printf(" upload [<NodeName>] Upload node configuration, default is from all nodes.\n"); + printf(" verbose Enable detailed logging.\n"); + printf(" version Display tool version number.\n"); + printf(" write <entity> <filename> Write entity configuration to specified file.\n"); +} /* Usage */ diff --git a/src/slurmctld/Makefile.am b/src/slurmctld/Makefile.am new file mode 100644 index 00000000000..7347b07d5d4 --- /dev/null +++ b/src/slurmctld/Makefile.am @@ -0,0 +1,10 @@ +# Makefile for slurmctld + +INCLUDES = @CPPFLAGS@ -I$(top_srcdir)/src/common + +bin_PROGRAMS = slurmctld + +slurmctld_SOURCES = Controller.c Mach_Stat_Mgr.c Partition_Mgr.c Read_Config.c + +slurmctld_LDFLAGS = +slurmctld_LDADD = -L$(top_srcdir)/src/libcommon.a diff --git a/src/slurmd/Makefile.am b/src/slurmd/Makefile.am new file mode 100644 index 00000000000..31d6a67fdf2 --- /dev/null +++ b/src/slurmd/Makefile.am @@ -0,0 +1,2 @@ +# Makefile for slurmd + diff --git a/src/squeue/Makefile.am b/src/squeue/Makefile.am new file mode 100644 index 00000000000..8254ccc6683 --- /dev/null +++ b/src/squeue/Makefile.am @@ -0,0 +1 @@ +# Makefile for squeue diff --git a/src/srun/Makefile.am b/src/srun/Makefile.am new file mode 100644 index 00000000000..ed90c1b2d01 --- /dev/null +++ b/src/srun/Makefile.am @@ -0,0 +1,11 @@ +AUTOMAKE_OPTIONS = foreign + +INCLUDES = $(POPT_INCLUDES) + +noinst_HEADERS = opt.h + +bin_PROGRAMS = srun + +srun_SOURCES = srun.c opt.c env.c +srun_LDFLAGS = +srun_LDADD = $(POPT_LIBS) diff --git a/src/srun/env.c b/src/srun/env.c new file mode 100644 index 00000000000..98a00b15336 --- /dev/null +++ b/src/srun/env.c @@ -0,0 +1,34 @@ +/* + * + * env.c : environment manipulation + */ + +#include <stdio.h> /* BUFSIZ */ +#include <stdarg.h> /* va_* */ +#include <string.h> /* strdup */ +#include <stdlib.h> /* putenv */ + +/* + * setenvf() (stolen from pdsh) + * + * Set a variable in the callers environment. Args are printf style. + * XXX Space is allocated on the heap and will never be reclaimed. + * Example: setenvf("RMS_RANK=%d", rank); + */ +int +setenvf(const char *fmt, ...) +{ + va_list ap; + char buf[BUFSIZ]; + char *bufcpy; + + va_start(ap, fmt); + vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + + bufcpy = strdup(buf); + if (bufcpy == NULL) + return -1; + return putenv(bufcpy); +} + diff --git a/src/srun/env.h b/src/srun/env.h new file mode 100644 index 00000000000..5d582d9f655 --- /dev/null +++ b/src/srun/env.h @@ -0,0 +1,15 @@ +/* */ + +#ifndef _HAVE_ENV_H +#define _HAVE_ENV_H + +/* + * stolen from pdsh: + * + * Set a variable in the callers environment. Args are printf style. + * XXX Space is allocated on the heap and will never be reclaimed. + * Example: setenvf("RMS_RANK=%d", rank); + */ +int setenvf(const char *fmt, ...); + +#endif /* _HAVE_ENV_H */ diff --git a/src/srun/opt.c b/src/srun/opt.c new file mode 100644 index 00000000000..2f1268750b6 --- /dev/null +++ b/src/srun/opt.c @@ -0,0 +1,1018 @@ +/* $Id$ */ + +#include "config.h" + +#include <string.h> /* strcpy, strncasecmp */ + +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif + +#include <stdarg.h> /* va_start */ +#include <stdlib.h> /* getenv */ +#include <pwd.h> /* getpwuid */ +#include <ctype.h> /* isdigit */ +#include <sys/param.h> /* MAXPATHLEN */ + +#include "opt.h" +#include "env.h" + +#define tf_(b) (b == true) ? "true" : "false" + +#define __DEBUG 1 + +/*---[ popt definitions ]------------------------------------------------*/ + +/* generic OPT_ definitions -- mainly for use with env vars + * (not to be confused with POPT_* definitions) + */ +#define OPT_NONE 0x00 +#define OPT_INT 0x01 +#define OPT_STRING 0x02 + +/* specific options, used with popt (and env var processing) */ +#define OPT_NPROCS 0x03 +#define OPT_CPUS 0x04 +#define OPT_NODES 0x05 +#define OPT_PARTITION 0x06 +#define OPT_BASENODE 0x07 +#define OPT_DISTRIB 0x08 +#define OPT_OUTPUT 0x09 +#define OPT_INPUT 0x0a +#define OPT_ERROR 0x0b +#define OPT_CORE 0x0c +#define OPT_VERBOSE 0x0d +#define OPT_DEBUG 0x0e +#define OPT_ALLOCATE 0x0f +#define OPT_ATTACH 0x10 +#define OPT_CONST 0x11 +#define OPT_VERSION 0x12 +#define OPT_JOIN 0x13 +#define OPT_STEAL 0x14 +#define OPT_CDDIR 0x15 + +/* constraint type options */ +#define OPT_MINCPUS 0x50 +#define OPT_REALMEM 0x51 +#define OPT_VIRTMEM 0x52 +#define OPT_TMPDISK 0x53 +#define OPT_CONTIG 0x54 +#define OPT_NODELIST 0x55 +#define OPT_CONSTRAINT 0x56 + + +#ifndef POPT_TABLEEND +# define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL } +#endif + +/* options related to attach mode only */ +struct poptOption attachTable[] = { + { "attach", 'a', POPT_ARG_STRING, &opt.attach, OPT_ATTACH, + "attach to running job with job id = id", + "id" + }, + { "join", 'j', POPT_ARG_NONE, &opt.join, 0, + "join with running job", + }, + { "steal", 's', POPT_ARG_NONE, NULL, OPT_STEAL, + "steal connection to running job", + }, + POPT_TABLEEND +}; + +/* options directly related to allocate-only mode */ +struct poptOption allocateTable[] = { + { "allocate", 'A', POPT_ARG_NONE, &opt.allocate, OPT_ALLOCATE, + "allocate resources and spawn a shell", + }, + POPT_TABLEEND +}; + +/* define constraint options here */ +struct poptOption constraintTable[] = { + { "mincpus", '\0', POPT_ARG_INT, &opt.mincpus, OPT_MINCPUS, + "minimum number of cpus per node", + "n" + }, + { "mem", '\0', POPT_ARG_STRING, NULL, OPT_REALMEM, + "minimum amount of real memory", + "MB" + }, + { "tmp", '\0', POPT_ARG_STRING, NULL, OPT_TMPDISK, + "minimum amount of temp disk", + "MB" + }, + { "constraint", 'C' , POPT_ARG_STRING, &opt.constraints, + OPT_CONSTRAINT, "specify a list of constraints", + "list" + }, + { "contiguous", '\0', POPT_ARG_NONE, &opt.contiguous, OPT_CONTIG, + "demand a contiguous range of nodes", + }, + { "nodelist", 'w', POPT_ARG_STRING, &opt.nodelist, OPT_NODELIST, + "request a specific list of hosts", + "host1,host2,..." + }, + POPT_TABLEEND +}; + + +/* options that affect parallel runs (may or may not apply to modes + * above + */ +struct poptOption runTable[] = { + { "nprocs", 'n', POPT_ARG_INT, &opt.nprocs, OPT_NPROCS, + "number of processes to run", + "nprocs" + }, + { "cpus", 'c', POPT_ARG_INT, &opt.cpus, OPT_CPUS, + "number of cpus required per process", + "ncpus" + }, + { "nodes", 'N', POPT_ARG_INT, &opt.nodes, OPT_NODES, + "number of nodes on which to run", + "nnodes" + }, + { "partition", 'p', POPT_ARG_STRING, &opt.partition, OPT_PARTITION, + "partition requested", + "partition" + }, + { "cddir", 'D', POPT_ARG_STRING, NULL, OPT_CDDIR, + "change current working directory of remote procs", + "path" + }, + { "immediate", 'I', POPT_ARG_NONE, &opt.immediate, 0, + "exit if resources are not immediately available", + }, + { "overcommit", 'O', POPT_ARG_NONE, &opt.overcommit, 0, + "overcommit resources", + }, + { "label", 'l', POPT_ARG_NONE, &opt.labelio, 0, + "prepend task number to lines of stdout/err", + }, + { "distribution", 'm', POPT_ARG_STRING, 0, OPT_DISTRIB, + "distribution method for processes", + "(block|cyclic)" + }, + { "job-name", 'J', POPT_ARG_STRING, &opt.job_name, 0, + "name of job", + "jobname" + }, + { "output", 'o', POPT_ARG_STRING, 0, OPT_OUTPUT, + "location of stdout redirection", + "out" + }, + { "input", 'i', POPT_ARG_STRING, 0, OPT_INPUT, + "location of stdin redirection", + "in" + }, + { "error", 'e', POPT_ARG_STRING, 0, OPT_ERROR, + "location of stderr redirection", + "err" + }, +/* { "corefile-format", '\0', POPT_ARG_STRING, &opt.core_format, 0, + "corefile output format", + "format" + }, +*/ { "verbose", 'v', 0, 0, OPT_VERBOSE, + "verbose operation", + }, + { "debug", 'd', 0, 0, OPT_DEBUG, + "enable debug", + }, + POPT_TABLEEND +}; + +/* table of "other" options (just version information for now) */ +struct poptOption otherTable[] = { + { "version", 'V', POPT_ARG_NONE, 0, OPT_VERSION, + "output version information and exit" + }, + POPT_TABLEEND +}; + +/* full option table: */ +struct poptOption options[] = { + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &runTable, 0, + "Parallel run options:", NULL + }, + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &allocateTable, 0, + "Allocate only:", NULL + }, + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &attachTable, 0, + "Attach to running job:", NULL + }, + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &constraintTable, 0, + "Constraint options:" + }, + POPT_AUTOHELP + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &otherTable, 0, + "Other options:", NULL + }, + POPT_TABLEEND +}; + +/*---[ end popt definitions ]---------------------------------------------*/ + +/*---[ env var processing ]-----------------------------------------------*/ + +/* + * try to use a similar scheme as popt. + * + * in order to add a new env var (to be processed like an option): + * + * define a new entry into env_vars[], if the option is a simple int + * or string you may be able to get away with adding a pointer to the + * option to set. Otherwise, process var based on "type" in opt_env. + */ +struct env_vars_t { + const char *var; + int type; + void *arg; +}; + +struct env_vars_t env_vars[] = { + { "SLURM_DEBUG", OPT_DEBUG, NULL }, + { "SLURM_NPROCS", OPT_INT, &opt.nprocs }, + { "SLURM_CPUS_PER_TASK", OPT_INT, &opt.cpus }, + { "SLURM_NNODES", OPT_INT, &opt.nodes }, + { "SLURM_PARTITION", OPT_STRING, &opt.partition }, + { "SLURM_STDINMODE", OPT_INPUT, &opt.input }, + { "SLURM_STDOUTMODE", OPT_OUTPUT, &opt.output }, + { "SLURM_STDERRMODE", OPT_ERROR, &opt.error }, + { "SLURM_DISTRIBUTION", OPT_DISTRIB, NULL }, + { NULL, 0, NULL } +}; + +/* forward declarations of static functions + * + */ + +/* + * fill in default options + */ +static void opt_default(); + +/* set options based upon env vars + */ +static void opt_env(); + +/* set options based upon commandline args + */ +static void opt_args(int, char **); + +/* verity options sanity + */ +static bool opt_verify(poptContext, bool, bool, bool); + +/* list known options and their settings + */ +static void opt_list(); + +/*---[ end forward declarations of static functions ]---------------------*/ + +int +initialize_and_process_args(int argc, char *argv[]) +{ + /* initialize option defaults */ + opt_default(); + + /* initialize options with env vars */ + opt_env(); + + /* initialize options with argv */ + opt_args(argc, argv); + +#ifdef __DEBUG + opt_list(); +#endif + return 1; + +} + +static char * +xbasename(char *path) +{ + char *p; + + p = strchr(path, '/'); + return(p ? (p + 1) : path); +} + +static void +print_version() +{ + printf("%s %s\n", PACKAGE, VERSION); +} + +/* + * verify_iotype(): helper for output/input/error arguments. + * + * will return IO_NORMAL if string matches "normal" + * + * prunes off trailing '%' char after setting IO_PER_TASK if such + * a one exists. + */ +static enum io_t +verify_iotype(char **name) +{ + enum io_t type; + char *p = *name; + int end = strlen(p) - 1; + + /* name must have form "file.%" to be IO_PER_TASK */ + if (p[end] == '%') { + type = IO_PER_TASK; + p[end] = '\0'; /* no longer need % char */ + + } else if (strncasecmp(p, "normal", (size_t) 6) != 0) + type = IO_ALL; + else if (strncasecmp(p, "none", (size_t) 4) != 0) + type = IO_NONE; + else + type = IO_NORMAL; + + return type; +} + +/* + * verify that a distribution type in arg is of a known form + * returns the distribution_t or DIST_UNKNOWN + */ +static enum distribution_t +verify_dist_type(const char *arg) +{ + enum distribution_t result = DIST_UNKNOWN; + + if (strncasecmp(arg, "cyclic", strlen(arg)) == 0) + result = DIST_CYCLIC; + else if (strncasecmp(arg, "block", strlen(arg)) == 0) + result = DIST_BLOCK; + else + result = DIST_UNKNOWN; + + return result; +} + +/* + * to_bytes(): verify that arg is numeric with optional "G" or "M" at end + * if "G" or "M" is there, multiply by proper power of 2 and return + * number in bytes + */ +static long +to_bytes(const char *arg) +{ + char *buf; + char *endptr; + int end; + int multiplier = 1; + long result; + + buf = strdup(arg); + + end = strlen(buf) - 1; + + if (isdigit(buf[end])) { + result = strtol(buf, &endptr, 10); + + if (*endptr != '\0') + result = -result; + + } else { + + switch(toupper(buf[end])) { + + case 'G': + multiplier = 1024; + break; + + case 'M': + /* do nothing */ + break; + + default: + multiplier = -1; + } + + buf[end] = '\0'; + + result = multiplier * strtol(buf, &endptr, 10); + + if (*endptr != '\0') + result = -result; + + } + + + return result; +} + + +/* set a few env vars for allocate mode so they'll be available in + * the resulting subshell + */ +static void +set_allocate_mode_env_vars() +{ + int rc; + + if (opt.output == IO_ALL) { + /* all output to single file*/ + rc = setenvf("SLURM_OUTPUT=%s", opt.ofname); + } else if (opt.output == IO_PER_TASK) { + /* output is per task, need to put '%' char back */ + rc = setenvf("SLURM_OUTPUT=%s%%", opt.ofname); + } + + if (opt.error == IO_ALL) { + rc = setenvf("SLURM_ERROR=%s", opt.efname); + } else if (opt.output == IO_PER_TASK) { + rc = setenvf("SLURM_ERROR=%s%%", opt.efname); + } + + if (opt.input == IO_ALL) { + rc = setenvf("SLURM_INPUT=%s", opt.ifname); + } else if (opt.input == IO_PER_TASK) { + rc = setenvf("SLURM_INPUT=%s%%", opt.ifname); + } + +} + +/* + * print error message to stderr with opt.progname prepended + */ +static void argerror(const char *msg, ...) +{ + va_list ap; + char buf[256]; + + va_start(ap, msg); + vsnprintf(buf, sizeof(buf), msg, ap); + + fprintf(stderr, "%s: %s\n", + opt.progname ? opt.progname : "srun", + buf); + va_end(ap); +} + +/* + * opt_default(): used by initialize_and_process_args to set defaults + */ +static void +opt_default() +{ + char buf[MAXPATHLEN+1]; + struct passwd *pw; + + if ((pw = getpwuid(getuid())) != NULL) { + strncpy(opt.user, pw->pw_name, MAX_USERNAME); + opt.uid = pw->pw_uid; + } else + argerror("who are you?"); + + + if ((getcwd(buf, MAXPATHLEN)) == NULL) { + argerror("getcwd failed\n"); + exit(1); + } + + opt.cwd = strdup(buf); + + opt.progname = NULL; + + opt.nprocs = 1; + opt.cpus = 1; + opt.nodes = 1; + opt.partition = NULL; + + opt.job_name = ""; + + opt.distribution = DIST_BLOCK; + + opt.output = IO_NORMAL; + opt.input = IO_NORMAL; + opt.error = IO_NORMAL; + opt.ofname = NULL; + opt.ifname = NULL; + opt.efname = NULL; + + opt.core_format = "normal"; + + opt.labelio = false; + opt.overcommit = false; + + opt.immediate = false; + + opt.allocate = false; + opt.attach = NULL; + opt.join = false; + + verbose = 0; + debug = 0; + + /* constraint default (-1 is no constraint) */ + opt.mincpus = -1; + opt.realmem = -1; + opt.tmpdisk = -1; + opt.constraints = NULL; + opt.contiguous = false; + opt.nodelist = NULL; + + mode = MODE_NORMAL; + +} + +/* + * opt_env(): used by initialize_and_process_args to set options via + * environment variables. See comments above for how to + * extend srun to process different vars + */ +static void +opt_env() +{ + char *val; + char *end; + struct env_vars_t *e = env_vars; + + while (e->var) { + + if (debug > 0) + fprintf(stderr, "looking for env var %s\n", e->var); + + if ((val = getenv(e->var)) != NULL) { + + if (debug > 0) + fprintf(stderr, "now processing env var %s=%s\n", + e->var, val); + + switch (e->type) { + case OPT_STRING: + *((char **)e->arg) = strdup(val); + break; + + case OPT_INT: + if (val != NULL ) { + *((int *)e->arg) = (int)strtol(val, &end, 10); + + if (!(end && *end == '\0')) { + fprintf(stderr, "%s=%s invalid" + ". ignoring...\n", + e->var, val); + } + } + break; + + case OPT_DEBUG: + if (val != NULL) { + debug = (int) strtol(val, &end, 10); + if (!(end && *end == '\0')) { + fprintf(stderr, "%s=%s invalid\n", + e->var, val); + } + } + break; + + case OPT_INPUT: + case OPT_OUTPUT: + case OPT_ERROR: + if (val != NULL) { + *((char **)e->arg) = strdup(val); + } + break; + + case OPT_DISTRIB: + { + enum distribution_t dt = + verify_dist_type(val); + + if (dt == DIST_UNKNOWN) { + argerror("\"%s=%s\" -- " + "invalid distribution type." + " ignoring...", + e->var, val); + } else + opt.distribution = dt; + + } + break; + + default: + /* do nothing */ + break; + } + + } + + e++; + } + + +} + +/* + * opt_args() : set options via commandline args and popt + */ +static void +opt_args(int ac, char ** av) +{ + int rc; + int i; + bool nprocs_set, nnodes_set, cpus_set; + const char **rest; + const char *arg; + poptContext optctx; + + opt.progname = xbasename(av[0]); + + optctx = poptGetContext("srun", ac, (const char **)av, options, + POPT_CONTEXT_POSIXMEHARDER); + + poptSetOtherOptionHelp(optctx, "[OPTIONS...] executable [args...]"); + + poptReadDefaultConfig(optctx, 0); + + /* first pass through args to see if attach or allocate mode + * are set + */ + while ((rc = poptGetNextOpt(optctx)) > 0) { + arg = poptGetOptArg(optctx); + + switch (rc) { + case OPT_VERSION: + print_version(); + exit(0); + break; + + case OPT_ATTACH: + if (opt.allocate) { + argerror("cannot simultaneously allocate " + "and attach"); + exit(1); + } + mode = MODE_ATTACH; + opt.attach = strdup(arg); + break; + + case OPT_ALLOCATE: + if (opt.attach != NULL) { + argerror("cannot simultaneously allocate " + "and attach"); + exit(1); + } + mode = MODE_ALLOCATE; + break; + + default: + break; + /* do nothing */ + } + } + + + poptResetContext(optctx); + + nprocs_set = false; + nnodes_set = false; + cpus_set = false; + + + while ((rc = poptGetNextOpt(optctx)) > 0) { + arg = poptGetOptArg(optctx); + + switch (rc) { + case OPT_VERBOSE: + verbose++; + break; + + case OPT_DEBUG: + debug++; + break; + + case OPT_OUTPUT: + opt.ofname = strdup(arg); + opt.output = verify_iotype(&opt.ofname); + break; + + case OPT_INPUT: + opt.ifname = strdup(arg); + opt.input = verify_iotype(&opt.ifname); + break; + + case OPT_ERROR: + opt.efname = strdup(arg); + opt.error = verify_iotype(&opt.efname); + break; + + case OPT_DISTRIB: + opt.distribution = verify_dist_type(arg); + if (opt.distribution == DIST_UNKNOWN) { + argerror("Error: distribution type `%s' " + "is not recognized", arg); + poptPrintUsage(optctx, stderr, 0); + exit(1); + } + break; + + case OPT_NPROCS: + nprocs_set = true; + break; + + case OPT_CPUS: + cpus_set = true; + break; + + case OPT_NODES: + nnodes_set = true; + break; + + case OPT_REALMEM: + opt.realmem = (int) to_bytes(arg); + if (opt.realmem < 0) { + argerror("Error: invalid memory constraint %s", + arg); + exit(1); + } + break; + + case OPT_TMPDISK: + opt.tmpdisk = to_bytes(arg); + if (opt.tmpdisk < 0) { + argerror("Error: invalid tmp disk constraint %s", + arg); + exit(1); + } + break; + + case OPT_CDDIR: + free(opt.cwd); + opt.cwd = strdup(arg); + break; + + case OPT_JOIN: + if (opt.attach == NULL) { + argerror("Error: --join only makes sense " + "with --attach"); + exit(1); + } + opt.join = true; + break; + + case OPT_STEAL: + if (opt.attach == NULL) { + argerror("Error: --steal only makes sense " + "with --attach"); + exit(1); + } + opt.join = false; + break; + + default: + break; + /* do nothing */ + } + } + + + if (rc < -1) { + argerror("bad argument %s: %s", + poptBadOption(optctx, POPT_BADOPTION_NOALIAS), + poptStrerror(rc)); + poptPrintUsage(optctx, stderr, 0); + + exit(1); + } + + rest = poptGetArgs(optctx); + remote_argc = 0; + + if (rest != NULL) { + while (rest[remote_argc] != NULL) + remote_argc++; + } + + remote_argv = (char **) malloc(remote_argc*sizeof(char *)); + + for (i = 0; i < remote_argc; i++) + remote_argv[i] = strdup(rest[i]); + + if (!opt_verify(optctx, nnodes_set, cpus_set, nprocs_set)) { + poptPrintUsage(optctx, stderr, 0); + exit(1); + } + + poptFreeContext(optctx); + +} + +/* + * opt_verify : perform some post option processing verification + * + */ +static bool +opt_verify(poptContext optctx, + bool nodes_set, bool cpus_set, bool procs_set) +{ + bool verified = true; + + + if (mode == MODE_ATTACH) { /* attach to a running job */ + if (nodes_set || cpus_set || procs_set) { + argerror("do not specific a node allocation " + "with --attach (-a)"); + verified = false; + } + + if (constraints_given()) { + argerror("do not specify any constraints with " + "--attach (-a)"); + verified = false; + } + + + /* XXX check here to see if job to attach to exists ? */ + + /* XXX what other args are incompatible with attach mode? */ + + } else { + + if (mode == MODE_ALLOCATE) { + + /* + if (remote_argc > 0) { + argerror("Error: do not specify a remote " + "command with --allocate (-A)"); + verified = false; + } + */ + + /* set output/input/err (an whatever else) as + * env vars so they will be "defaults" in allocate + * subshell + */ + set_allocate_mode_env_vars(); + + } else { + + if (remote_argc == 0) { + argerror("Error: must supply remote command"); + verified = false; + } + } + + + /* check for realistic arguments */ + if (opt.nprocs <= 0) { + fprintf(stderr, "%s: invalid number of processes (-n %d)\n", + opt.progname, opt.nprocs); + verified = false; + } + + if (opt.cpus <= 0) { + fprintf(stderr, "%s: invalid number of cpus per process" + "(-n %d)\n", opt.progname, opt.cpus); + verified = false; + } + + if (opt.nodes <= 0) { + fprintf(stderr, "%s: invalid number of nodes (-N %d)\n", + opt.progname, opt.nodes); + verified = false; + } + + /* massage the numbers */ + if (nodes_set && !procs_set) { + /* 1 proc / node default */ + opt.nprocs = opt.nodes; + + } else if (nodes_set && procs_set) { + + /* make sure # of procs >= nodes */ + if (opt.nprocs < opt.nodes) { + + argerror("Warning: can't run %d " + "processes on %d nodes, setting " + "nodes to %d", opt.nprocs, + opt.nodes, opt.nprocs); + + opt.nodes = opt.nprocs; + } + + } else if (procs_set && !nodes_set) { + + opt.nodes = opt.nprocs; + + } + + } + + + return verified; +} + +#ifdef __DEBUG + +/* generate meaningful output message based on io type and "filename" */ +char * +print_io_t_with_filename(enum io_t type, char *filename) +{ + char buf[256]; + + switch (type) { + case IO_ALL: + snprintf(buf, 256, "%s (file `%s')", + format_io_t(type), + filename); + break; + + case IO_PER_TASK: + snprintf(buf, 256, "%s (file `%s<task_id>')", + format_io_t(type), + filename); + break; + + case IO_NORMAL: + snprintf(buf, 256, "normal"); + break; + + default: + snprintf(buf, 256, "error, unknown type"); + break; + } + return strdup(buf); +} + +static char * +print_constraints() +{ + char buf[256]; + + buf[0] = '\0'; + + if (opt.mincpus > 0) + snprintf(buf, 256, "mincpus=%d", opt.mincpus); + + if (opt.realmem > 0) + snprintf(buf, 256, "%s mem=%dM", buf, opt.realmem); + + if (opt.tmpdisk > 0) + snprintf(buf, 256, "%s tmp=%ldM", buf, opt.tmpdisk); + + if (opt.contiguous == true) + snprintf(buf, 256, "%s contiguous", buf); + + if (opt.nodelist != NULL) + snprintf(buf, 256, "%s nodelist=%s", buf, opt.nodelist); + + if (opt.constraints != NULL) + snprintf(buf, 256, "%s constraints=`%s'", buf, + opt.constraints); + + return strdup(buf); +} + +static void +opt_list() +{ + int i; + + printf("\ndefined options for program `%s'\n", opt.progname); + printf("------------ ---------------------\n"); + + printf("user : `%s'\n", opt.user); + printf("uid : %ld\n" , (long)opt.uid); + printf("cwd : %s\n" , opt.cwd); + printf("nprocs : %d\n", opt.nprocs); + printf("cpus/proc : %d\n", opt.cpus); + printf("nodes : %d\n", opt.nodes); + printf("total cpus : %d\n", opt.nprocs * opt.cpus); + printf("partition : %s\n", + opt.partition == NULL ? "default" : opt.partition); + printf("job name : `%s'\n", opt.job_name); + printf("distribution: %s\n", + format_distribution_t(opt.distribution)); + printf("output : %s\n", + print_io_t_with_filename(opt.output, opt.ofname)); + printf("error : %s\n", + print_io_t_with_filename(opt.error, opt.efname)); + printf("input : %s\n", + print_io_t_with_filename(opt.input, opt.ifname)); + printf("core format : %s\n", opt.core_format); + printf("verbose : %d\n" , verbose); + printf("debug : %d\n" , debug); + printf("immediate : %s\n" , tf_(opt.immediate)); + printf("label output: %s\n" , tf_(opt.labelio)); + printf("allocate : %s\n" , tf_(opt.allocate)); + printf("attach : `%s'\n", opt.attach); + printf("overcommit : %s\n" , tf_(opt.overcommit)); + printf("\n"); + printf("constraints : %s\n" , print_constraints()); + printf("\n"); + printf("remote command :"); + + for (i = 0; i < remote_argc; i++) + printf(" %s", remote_argv[i]); + printf("\n"); + +} +#endif /* __DEBUG */ + diff --git a/src/srun/opt.h b/src/srun/opt.h new file mode 100644 index 00000000000..e2365045c56 --- /dev/null +++ b/src/srun/opt.h @@ -0,0 +1,136 @@ +/* $Id$ */ + +/* Options for srun */ + +#ifndef _HAVE_OPT_H + +#include "config.h" + +#include <sys/types.h> +#include <unistd.h> + +/* +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif + +#include <getopt.h> +*/ + +#ifndef HAVE_POPT_H +# include "popt/popt.h" +#else +# include <popt.h> +#endif + +#ifndef _BOOL_DEFINED +#define _BOOL_DEFINED +typedef enum {false, true} bool; +#endif + +#define MAX_USERNAME 9 + +/* global variables relating to user options */ +char **remote_argv; +int remote_argc; +int debug; +int verbose; + +/* mutually exclusive modes for srun */ +enum modes { + MODE_UNKNOWN = 0, + MODE_NORMAL = 1, + MODE_IMMEDIATE = 2, + MODE_ATTACH = 3, + MODE_ALLOCATE = 4 +}; + +enum modes mode; + +enum distribution_t { + DIST_UNKNOWN = 0, + DIST_BLOCK = 1, + DIST_CYCLIC = 2 +}; + +#define format_distribution_t(t) (t == DIST_BLOCK) ? "block" : \ + (t == DIST_CYCLIC) ? "cyclic" : \ + "unknown" + +enum io_t { + IO_NORMAL = 0, + IO_ALL = 1, + IO_PER_TASK = 2, + IO_NONE = 3, +}; + +#define format_io_t(t) (t == IO_NORMAL) ? "normal" : (t == IO_ALL) ? \ + "all" : "per task" + +typedef struct srun_options { + + char *progname; /* argv[0] of this program */ + char user[MAX_USERNAME];/* local username */ + uid_t uid; /* local uid */ + char *cwd; /* current working directory */ + + int nprocs; /* --nprocs=n, -n n */ + int cpus; /* --cpus=n, -c n */ + int nodes; /* --nodes=n, -N n */ + char *partition; /* --partition=n, -p n */ + enum distribution_t + distribution; /* --distribution=, -m dist */ + char *job_name; /* --job-name=, -J name */ + + enum io_t output; /* --output=, -o type */ + char *ofname; /* output filename if PER_TASK */ + + enum io_t input; /* --input=, -i type */ + char *ifname; /* input filename if PER_TASK */ + + enum io_t error; /* --error=, -e type */ + char *efname; /* stderr filename if PER_TASK */ + + char *core_format; /* --corefile-format=, -C type */ + char *attach; /* --attach=id -a id */ + bool join; /* --join, -j */ + + /* no longer need these, they are set globally : */ + /*int verbose;*/ /* -v, --verbose */ + /*int debug;*/ /* -d, --debug */ + + int immediate; /* -i, --immediate */ + + bool labelio; /* --label-output, -l */ + bool allocate; /* --allocate, -A */ + bool overcommit; /* --overcommit, -O */ + + /* constraint options */ + int mincpus; /* --mincpus=n */ + int realmem; /* --mem=n */ + long tmpdisk; /* --tmp=n */ + char *constraints; /* --constraints=, -C constraint*/ + bool contiguous; /* --contiguous */ + char *nodelist; /* --nodelist=node1,node2,... */ + +} opt_t; + +opt_t opt; + +/* return whether any constraints were specified by the user + * (if new constraints are added above, might want to add them to this + * macro or move this to a function if it gets a little complicated) + */ +#define constraints_given() opt.mincpus > 0 || opt.realmem > 0 ||\ + opt.tmpdisk > 0 ||\ + opt.contiguous || opt.nodelist != NULL + +/* process options: + * 1. set defaults + * 2. update options with env vars + * 3. update options with commandline args + * 4. perform some verification that options are reasonable + */ +int initialize_and_process_args(int argc, char *argv[]); + +#endif /* _HAVE_OPT_H */ diff --git a/src/srun/srun.c b/src/srun/srun.c new file mode 100644 index 00000000000..64e40422f8e --- /dev/null +++ b/src/srun/srun.c @@ -0,0 +1,36 @@ +/* */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#ifdef HAVE_PTHREAD_H +# include <pthread.h> +#endif + +#include <stdio.h> +#include <stdlib.h> + +#include <opt.h> +#include <env.h> + + +int +main(int ac, char **av) +{ + /* set default options, process commandline arguments, and + * verify some basic values + */ + initialize_and_process_args(ac, av); + + exit(0); +} + +static void +create_job_spec() +{ + +} + + + diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 00000000000..9788f70238c --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp -- GitLab