]> git.cworth.org Git - fips/commitdiff
Initial commit of fips repository
authorCarl Worth <cworth@cworth.org>
Mon, 22 Apr 2013 21:24:30 +0000 (14:24 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 23 Apr 2013 20:58:30 +0000 (13:58 -0700)
Just a build system and a stub of a main program for now, (which
doesn't do anything yet).

.gitignore [new file with mode: 0644]
Makefile [new file with mode: 0644]
Makefile.local [new file with mode: 0644]
configure [new file with mode: 0755]
fips.c [new file with mode: 0644]
version [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..5a5d08a
--- /dev/null
@@ -0,0 +1,6 @@
+.deps
+.first-build-message
+Makefile.config
+fips
+*.o
+*~
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..6938f22
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,34 @@
+# Default target
+all:
+
+# List all subdirectores here. Each contains its own Makefile.local
+subdirs :=
+
+# We make all targets depend on the Makefiles themselves.
+global_deps = Makefile Makefile.config Makefile.local \
+       $(subdirs:%=%/Makefile) $(subdirs:%=%/Makefile.local)
+
+# Get settings from the output of configure by running it to generate
+# Makefile.config if it doesn't exist yet.
+
+# If Makefile.config doesn't exist, then srcdir won't be
+# set. Conditionally set it (assuming a plain srcdir build) so that
+# the rule to generate Makefile.config can actually work.
+srcdir ?= .
+
+include Makefile.config
+Makefile.config: $(srcdir)/configure
+ifeq ($(configure_options),)
+       @echo ""
+       @echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
+       @echo "      but if you want to specify any arguments (such as an alternate prefix"
+       @echo "      into which to install), call ./configure explicitly and then make again."
+       @echo "      See \"./configure --help\" for more details."
+       @echo ""
+endif
+       $(srcdir)/configure $(configure_options)
+
+# Finally, include all of the Makefile.local fragments where all the
+# real work is done.
+
+include $(subdirs:%=%/Makefile.local) Makefile.local
diff --git a/Makefile.local b/Makefile.local
new file mode 100644 (file)
index 0000000..8ca5136
--- /dev/null
@@ -0,0 +1,260 @@
+# -*- makefile -*-
+
+# Here's the (hopefully simple) versioning scheme.
+#
+# Releases of fips have a two-digit version (0.1, 0.2, etc.). We
+# increment the second digit for each release and increment the first
+# digit when we reach particularly major milestones of usability.
+#
+# Between releases, (such as when compiling fips from the git
+# repository), we let git append identification of the actual commit.
+PACKAGE=fips
+
+IS_GIT=$(shell if [ -d .git ] ; then echo yes ; else echo no; fi)
+
+ifeq ($(IS_GIT),yes)
+DATE:=$(shell git log --date=short -1 --pretty=format:%cd)
+else
+DATE:=$(shell date +%F)
+endif
+
+VERSION:=$(shell cat ${srcdir}/version)
+ifeq ($(filter release release-message pre-release, $(MAKECMDGOALS)),)
+ifeq ($(IS_GIT),yes)
+VERSION:=$(shell git describe --match '[0-9.]*' 2>/dev/null | sed -e s/_/~/ -e s/-/+/ -e s/-/~/)
+endif
+endif
+
+UPSTREAM_TAG=$(subst ~,_,$(VERSION))
+DEB_TAG=debian/$(UPSTREAM_TAG)-1
+
+RELEASE_HOST=cworth.org
+RELEASE_DIR=/home/cworth/public_html/fips/releases
+RELEASE_URL=http://cworth.org/fips/releases
+TAR_FILE=$(PACKAGE)-$(VERSION).tar.gz
+DEB_TAR_FILE=$(PACKAGE)_$(VERSION).orig.tar.gz
+SHA1_FILE=$(TAR_FILE).sha1
+GPG_FILE=$(SHA1_FILE).asc
+
+# Smash together user's values with our extra values
+FINAL_CFLAGS = -DFIPS_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
+FINAL_FIPS_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(TALLOC_LDFLAGS)
+FINAL_FIPS_LINKER = CC
+ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
+FINAL_FIPS_LDFLAGS += $(CONFIGURE_LDFLAGS)
+endif
+ifeq ($(LIBDIR_IN_LDCONFIG),0)
+FINAL_FIPS_LDFLAGS += $(RPATH_LDFLAGS)
+endif
+
+.PHONY: all
+all: fips
+ifeq ($(MAKECMDGOALS),)
+ifeq ($(shell cat .first-build-message 2>/dev/null),)
+       @FIPS_FIRST_BUILD=1 $(MAKE) --no-print-directory all
+       @echo ""
+       @echo "Compilation of fips is now complete. You can install fips with:"
+       @echo ""
+       @echo " make install"
+       @echo ""
+       @echo "Note that depending on the prefix to which you are installing"
+       @echo "you may need root permission (such as \"sudo make install\")."
+       @echo "See \"./configure --help\" for help on setting an alternate prefix."
+       @echo Printed > .first-build-message
+endif
+endif
+
+$(TAR_FILE):
+       if git tag -v $(VERSION) >/dev/null 2>&1; then \
+           ref=$(VERSION); \
+        else \
+           ref="HEAD" ; \
+          echo "Warning: No signed tag for $(VERSION)"; \
+       fi ; \
+       git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ $$ref > $(TAR_FILE).tmp
+       echo $(VERSION) > version.tmp
+       tar --append -f $(TAR_FILE).tmp --transform s_^_$(PACKAGE)-$(VERSION)/_  --transform 's_.tmp$$__' version.tmp
+       rm version.tmp
+       gzip < $(TAR_FILE).tmp > $(TAR_FILE)
+       @echo "Source is ready for release in $(TAR_FILE)"
+
+$(SHA1_FILE): $(TAR_FILE)
+       sha1sum $^ > $@
+
+$(GPG_FILE): $(SHA1_FILE)
+       @echo "Please enter your GPG password to sign the checksum."
+       gpg --armor --sign $^ 
+
+.PHONY: dist
+dist: $(TAR_FILE)
+
+.PHONY: test
+test:
+       @echo "FIXME: Should consider adding a test suite here."
+
+# We invoke make recursively only to force ordering of our phony
+# targets in the case of parallel invocation of make (-j).
+#
+# We carefully ensure that our VERSION variable is passed down to any
+# sub-ordinate make invocations (which won't otherwise know that they
+# are part of the release and need to take the version from the
+# version file).
+.PHONY: release
+release: verify-source-tree-and-version
+       $(MAKE) VERSION=$(VERSION) verify-newer
+       $(MAKE) VERSION=$(VERSION) clean
+       $(MAKE) VERSION=$(VERSION) test
+       git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
+       $(MAKE) VERSION=$(VERSION) $(GPG_FILE)
+       ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
+       pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
+       git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
+       mkdir -p releases
+       mv $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) releases
+       $(MAKE) VERSION=$(VERSION) release-message > $(PACKAGE)-$(VERSION).announce
+ifeq ($(REALLY_UPLOAD),yes)
+       git push origin $(VERSION)
+       cd releases && scp $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) $(RELEASE_HOST):$(RELEASE_DIR)
+       ssh $(RELEASE_HOST) "rm -f $(RELEASE_DIR)/LATEST-$(PACKAGE)-* ; ln -s $(TAR_FILE) $(RELEASE_DIR)/LATEST-$(TAR_FILE)"
+endif
+       @echo "Please send a release announcement using $(PACKAGE)-$(VERSION).announce as a template."
+
+.PHONY: pre-release
+pre-release:
+       $(MAKE) VERSION=$(VERSION) clean
+       $(MAKE) VERSION=$(VERSION) test
+       git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
+       git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
+       $(MAKE) VERSION=$(VERSION) $(TAR_FILE)
+       ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
+       pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
+       mkdir -p releases
+       mv $(TAR_FILE) $(DEB_TAR_FILE) releases
+
+.PHONY: debian-snapshot
+debian-snapshot:
+       make VERSION=$(VERSION) clean
+       TMPFILE=$$(mktemp /tmp/fips.XXXXXX);            \
+         cp debian/changelog $${TMPFILE};              \
+         EDITOR=/bin/true dch -b -v $(VERSION)+1       \
+           -D UNRELEASED 'test build, not for upload'; \
+         echo '3.0 (native)' > debian/source/format;   \
+         debuild -us -uc;                              \
+         mv -f $${TMPFILE} debian/changelog;           \
+         echo '3.0 (quilt)' > debian/source/format
+
+.PHONY: release-message
+release-message:
+       @echo "To: XXX"
+       @echo "Subject: $(PACKAGE) release $(VERSION) now available"
+       @echo ""
+       @echo "Where to obtain fips $(VERSION)"
+       @echo "==========================="
+       @echo "  $(RELEASE_URL)/$(TAR_FILE)"
+       @echo ""
+       @echo "Which can be verified with:"
+       @echo ""
+       @echo "  $(RELEASE_URL)/$(SHA1_FILE)"
+       @echo -n "  "
+       @cat releases/$(SHA1_FILE)
+       @echo ""
+       @echo "  $(RELEASE_URL)/$(GPG_FILE)"
+       @echo "  (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
+       @echo ""
+       @echo "What's new in fips $(VERSION)"
+       @echo "========================="
+       @sed -ne '/^[Ff]ips $(VERSION)/{n;n;b NEWS}; d; :NEWS /^===/q; {p;n;b NEWS}' < NEWS | head -n -2
+       @echo ""
+       @echo "What is fips"
+       @echo "============"
+       @echo "Fips is a program for monitoring performance of OpenGL applications"
+
+# This is a chain of dependencies rather than a simple list simply to
+# avoid the messages getting interleaved in the case of a parallel
+# make invocation.
+.PHONY: verify-source-tree-and-version
+verify-source-tree-and-version: verify-no-dirty-code
+
+.PHONY: verify-no-dirty-code
+verify-no-dirty-code:
+ifeq ($(IS_GIT),yes)
+       @printf "Checking that source tree is clean..."
+ifneq ($(shell git ls-files -m),)
+       @echo "No"
+       @echo "The following files have been modified since the most recent git commit:"
+       @echo ""
+       @git ls-files -m
+       @echo ""
+       @echo "The release will be made from the committed state, but perhaps you meant"
+       @echo "to commit this code first? Please clean this up to make it more clear."
+       @false
+else
+       @echo "Good"
+endif
+endif
+
+.PHONY: verify-newer
+verify-newer:
+       @echo -n "Checking that no $(VERSION) release already exists..."
+       @wget -q -O /dev/null $(RELEASE_URL)/$(TAR_FILE) ; \
+       case $$? in \
+          8) echo "Good." ;; \
+          0) echo "Ouch."; \
+            echo "Found: $(RELEASE_URL)/$(TAR_FILE)"; \
+            echo "Refusing to replace an existing release."; \
+            echo "Don't forget to update \"version\" as described in RELEASING before release." ; \
+            false ;; \
+         *) echo "An unexpected error occured"; \
+            false;; esac
+
+# The user has not set any verbosity, default to quiet mode and inform the
+# user how to enable verbose compiles.
+ifeq ($(V),)
+quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
+quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
+endif
+# The user has explicitly enabled quiet compilation.
+ifeq ($(V),0)
+quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
+endif
+# Otherwise, print the full command line.
+quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
+
+%.o: %.c $(global_deps)
+       @mkdir -p .deps/$(@D)
+       $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
+
+.PHONY : clean
+clean:
+       rm -rf $(CLEAN); rm -rf .deps
+
+.PHONY: distclean
+distclean: clean
+       rm -rf $(DISTCLEAN)
+
+fips_srcs = \
+       fips.c
+
+fips_modules = $(fips_srcs:.c=.o)
+
+fips: $(fips_modules)
+       $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS)) $^ $(FINAL_FIPS_LDFLAGS) -o $@
+
+.PHONY: install
+install: all
+       mkdir -p $(DESTDIR)$(prefix)/bin/
+       install fips $(DESTDIR)$(prefix)/bin/fips
+ifeq ($(MAKECMDGOALS), install)
+       @echo ""
+       @echo "Fips is now installed to $(DESTDIR)$(prefix)"
+       @echo ""
+endif
+
+SRCS  := $(SRCS) $(fips_srcs)
+CLEAN := $(CLEAN) fips $(fips_modules)
+
+DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
+
+DEPS := $(SRCS:%.c=.deps/%.d)
+DEPS := $(DEPS:%.cc=.deps/%.d)
+-include $(DEPS)
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..f01633c
--- /dev/null
+++ b/configure
@@ -0,0 +1,417 @@
+#! /bin/sh
+
+PROJECT=fips
+PROJECT_BLURB="a program for monitoring performance of OpenGL applications"
+
+# Test whether this shell is capable of parameter substring processing.
+( option='a/b'; : ${option#*/} ) 2>/dev/null || {
+    echo "
+The shell interpreting '$0' is lacking some required features.
+
+To work around this problem you may try to execute:
+
+    ksh $0 $*
+ or
+    bash $0 $*
+"
+    exit 1
+}
+
+# Store original IFS value so it can be changed (and restored) in many places.
+readonly DEFAULT_IFS="$IFS"
+
+srcdir=$(dirname "$0")
+
+# For a non-srcdir configure invocation (such as ../configure), create
+# the directory structure and copy Makefiles.
+if [ "$srcdir" != "." ]; then
+
+    for dir in . $(grep "^subdirs *=" "$srcdir"/Makefile | sed -e "s/subdirs *= *//"); do
+       mkdir -p "$dir"
+       cp "$srcdir"/"$dir"/Makefile.local "$dir"
+       cp "$srcdir"/"$dir"/Makefile "$dir"
+    done
+fi
+
+# Set several defaults (optionally specified by the user in
+# environment variables)
+CC=${CC:-gcc}
+CFLAGS=${CFLAGS:--O2}
+LDFLAGS=${LDFLAGS:-}
+
+# Set the defaults for values the user can specify with command-line
+# options.
+PREFIX=/usr/local
+LIBDIR=
+
+usage ()
+{
+    cat <<EOF
+Usage: ./configure [options]...
+
+This script configures ${PROJECT} to build on your system.
+
+It verifies that dependencies are available, determines flags needed
+to compile and link against various required libraries, and identifies
+whether various system functions can be used or if locally-provided
+replacements will be built instead.
+
+Finally, it allows you to control various aspects of the build and
+installation process.
+
+First, some common variables can specified via environment variables:
+
+       CC              The C compiler to use
+       CFLAGS          Flags to pass to the C compiler
+       LDFLAGS         Flags to pass when linking
+
+Each of these values can further be controlled by specifying them
+later on the "make" command line.
+
+Additionally, various options can be specified on the configure
+command line.
+
+       --prefix=PREFIX Install files in PREFIX [$PREFIX]
+
+By default, "make install" will install the resulting program to
+$PREFIX/bin, documentation to $PREFIX/man, etc. You can
+specify an installation prefix other than $PREFIX using
+--prefix, for instance:
+
+       ./configure --prefix=\$HOME
+
+Fine tuning of some installation directories is available:
+
+       --libdir=DIR            Install libraries to DIR [PREFIX/lib]
+       --includedir=DIR        Install header files to DIR [PREFIX/include]
+       --mandir=DIR            Install man pages to DIR [PREFIX/share/man]
+       --sysconfdir=DIR        Read-only single-machine data [PREFIX/etc]
+
+Additional options are accepted for compatibility with other
+configure-script calling conventions, but don't do anything yet:
+
+       --build=<cpu>-<vendor>-<os>     Currently ignored
+       --host=<cpu>-<vendor>-<os>      Currently ignored
+       --infodir=DIR                   Currently ignored
+       --datadir=DIR                   Currently ignored
+       --localstatedir=DIR             Currently ignored
+       --libexecdir=DIR                Currently ignored
+       --disable-maintainer-mode       Currently ignored
+       --disable-dependency-tracking   Currently ignored
+
+EOF
+}
+
+# Parse command-line options
+for option; do
+    if [ "${option}" = '--help' ] ; then
+       usage
+       exit 0
+    elif [ "${option%%=*}" = '--prefix' ] ; then
+       PREFIX="${option#*=}"
+    elif [ "${option%%=*}" = '--libdir' ] ; then
+       LIBDIR="${option#*=}"
+    elif [ "${option%%=*}" = '--includedir' ] ; then
+       INCLUDEDIR="${option#*=}"
+    elif [ "${option%%=*}" = '--mandir' ] ; then
+       MANDIR="${option#*=}"
+    elif [ "${option%%=*}" = '--sysconfdir' ] ; then
+       SYSCONFDIR="${option#*=}"
+    elif [ "${option%%=*}" = '--build' ] ; then
+       true
+    elif [ "${option%%=*}" = '--host' ] ; then
+       true
+    elif [ "${option%%=*}" = '--infodir' ] ; then
+       true
+    elif [ "${option%%=*}" = '--datadir' ] ; then
+       true
+    elif [ "${option%%=*}" = '--localstatedir' ] ; then
+       true
+    elif [ "${option%%=*}" = '--libexecdir' ] ; then
+       true
+    elif [ "${option}" = '--disable-maintainer-mode' ] ; then
+       true
+    elif [ "${option}" = '--disable-dependency-tracking' ] ; then
+       true
+    else
+       echo "Unrecognized option: ${option}"
+       echo "See:"
+       echo "  $0 --help"
+       echo ""
+       exit 1
+    fi
+done
+
+# We set this value early, (rather than just while printing the
+# Makefile.config file later like most values), because we need to
+# actually investigate this value compared to the ldconfig_paths value
+# below.
+if [ -z "$LIBDIR" ] ; then
+    libdir_expanded="${PREFIX}/lib"
+else
+    # very non-general variable expansion
+    libdir_expanded=`echo "$LIBDIR" | sed "s|\\${prefix}|${PREFIX}|g; s|\\$prefix/|${PREFIX}/|; s|//*|/|g"`
+fi
+
+cat <<EOF
+Welcome to ${PROJECT}, ${PROJECT_BLURB}
+
+We hope that the process of building and installing ${PROJECT} is quick
+and smooth.
+
+If anything goes wrong in the configure process, you can override any
+decisions it makes by manually editing the Makefile.config file that
+it creates. Also please do as much as you can to figure out what could
+be different on your machine compared to those of the ${PROJECT}
+developers. Then, please email those details to the ${PROJECT} developers so
+that they can hopefully make future versions of ${PROJECT} easier for you to
+use.
+
+We'll now investigate your system to verify that all required
+dependencies are available:
+
+EOF
+
+errors=0
+
+if pkg-config --version > /dev/null 2>&1; then
+    have_pkg_config=1
+else
+    have_pkg_config=0
+fi
+
+printf "Checking for talloc development files... "
+if pkg-config --exists talloc; then
+    printf "Yes.\n"
+    have_talloc=1
+    talloc_cflags=$(pkg-config --cflags talloc)
+    talloc_ldflags=$(pkg-config --libs talloc)
+else
+    printf "No.\n"
+    have_talloc=0
+    talloc_cflags=
+    errors=$((errors + 1))
+fi
+
+libdir_in_ldconfig=0
+
+printf "Checking which platform we are on... "
+uname=`uname`
+if [ $uname = "Darwin" ] ; then
+    printf "Mac OS X.\n"
+    platform=MACOSX
+    linker_resolves_library_dependencies=0
+elif [ $uname = "SunOS" ] ; then
+    printf "Solaris.\n"
+    platform=SOLARIS
+    linker_resolves_library_dependencies=0
+elif [ $uname = "FreeBSD" ] ; then
+    printf "FreeBSD.\n"
+    platform=FREEBSD
+    linker_resolves_library_dependencies=0
+elif [ $uname = "OpenBSD" ] ; then
+    printf "OpenBSD.\n"
+    platform=OPENBSD
+    linker_resolves_library_dependencies=0
+elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
+    printf "$uname\n"
+    platform="$uname"
+    linker_resolves_library_dependencies=1
+
+    printf "Checking for $libdir_expanded in ldconfig... "
+    ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
+    # Separate ldconfig_paths only on newline (not on any potential
+    # embedded space characters in any filenames). Note, we use a
+    # literal newline in the source here rather than something like:
+    #
+    #  IFS=$(printf '\n')
+    #
+    # because the shell's command substitution deletes any trailing newlines.
+    IFS="
+"
+    for path in $ldconfig_paths; do
+       if [ "$path" = "$libdir_expanded" ]; then
+           libdir_in_ldconfig=1
+       fi
+    done
+    IFS=$DEFAULT_IFS
+    if [ "$libdir_in_ldconfig" = '0' ]; then
+       printf "No (will set RPATH)\n"
+    else
+       printf "Yes\n"
+    fi
+else
+    printf "Unknown.\n"
+    cat <<EOF
+
+*** Warning: Unknown platform. ${PROJECT} might or might not build correctly.
+
+EOF
+fi
+
+if [ $errors -gt 0 ]; then
+    cat <<EOF
+
+*** Error: The dependencies of ${PROJECT} could not be satisfied. You will
+need to install the following packages before being able to compile
+${PROJECT}:
+
+EOF
+    if [ $have_talloc -eq 0 ]; then
+       echo "  The talloc library (including development files such as headers)"
+       echo "  http://talloc.samba.org/"
+       echo
+    fi
+    cat <<EOF
+With any luck, you're using a modern, package-based operating system
+that has all of these packages available in the distribution. In that
+case a simple command will install everything you need. For example:
+
+On Debian and similar systems:
+
+       sudo apt-get install libtalloc-dev
+
+Or on Fedora and similar systems:
+
+       sudo yum install libtalloc-devel
+
+On other systems, similar commands can be used, but the details of the
+package names may be different.
+
+EOF
+    if [ $have_pkg_config -eq 0 ]; then
+cat <<EOF
+Note: the pkg-config program is not available. This configure script
+uses pkg-config to find the compilation flags required to link against
+the various libraries needed by ${PROJECT}. It's possible you simply need
+to install pkg-config with a command such as:
+
+       sudo apt-get install pkg-config
+Or:
+       sudo yum install pkgconfig
+
+But if pkg-config is not available for your system, then you will need
+to modify the configure script to manually set the cflags and ldflags
+variables to the correct values to link against each library in each
+case that pkg-config could not be used to determine those values.
+
+EOF
+    fi
+cat <<EOF
+When you have installed the necessary dependencies, you can run
+configure again to ensure the packages can be found, or simply run
+"make" to compile.
+
+EOF
+    exit 1
+fi
+
+printf "int main(void){return 0;}\n" > minimal.c
+
+WARN_CFLAGS=""
+printf "Checking for available C compiler warning flags... "
+for flag in -Wall -Wextra -Wmissing-declarations; do
+    if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
+    then
+       WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
+    fi
+done
+printf "\n\t${WARN_CFLAGS}\n"
+
+rm -f minimal minimal.c
+
+cat <<EOF
+
+All required packages were found. You may now run the following
+commands to compile and install ${PROJECT}:
+
+       make
+       sudo make install
+
+EOF
+
+# construct the Makefile.config
+cat > Makefile.config <<EOF
+# This Makefile.config was automatically generated by the ./configure
+# script of ${PROJECT}. If the configure script identified anything
+# incorrectly, then you can edit this file to try to correct things,
+# but be warned that if configure is run again it will destroy your
+# changes, (and this could happen by simply calling "make" if the
+# configure script is updated).
+
+# The top-level directory for the source, (the directory containing
+# the configure script). This may be different than the build
+# directory (the current directory at the time configure was run).
+srcdir = ${srcdir}
+
+configure_options = $@
+
+# We use vpath directives (rather than the VPATH variable) since the
+# VPATH variable matches targets as well as prerequisites, (which is
+# not useful since then a target left-over from a srcdir build would
+# cause a target to not be built in the non-srcdir build).
+#
+# Also, we don't use a single "vpath % \$(srcdir)" here because we
+# don't want the vpath to trigger for our emacs lisp compilation,
+# (unless we first find a way to convince emacs to build the .elc
+# target in a directory other than the directory of the .el
+# prerequisite). In the meantime, we're actually copying in the .el
+# files, (which is quite ugly).
+vpath %.c \$(srcdir)
+vpath %.cc \$(srcdir)
+vpath %.1 \$(srcdir)
+vpath Makefile.% \$(srcdir)
+
+# The C compiler to use
+CC = ${CC}
+
+# Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
+CFLAGS = ${CFLAGS}
+
+# Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
+LDFLAGS = ${LDFLAGS}
+
+# Flags to enable warnings when using the C compiler
+WARN_CFLAGS=${WARN_CFLAGS}
+
+# The prefix to which ${PROJECT} should be installed
+# Note: If you change this value here, be sure to ensure that the
+# LIBDIR_IN_LDCONFIG value below is still set correctly.
+prefix = ${PREFIX}
+
+# The directory to which libraries should be installed
+# Note: If you change this value here, be sure to ensure that the
+# LIBDIR_IN_LDCONFIG value below is still set correctly.
+libdir = ${LIBDIR:=\$(prefix)/lib}
+
+# Whether libdir is in a path configured into ldconfig
+LIBDIR_IN_LDCONFIG = ${libdir_in_ldconfig}
+
+# The directory to which header files should be installed
+includedir = ${INCLUDEDIR:=\$(prefix)/include}
+
+# The directory to which man pages should be installed
+mandir = ${MANDIR:=\$(prefix)/share/man}
+
+# The directory to which read-only (configuration) files should be installed
+sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
+
+# Supported platforms (so far) are: LINUX, MACOSX, SOLARIS, FREEBSD, OPENBSD
+PLATFORM = ${platform}
+
+# Whether the linker will automatically resolve the dependency of one
+# library on another (if not, then linking a binary requires linking
+# directly against both)
+LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
+
+# Flags needed to compile and link against talloc
+TALLOC_CFLAGS = ${talloc_cflags}
+TALLOC_LDFLAGS = ${talloc_ldflags}
+
+# Flags needed to have linker link only to necessary libraries
+AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
+
+# Combined flags for compiling and linking against all of the above
+CONFIGURE_CFLAGS = \$(TALLOC_CFLAGS)
+CONFIGURE_LDFLAGS = \$(TALLOC_LDFLAGS)
+EOF
diff --git a/fips.c b/fips.c
new file mode 100644 (file)
index 0000000..ce76e31
--- /dev/null
+++ b/fips.c
@@ -0,0 +1,77 @@
+/* Copyright © 2013, Intel Corporation
+ *
+ * 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
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <getopt.h>
+
+static void
+usage (void)
+{
+       printf("Usage: fips [OPTIONS...] <program> [program args...]\n"
+              "\n"
+              "Execute <program> and report GPU performance counters\n"
+              "\n"
+              "Options:\n"
+              "        -h, --help      show this help message\n"
+              "\n");
+}
+
+int
+main (int argc, char *argv[])
+{
+       int opt;
+       const char *short_options = "h";
+       const struct option long_options[] = {
+               {"help", no_argument, 0, 'h'},
+               {0, 0, 0, 0}
+       };
+
+       while (1)
+       {
+               opt = getopt_long(argc, argv, short_options, long_options, NULL);
+               if (opt == -1)
+                       break;
+
+               switch (opt) {
+               case 'h':
+                       usage ();
+                       return 0;
+               case '?':
+                       break;
+               default:
+                       fprintf(stderr, "Internal error: "
+                               "unexpected getopt value: %d\n", opt);
+                       exit (1);
+               }
+       }
+
+       if (optind >= argc) {
+               fprintf (stderr, "Error: No program name provided, "
+                        "see (fips --help)\n");
+               exit (1);
+       }
+
+        return 0;
+}
+
+
diff --git a/version b/version
new file mode 100644 (file)
index 0000000..49d5957
--- /dev/null
+++ b/version
@@ -0,0 +1 @@
+0.1