Add a utility to generate version 4 UUIDs.

#!/bin/sh
# \
exec tclsh8.7 "$0" ${1+"$@"}

# uuidgen --
#
#	This file implements version 4 uuid generator.
#
# Copyright (c) 2017 Taketsuru <taketsuru11@gmail.com>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

set randomDevice "/dev/random"

set fd [open $randomDevice rb]
set random [read $fd 16]
close $fd

binary scan $random "c*" randomArray

set output ""
for {set i 0} {$i < 16} {incr i} {
    set val [lindex $randomArray $i]
    switch -exact $i {
	6 {
	    set val [expr {($val & 0x0f) | 0x40}]
	}
	8 {
	    set val [expr {($val & 0x3f) | 0x80}]
	}
	default {
	    set val [expr {$val & 0xff}]
	}
    }

    switch -exact $i {
	4 -
	6 -
	8 -
	10 {
	    append output "-"
	}
    }

    append output [format {%02x} $val]
}

puts $output


#!/usr/bin/tclsh

# This is a simple script to extract all[0] linked URLs from an HTML file.
# Usage: ./extract-links.tcl < page.html
#
#  [0] Yes, all. A regular expression can't be wrong, can it?

while {[gets stdin line] >= 0} {
  if {[regexp -- {<a +([^>]* +)?href="([^"]*)"} $line match discard link]} {
    puts $link
  }
}


Test of vtkGeometryFilter use of ghost cells.

# This scripts tests a couple of things.
# Images generating ghost level arrays,
# and geometry correctly processing ghost cells.
# It asks for a piece from a geometry filter with an image data input.

catch {load vtktcl}
if { [catch {set VTK_TCL $env(VTK_TCL)}] != 0} { set VTK_TCL "../../examplesTcl" }
if { [catch {set VTK_DATA $env(VTK_DATA)}] != 0} { set VTK_DATA "../../../vtkdata" }

# get the interactor ui
source $VTK_TCL/vtkInt.tcl
source $VTK_TCL/colors.tcl

# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

# create pipeline
#
set RESOLUTION 64
set START_SLICE 1
set END_SLICE 63
set PIXEL_SIZE 3.2

vtkVolume16Reader reader
    eval reader SetDataDimensions $RESOLUTION $RESOLUTION
    reader SetFilePrefix $VTK_DATA/headsq/quarter
    reader SetDataSpacing $PIXEL_SIZE $PIXEL_SIZE 1.5
    reader SetImageRange $START_SLICE $END_SLICE
    reader SetHeaderSize 0
    reader SetDataMask 0x7fff;
    reader SetDataByteOrderToLittleEndian

#vtkImageReader reader
#reader SetDataByteOrderToLittleEndian
#reader SetDataExtent 0 63 0 63 1 64
#reader SetFilePrefix "$VTK_DATA/headsq/quarter"
#reader SetDataMask 0x7fff
#reader SetDataSpacing 1.6 1.6 1.5
#reader SetStartMethod {puts [[reader GetOutput] GetUpdateExtent]}

vtkGeometryFilter geom
geom SetInput [reader GetOutput]

vtkPolyDataMapper mapper
mapper SetInput [geom GetOutput]
mapper ScalarVisibilityOn
mapper SetScalarRange 0 1200
mapper SetPiece 0
mapper SetNumberOfPieces 8

vtkActor actor
actor SetMapper mapper

# Add the actors to the renderer, set the background and size
#
ren1 AddActor actor
ren1 SetBackground 0.2 0.3 0.4
renWin SetSize 450 450
[ren1 GetActiveCamera] Elevation 90
[ren1 GetActiveCamera] SetViewUp 0 0 -1

set cam [ren1 GetActiveCamera]
$cam SetPosition 191.247 -64.5654 285.805
$cam SetViewUp -0.0907763 0.894432 0.437894
$cam SetFocalPoint 49.6 49.6 23.25

ren1 ResetCameraClippingRange
renWin Render

# render the image
#
iren SetUserMethod {wm deiconify .vtkInteract}
iren Initialize

# prevent the tk window from showing up then start the event loop
wm withdraw .


## ----------------------------------------------------------------------------
#
# Upstart script for proximity.
#
## ----------------------------------------------------------------------------

# info
description "proximity - simple configurable http proxy based on bouncy."
author      "Andrew Chilton"

# respawn this task
start on runlevel [2345]
respawn
respawn limit 20 5
stop on shutdown

# allow opening of more than 1024 files
limit nofile 4096 4096

# set some environment variables
env NODE_ENV=production

# the script itself
script

    # quit the script if something goes wrong
    set -e

    # run the proximity server as this user
    exec \
        start-stop-daemon \
            --start \
            --make-pidfile \
            --pidfile /var/run/proximity.pid \
            --chuid __USER__ \
            --exec authbind __NODE__ __PWD__/proximity.js

end script

## ----------------------------------------------------------------------------

Fix start-stop-daemon args to the main program

## ----------------------------------------------------------------------------
#
# Upstart script for proximity.
#
## ----------------------------------------------------------------------------

# info
description "proximity - simple configurable http proxy based on bouncy."
author      "Andrew Chilton"

# respawn this task
start on runlevel [2345]
respawn
respawn limit 20 5
stop on shutdown

# allow opening of more than 1024 files
limit nofile 4096 4096

# set some environment variables
env NODE_ENV=production

# the script itself
script

    # quit the script if something goes wrong
    set -e

    # run the proximity server as this user
    exec \
        start-stop-daemon \
            --start \
            --make-pidfile \
            --pidfile /var/run/proximity.pid \
            --chuid __USER__ \
            --exec authbind -- __NODE__ __PWD__/proximity.js

end script

## ----------------------------------------------------------------------------


AC_DEFUN([MACRO_STATIC_ASSERT],
  [AC_CACHE_CHECK([for static_assert],
    [neo4j_cv_macro_static_assert],
    [AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM([[
#include <assert.h>
static_assert(1, "impossible");
      ]],[[return 0;]])],
      [neo4j_cv_macro_static_assert=yes],
      [neo4j_cv_macro_static_assert=no])])

  if test "X$neo4j_cv_macro_static_assert" = "Xno"; then
    AC_DEFINE([static_assert(c,m)],[struct _no_static_assert{}], [Substitute for static_assert])
  fi
])

Improve handling of missing static_assert

AC_DEFUN([MACRO_STATIC_ASSERT],
  [AC_CACHE_CHECK([for static_assert],
    [neo4j_cv_macro_static_assert],
    [AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM([[
#include <assert.h>
static_assert(1, "impossible");
      ]],[[return 0;]])],
      [neo4j_cv_macro_static_assert=yes],
      [neo4j_cv_macro_static_assert=no])])

  if test "X$neo4j_cv_macro_static_assert" = "Xno"; then
    AC_DEFINE([static_assert(c,m)],[typedef void _no_static_assert], [Substitute for static_assert])
  fi
])


$pdf_mode = 1;
$pdflatex = "pdflatex -interaction=nonstopmode %O %S";
$biber = "biber --validate-datamodel --dieondatamodel %O %S";
# Force deletion of .bbl even if no .bib exists
$bibtex_use = 2;
# Created by biber; not cleaned by default (don't know why)
$clean_ext .= ' %R.run.xml';

# Avoid wrapping log output lines
# See https://tex.stackexchange.com/a/384153 by John Collins
$ENV{max_print_line} = $log_wrap = 1000;

# Support glossaries
# See https://tex.stackexchange.com/a/44316 by user mhp
add_cus_dep('glo', 'gls', 0, 'run_makeglossaries');
add_cus_dep('acn', 'acr', 0, 'run_makeglossaries');

sub run_makeglossaries {
  if ( $silent ) {
    system "makeglossaries -q '$_[0]'";
  }
  else {
    system "makeglossaries '$_[0]'";
  };
}

push @generated_exts, 'glo', 'gls', 'glg';
push @generated_exts, 'acn', 'acr', 'alg';
$clean_ext .= ' %R.ist %R.xdy';

Fix makeglossaries when out_dir is set

$pdf_mode = 1;
$pdflatex = "pdflatex -interaction=nonstopmode %O %S";
$biber = "biber --validate-datamodel --dieondatamodel %O %S";
# Force deletion of .bbl even if no .bib exists
$bibtex_use = 2;
# Created by biber; not cleaned by default (don't know why)
$clean_ext .= ' %R.run.xml';

# Avoid wrapping log output lines
# See https://tex.stackexchange.com/a/384153 by John Collins
$ENV{max_print_line} = $log_wrap = 1000;

# Support glossaries
# See https://tex.stackexchange.com/a/44316 by user mhp
add_cus_dep('glo', 'gls', 0, 'run_makeglossaries');
add_cus_dep('acn', 'acr', 0, 'run_makeglossaries');
sub run_makeglossaries {
  my @gls_args = ();
  if ( $silent ) {
    push @gls_args, "-q";
  }
  # makeglossaries fails when running outside the target directory
  # move to the target directory before running
  my ($basename, $path) = fileparse( $_[0] );
  pushd $path;
  my $gls_command = join " ", "makeglossaries", @gls_args, "'$basename'";
  my $return = system "$gls_command";
  popd;
  return $return;
}

push @generated_exts, 'glo', 'gls', 'glg';
push @generated_exts, 'acn', 'acr', 'alg';
$clean_ext .= ' %R.ist %R.xdy';


dnl--------------------------------------------------------------------
dnl * Check whether this machine has gmp/gmp3 installed
dnl--------------------------------------------------------------------

AC_DEFUN([LOOK_FOR_GMP_LIB],[
    if test "$HaveFrameworkGMP" = "NO"
    then
        AC_CHECK_LIB([gmp],  [__gmpz_fdiv_qr],
                     [HaveLibGmp=YES; GMP_LIBS=gmp])
        if test "$HaveLibGmp" = "NO"
        then
            AC_CHECK_LIB([gmp3], [__gmpz_fdiv_qr],
                         [HaveLibGmp=YES; GMP_LIBS=gmp3])
        fi
    fi
])

dnl--------------------------------------------------------------------
dnl * Mac OS X only: check for GMP.framework
dnl--------------------------------------------------------------------

AC_DEFUN([LOOK_FOR_GMP_FRAMEWORK],[
    if test "$HaveLibGmp" = "NO"
    then
        case $target_os in
        darwin*)
            AC_MSG_CHECKING([for GMP.framework])
            save_libs="$LIBS"
            LIBS="-framework GMP"
            AC_TRY_LINK_FUNC(__gmpz_fdiv_qr,
                             [HaveFrameworkGMP=YES; GMP_FRAMEWORK=GMP])
            LIBS="$save_libs"
            AC_MSG_RESULT([$HaveFrameworkGMP])
            ;;
        esac
    fi
])

Update Autoconf tests for recent GMP version

dnl--------------------------------------------------------------------
dnl * Check whether this machine has gmp/gmp3 installed
dnl--------------------------------------------------------------------

AC_DEFUN([LOOK_FOR_GMP_LIB],[
    if test "$HaveFrameworkGMP" = "NO"
    then
        AC_CHECK_LIB([gmp],  [__gmpz_powm_sec],
                     [HaveLibGmp=YES; GMP_LIBS=gmp])
        if test "$HaveLibGmp" = "NO"
        then
            AC_CHECK_LIB([gmp3], [__gmpz_powm_sec],
                         [HaveLibGmp=YES; GMP_LIBS=gmp3])
        fi
    fi
])

dnl--------------------------------------------------------------------
dnl * Mac OS X only: check for GMP.framework
dnl--------------------------------------------------------------------

AC_DEFUN([LOOK_FOR_GMP_FRAMEWORK],[
    if test "$HaveLibGmp" = "NO"
    then
        case $target_os in
        darwin*)
            AC_MSG_CHECKING([for GMP.framework])
            save_libs="$LIBS"
            LIBS="-framework GMP"
            AC_TRY_LINK_FUNC(__gmpz_powm_sec,
                             [HaveFrameworkGMP=YES; GMP_FRAMEWORK=GMP])
            LIBS="$save_libs"
            AC_MSG_RESULT([$HaveFrameworkGMP])
            ;;
        esac
    fi
])


# -------------------------------------------------------------
# MetaPhysicL - a C++ header-only numerics utility library
# -------------------------------------------------------------
AC_DEFUN([CONFIGURE_METAPHYSICL],
[
  AC_ARG_ENABLE(metaphysicl,
                AS_HELP_STRING([--disable-metaphysicl],
                               [build without MetaPhysicL suppport]),
                [case "${enableval}" in
                  yes)  enablemetaphysicl=yes ;;
                  no)  enablemetaphysicl=no ;;
                  *)  AC_MSG_ERROR(bad value ${enableval} for --enable-metaphysicl) ;;
                esac],
                [enablemetaphysicl=$enableoptional])

  # The MetaPhysicL API is distributed with libmesh, so we don't have
  # to guess where it might be installed.  This needs to be replaced
  # someday with an option to include an external version instead.
  if (test $enablemetaphysicl = yes); then
     METAPHYSICL_INCLUDE="-I\$(top_srcdir)/contrib/metaphysicl/include"
     AC_DEFINE(HAVE_METAPHYSICL, 1, [Flag indicating whether the library will be compiled with MetaPhysicL support])
     AC_MSG_RESULT(<<< Configuring library with MetaPhysicL support >>>)
  else
     METAPHYSICL_INCLUDE=""
     enablemetaphysicl=no
  fi

  AC_SUBST(METAPHYSICL_INCLUDE)
])

Configure MetaPhysicL as a nested autoconf project

# -------------------------------------------------------------
# MetaPhysicL - a C++ header-only numerics utility library
# -------------------------------------------------------------
AC_DEFUN([CONFIGURE_METAPHYSICL],
[
  AC_ARG_ENABLE(metaphysicl,
                AS_HELP_STRING([--disable-metaphysicl],
                               [build without MetaPhysicL suppport]),
                [case "${enableval}" in
                  yes)  enablemetaphysicl=yes ;;
                  no)  enablemetaphysicl=no ;;
                  *)  AC_MSG_ERROR(bad value ${enableval} for --enable-metaphysicl) ;;
                esac],
                [enablemetaphysicl=$enablenested])

  # The MetaPhysicL API is distributed with libmesh, so we don't have
  # to guess where it might be installed.  This needs to be replaced
  # someday with an option to include an external version instead.
  if (test $enablemetaphysicl = yes); then
     METAPHYSICL_INCLUDE="-I\$(top_srcdir)/contrib/metaphysicl/0.2.0/include"
     AC_DEFINE(HAVE_METAPHYSICL, 1, [Flag indicating whether the library will be compiled with MetaPhysicL support])
     AC_MSG_RESULT(<<< Configuring library with MetaPhysicL support >>>)
     AC_CONFIG_SUBDIRS([contrib/metaphysicl/0.2.0])
  else
     METAPHYSICL_INCLUDE=""
     enablemetaphysicl=no
  fi

  AC_SUBST(METAPHYSICL_INCLUDE)
])


# ltversion.m4 -- version numbers			-*- Autoconf -*-
#
#   Copyright (C) 2004 Free Software Foundation, Inc.
#   Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.

# @configure_input@

# serial 3337 ltversion.m4
# This file is part of GNU Libtool

m4_define([LT_PACKAGE_VERSION], [2.4.2])
m4_define([LT_PACKAGE_REVISION], [1.3337])

AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.2'
macro_revision='1.3337'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])

Stop putting generated files in git

# ltversion.m4 -- version numbers			-*- Autoconf -*-
#
#   Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
#   Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.

# @configure_input@

# serial 4179 ltversion.m4
# This file is part of GNU Libtool

m4_define([LT_PACKAGE_VERSION], [2.4.6])
m4_define([LT_PACKAGE_REVISION], [2.4.6])

AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.6'
macro_revision='2.4.6'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])


AC_DEFUN([AC_C___ATTRIBUTE__],
[
  AC_MSG_CHECKING(for __attribute__)
  AC_CACHE_VAL(ac_cv___attribute__, [
  AC_TRY_COMPILE([#include <stdlib.h>],
  [int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }],
  ac_cv___attribute__=yes, ac_cv___attribute__=no)])
  if test "$ac_cv___attribute__" = "yes"; then
    AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__])
  fi
  AC_MSG_RESULT($ac_cv___attribute__)
])

Update m4 macro to provide __UNUSED__.

dnl Copyright (C) 2004-2008 Kim Woelders
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
dnl That code is public domain and can be freely used or copied.
dnl Originally snatched from somewhere...

dnl Macro for checking if the compiler supports __atribute__

dnl Usage: AC_C___ATTRIBUTE__
dnl call AC_DEFINE for HAVE___ATTRIBUTE__ and __UNUSED__
dnl if the compiler supports __attribute__, HAVE___ATTRIBUTE__ is
dnl defined to 1 and __UNUSED__ is defined to __attribute__((unused))
dnl otherwise, HAVE___ATTRIBUTE__ is not defined and __UNUSED__ is
dnl defined to nothing.

AC_DEFUN([AC_C___ATTRIBUTE__],
[

AC_MSG_CHECKING([for __attribute__])

AC_CACHE_VAL([ac_cv___attribute__],
   [AC_TRY_COMPILE(
       [
#include <stdlib.h>
       ],
       [
int func(int x);
int foo(int x __attribute__ ((unused)))
{
   exit(1);
}
       ],
       [ac_cv___attribute__="yes"],
       [ac_cv___attribute__="no"]
    )]
)

AC_MSG_RESULT($ac_cv___attribute__)

if test "x${ac_cv___attribute__}" = "xyes" ; then
   AC_DEFINE([HAVE___ATTRIBUTE__], [1], [Define to 1 if your compiler has __attribute__])
   AC_DEFINE([__UNUSED__], [__attribute__((unused))], [Macro declaring a function argument to be unused])
  else
    AC_DEFINE([__UNUSED__], [], [Macro declaring a function argument to be unused])
fi

])


#
# Configuration for pScheduler REST API service
#

WSGIDaemonProcess __USER_NAME__ user=__USER_NAME__ group=__GROUP_NAME__ processes=1 threads=50 maximum-requests=5000
WSGIScriptAlias __API_ROOT__ __API_DIR__/__NAME__.wsgi

# Keep's python interpreter from being initialized in the apache
# server worker processes
WSGIRestrictEmbedded On

<Directory __API_DIR__>

    WSGIProcessGroup __USER_NAME__
    WSGIApplicationGroup __USER_NAME__

    Order deny,allow
    Allow from all

</Directory>

# Not something we need.
KeepAlive Off

Use WSGI's defaults and restart every so often to avoid leaks.

#
# Configuration for pScheduler REST API service
#

WSGIDaemonProcess __USER_NAME__ user=__USER_NAME__ group=__GROUP_NAME__ maximum-requests=5000
WSGIScriptAlias __API_ROOT__ __API_DIR__/__NAME__.wsgi

# Keep's python interpreter from being initialized in the apache
# server worker processes
WSGIRestrictEmbedded On

<Directory __API_DIR__>

    WSGIProcessGroup __USER_NAME__
    WSGIApplicationGroup __USER_NAME__

    Order deny,allow
    Allow from all

</Directory>

# Not something we need.
KeepAlive Off


dnl Detection and configuration of the visibility feature of gcc
dnl Vincent Torri 2006-02-11
dnl
dnl GCC_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Check the visibility feature of gcc
dnl
AC_DEFUN([GCC_CHECK_VISIBILITY],
   [AC_MSG_CHECKING([whether ${CC} supports visibility feature])
    save_CFLAGS=${CFLAGS}
    CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
    AC_COMPILE_IFELSE(
       [AC_LANG_PROGRAM(
          [[
#pragma GCC visibility push(hidden)
extern void f(int);
#pragma GCC visibility pop
          ]],
          [[]]
        )],
       [AC_DEFINE(
           GCC_HAS_VISIBILITY,
           [],
           [Defined if GCC supports the vilibility feature])
        m4_if([$1], [], [:], [$1])
        AC_MSG_RESULT(yes)],
       [m4_if([$2], [], [:], [$2])
        AC_MSG_RESULT(no)])
    CFLAGS=${save_CFLAGS}
   ])

Fix typo and rephrase checking message.

dnl Detection and configuration of the visibility feature of gcc
dnl Vincent Torri 2006-02-11
dnl
dnl GCC_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Check the visibility feature of gcc
dnl
AC_DEFUN([GCC_CHECK_VISIBILITY],
   [AC_MSG_CHECKING([whether ${CC} supports symbol visibility])
    save_CFLAGS=${CFLAGS}
    CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
    AC_COMPILE_IFELSE(
       [AC_LANG_PROGRAM(
          [[
#pragma GCC visibility push(hidden)
extern void f(int);
#pragma GCC visibility pop
          ]],
          [[]]
        )],
       [AC_DEFINE(
           GCC_HAS_VISIBILITY,
           [],
           [Defined if GCC supports the visibility feature])
        m4_if([$1], [], [:], [$1])
        AC_MSG_RESULT(yes)],
       [m4_if([$2], [], [:], [$2])
        AC_MSG_RESULT(no)])
    CFLAGS=${save_CFLAGS}
   ])


dnl
dnl Check for support for position independent executables
dnl
dnl Copyright (C) 2013 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library.  If not, see
dnl <http://www.gnu.org/licenses/>.
dnl

AC_DEFUN([LIBVIRT_COMPILE_PIE],[
    PIE_CFLAGS=
    PIE_LDFLAGS=
    case "$host" in
      *-*-mingw* | *-*-msvc* | *-*-cygwin* )
         ;; dnl All code is position independent on Win32 target
      *)
      gl_COMPILER_OPTION_IF([-fPIE -DPIE -pie], [
        PIE_CFLAGS="-fPIE -DPIE -pie"
        PIE_LDFLAGS="-pie"
      ])
    esac
    AC_SUBST([PIE_CFLAGS])
    AC_SUBST([PIE_LDFLAGS])
])

Fix '-pie' build with clang

dnl
dnl Check for support for position independent executables
dnl
dnl Copyright (C) 2013 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library.  If not, see
dnl <http://www.gnu.org/licenses/>.
dnl

AC_DEFUN([LIBVIRT_COMPILE_PIE],[
    PIE_CFLAGS=
    PIE_LDFLAGS=
    case "$host" in
      *-*-mingw* | *-*-msvc* | *-*-cygwin* )
         ;; dnl All code is position independent on Win32 target
      *)
      gl_COMPILER_OPTION_IF([-fPIE -DPIE -pie], [
        PIE_CFLAGS="-fPIE -DPIE"
        PIE_LDFLAGS="-pie"
      ])
    esac
    AC_SUBST([PIE_CFLAGS])
    AC_SUBST([PIE_LDFLAGS])
])


libglkif_nonpkg_cflags=""

AC_CHECK_HEADER([glk.h],
  [],
  [for dir in $with_glk_includedir $with_glktermw_includedir /usr/include /usr/local/include ; do
     AC_MSG_CHECKING(for $dir/glk.h)
     if [ test -e $dir/glk.h ]; then
       AC_MSG_RESULT(yes)
       glk_h_dir=$dir
       break
     else
       AC_MSG_RESULT(no)
     fi
   done
   if [ test "x$glk_h_dir" == "x"] ; then
     echo "Could not find glk.h."
     echo "Try setting the location using --with-glk-includedir."
     AS_EXIT
   fi
   libglkif_nonpkg_cflags+="-I$glk_h_dir"])

Add remglk-includedir to glk.h search candidates.

libglkif_nonpkg_cflags=""

AC_CHECK_HEADER([glk.h],
  [],
  [for dir in $with_glk_includedir $with_glktermw_includedir $with_remglk_includedir /usr/include /usr/local/include ; do
     AC_MSG_CHECKING(for $dir/glk.h)
     if [ test -e $dir/glk.h ]; then
       AC_MSG_RESULT(yes)
       glk_h_dir=$dir
       break
     else
       AC_MSG_RESULT(no)
     fi
   done
   if [ test "x$glk_h_dir" == "x"] ; then
     echo "Could not find glk.h."
     echo "Try setting the location using --with-glk-includedir."
     AS_EXIT
   fi
   libglkif_nonpkg_cflags+="-I$glk_h_dir"])


# Dockerfile for Stackage LTS on Centos6, with some custom dependencies.
FROM       lancelet/centos6-lts-a:M4_DOCKER_IMAGE_VERSION
MAINTAINER Jonathan Merritt <j.s.merritt@gmail.com>

## Haskell environment
ENV PATH $HOME/local/.bin:$PATH
ENV STACK_PROJECTDIR M4_STACK_PROJECTDIR
ENV STACK_WORKDIR M4_STACK_WORKDIR
ENV STACK_YAML M4_STACK_YAML
ENV STACK_SETUP M4_STACK_SETUP
ENV STACK_INSTALL M4_STACK_INSTALL

## Copy across stack.yaml
RUN mkdir -p $STACK_PROJECTDIR
RUN mkdir -p $STACK_WORKDIR
ADD stack.yaml $STACK_YAML

## Some common libraries
WORKDIR $STACK_PROJECTDIR
RUN $STACK_INSTALL \
    SHA \
    aeson \
    async \
    attoparsec \
    bytestring \
    base64-bytestring \
    blaze-html \
    byteable \
    cereal \
    cmdargs \
    cryptonite \
    digest \
    dlist \
    exceptions \
    extra \
    haddock-library \
    happy \
    haskell-src-exts \
    hslua \
    http-types \
    lens \
    mmorph \
    mtl \
    network \
    parsec \
    primitive \
    random \
    regex-base \
    regex-pcre-builtin \
    semigroups \
    socks \
    stm \
    strict \
    transformers-compat

Add even more stuff to the B Ark

# Dockerfile for Stackage LTS on Centos6, with some custom dependencies.
FROM       lancelet/centos6-lts-a:M4_DOCKER_IMAGE_VERSION
MAINTAINER Jonathan Merritt <j.s.merritt@gmail.com>

## Haskell environment
ENV PATH $HOME/local/.bin:$PATH
ENV STACK_PROJECTDIR M4_STACK_PROJECTDIR
ENV STACK_WORKDIR M4_STACK_WORKDIR
ENV STACK_YAML M4_STACK_YAML
ENV STACK_SETUP M4_STACK_SETUP
ENV STACK_INSTALL M4_STACK_INSTALL

## Copy across stack.yaml
RUN mkdir -p $STACK_PROJECTDIR
RUN mkdir -p $STACK_WORKDIR
ADD stack.yaml $STACK_YAML

## Some common libraries
WORKDIR $STACK_PROJECTDIR
RUN $STACK_INSTALL \
    SHA \
    aeson \
    async \
    attoparsec \
    bytestring \
    base64-bytestring \
    blaze-html \
    byteable \
    cereal \
    cmdargs \
    conduit \
    cryptonite \
    digest \
    dlist \
    exceptions \
    extra \
    haddock-library \
    happy \
    haskell-src-exts \
    hslua \
    http-types \
    lens \
    mmorph \
    mtl \
    network \
    parsec \
    pipes \
    primitive \
    random \
    regex-base \
    regex-pcre-builtin \
    semigroups \
    socks \
    stm \
    strict \
    transformers-compat


AC_DEFUN([AX_BOOST_SUFFIX],
[
AC_ARG_WITH([boost-suffix],
            [AC_HELP_STRING([--with-boost-suffix=suffix suffix name for boost libraries])],
            [
				boostsuffix="$withval"
				findsuffix="no"
			],[
				findsuffix="yes"
			])
if test "x$findsuffix" = "xyes"; then
	if test "x$BOOST_LDFLAGS" = "x"; then
		AC_MSG_ERROR(BOOST_LDFLAGS not defined.)
	else
		boostlibpath=`echo $BOOST_LDFLAGS | sed 's/^-L//'`
		changequote(<<, >>)dnl
		candidates=`echo $boostlibpath/libboost_date_time* | sed 's|.*libboost_date_time||g' | sed 's/\.[^ ]*//g'`
		changequote([, ])dnl
		if `echo $candidates | grep -q ' '`; then
			AC_MSG_ERROR(Multiple candidates found for suffix.  Use --with-boostsuffix to choose one: --$candidates--)
		else
			BOOST_SUFFIX=$candidates
			AC_SUBST(BOOST_SUFFIX)
		fi
	fi
	AC_MSG_NOTICE(Using boost suffix: $BOOST_SUFFIX)
fi
])

Fix bug in boost suffix code.

AC_DEFUN([AX_BOOST_SUFFIX],
[
AC_ARG_WITH([boost-suffix],
            [AC_HELP_STRING([--with-boost-suffix=suffix suffix name for boost libraries])],
            [
				BOOST_SUFFIX="$withval"
				findsuffix="no"
			],[
				findsuffix="yes"
			])
if test "x$findsuffix" = "xyes"; then
	if test "x$BOOST_LDFLAGS" = "x"; then
		AC_MSG_ERROR(BOOST_LDFLAGS not defined.)
	else
		boostlibpath=`echo $BOOST_LDFLAGS | sed 's/^-L//'`
		changequote(<<, >>)dnl
		candidates=`echo $boostlibpath/libboost_date_time* | sed 's|.*libboost_date_time||g' | sed 's/\.[^ ]*//g'`
		changequote([, ])dnl
		if `echo $candidates | grep -q ' '`; then
			AC_MSG_ERROR(Multiple candidates found for suffix.  Use --with-boostsuffix to choose one: $candidates)
		else
			BOOST_SUFFIX=$candidates
		fi
	fi
fi
AC_SUBST(BOOST_SUFFIX)
AC_MSG_NOTICE(Using boost suffix: $BOOST_SUFFIX)
])


PHP_ARG_ENABLE(pux,
    [Whether to enable the "pux" extension],
    [  --enable-pux      Enable "pux" extension support])

if test $PHP_PUX != "no"; then
    PHP_REQUIRE_CXX()
    PHP_SUBST(PUX_SHARED_LIBADD)
    PHP_ADD_LIBRARY(stdc++, 1, PUX_SHARED_LIBADD)
    PHP_ADD_INCLUDE(/opt/local/include)
    PHP_NEW_EXTENSION(pux, php_pux.c php_mux.c php_expandable_mux.c php_controller.c ct_helper.c php_functions.c, $ext_shared)
fi

Add --pux-debug option to enable debug mode.

PHP_ARG_ENABLE(pux,
    [Whether to enable the "pux" extension],
    [  --enable-pux      Enable "pux" extension support])

AC_MSG_CHECKING(if PUX should be built in debug mode)
AC_ARG_ENABLE(pux-debug,
[  --enable-pux-debug     Enable PUX debugging],
[
  PHP_PUX_DEBUG=$enableval
],
[
  PHP_PUX_DEBUG=no
])
AC_MSG_RESULT($PHP_PUX_DEBUG)

if test $PHP_PUX != "no"; then
    PHP_REQUIRE_CXX()

    if test "$PHP_PUX_DEBUG" != "no"; then
        AC_DEFINE(PUX_DEBUG, 1, [ ])
        CFLAGS="$CFLAGS -O0 -ggdb -fprofile-arcs"
    fi

    PHP_SUBST(PUX_SHARED_LIBADD)
    PHP_ADD_LIBRARY(stdc++, 1, PUX_SHARED_LIBADD)
    PHP_ADD_INCLUDE(/opt/local/include)
    PHP_NEW_EXTENSION(pux, php_pux.c php_mux.c php_expandable_mux.c php_controller.c ct_helper.c php_functions.c, $ext_shared)

fi


dnl Copyright (C) 2013 Cedric Bail <cedric dot bail at samsung dot com>
dnl That code is public domain and can be freely used or copied

dnl Macro that check if -pie -rdynamic can be given to ld

dnl Usage: ELM_QUICKLAUNCH
dnl add -pie -rdynamic to LDFLAGS and -fpie to CFLAGS

AC_DEFUN([ELM_QUICKLAUNCH],
[
AC_MSG_CHECKING([If the compiler as what it takes to do quicklaunch (-pie -rdynamic)])
old_LDFLAGS="$LDFLAGS"
old_CFLAGS="$CFLAGS"

LDFLAGS="$LDFLAGS -pie -rdynamic"
CFLAGS="$CFLAGS -fpie"

AC_LINK_IFELSE([int main(){}],
        [AC_MSG_RESULT([yes])],
        [LDFLAGS="$old_LDFLAGS"
	CFLAGS="$old_CFLAGS"
        AC_MSG_RESULT([no])
        ])
])

Add AC_LANG_SOURCE to source code

dnl Copyright (C) 2013 Cedric Bail <cedric dot bail at samsung dot com>
dnl That code is public domain and can be freely used or copied

dnl Macro that check if -pie -rdynamic can be given to ld

dnl Usage: ELM_QUICKLAUNCH
dnl add -pie -rdynamic to LDFLAGS and -fpie to CFLAGS

AC_DEFUN([ELM_QUICKLAUNCH],
[
AC_MSG_CHECKING([If the compiler as what it takes to do quicklaunch (-pie -rdynamic)])
old_LDFLAGS="$LDFLAGS"
old_CFLAGS="$CFLAGS"

LDFLAGS="$LDFLAGS -pie -rdynamic"
CFLAGS="$CFLAGS -fpie"

AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(){}]])],
        [AC_MSG_RESULT([yes])],
        [LDFLAGS="$old_LDFLAGS"
	CFLAGS="$old_CFLAGS"
        AC_MSG_RESULT([no])
        ])
])


## ----------------------------------------------------------------------------
#
# Upstart script for proximity.
#
## ----------------------------------------------------------------------------

# info
description "proximity - simple configurable http proxy based on bouncy."
author      "Andrew Chilton"

# respawn this task
start on runlevel [2345]
respawn
respawn limit 20 5
stop on shutdown

# allow opening of more than 1024 files
limit nofile 4096 4096

# set some environment variables
env NODE_ENV=production

# the script itself
script

    # quit the script if something goes wrong
    set -e

    # run the proximity server as this user
    exec \
        start-stop-daemon \
            --start \
            --make-pidfile \
            --pidfile /var/run/proximity.pid \
            --chuid __USER__ \
            --exec authbind -- __NODE__ __PWD__/proximity.js

end script

## ----------------------------------------------------------------------------

Use full path to authbind

## ----------------------------------------------------------------------------
#
# Upstart script for proximity.
#
## ----------------------------------------------------------------------------

# info
description "proximity - simple configurable http proxy based on bouncy."
author      "Andrew Chilton"

# respawn this task
start on runlevel [2345]
respawn
respawn limit 20 5
stop on shutdown

# allow opening of more than 1024 files
limit nofile 4096 4096

# set some environment variables
env NODE_ENV=production

# the script itself
script

    # quit the script if something goes wrong
    set -e

    # run the proximity server as this user
    exec \
        start-stop-daemon \
            --start \
            --make-pidfile \
            --pidfile /var/run/proximity.pid \
            --chuid __USER__ \
            --exec /usr/bin/authbind -- __NODE__ __PWD__/proximity.js

end script

## ----------------------------------------------------------------------------


# Checks whether the gtest library is available on the system
# Allows for adjusting the include and library path.
# Sets have_gtest=yes if the library is present and
# reports the compiler and linker flags in
# GTEST_CXXFLAGS AND GTEST_LDFLAGS, respectively.
AC_DEFUN([AC_CHECK_GTEST],
[
  AC_ARG_WITH([gtest-include-path],
  [AS_HELP_STRING([--with-gtest-include-path],
    [location of the Google test headers, defaults to /usr/include])],
  [GTEST_CXXFLAGS="-I$withval"],
  [GTEST_CXXFLAGS='-I/usr/include'])

  AC_ARG_WITH([gtest-lib-path],
  [AS_HELP_STRING([--with-gtest-lib-path], [location of the Google test libraries])],
  [GTEST_LDFLAGS="-L$withval -lpthread"],
  [GTEST_LDFLAGS='-lgtest -lpthread'])

  AC_LANG_CPLUSPLUS

  # We need to get to the 5th arg to link with -lpthread too. Mimic the default
  # AC_CHECK_LIB action when found.
  AC_CHECK_LIB([gtest], [main],
               [AC_DEFINE(HAVE_LIBGTEST) LIBS="-lgtest $LIBS"],
               [],
               [-lpthread])
]) # AC_CHECK_GTEST

Use AC_LANG_PUSH(C++)/AC_LANG_POP so as not to contaminate configure.ac

# Checks whether the gtest library is available on the system
# Allows for adjusting the include and library path.
# Sets have_gtest=yes if the library is present and
# reports the compiler and linker flags in
# GTEST_CXXFLAGS AND GTEST_LDFLAGS, respectively.
AC_DEFUN([AC_CHECK_GTEST],
[
  AC_ARG_WITH([gtest-include-path],
  [AS_HELP_STRING([--with-gtest-include-path],
    [location of the Google test headers, defaults to /usr/include])],
  [GTEST_CXXFLAGS="-I$withval"],
  [GTEST_CXXFLAGS='-I/usr/include'])

  AC_ARG_WITH([gtest-lib-path],
  [AS_HELP_STRING([--with-gtest-lib-path], [location of the Google test libraries])],
  [GTEST_LDFLAGS="-L$withval -lpthread"],
  [GTEST_LDFLAGS='-lgtest -lpthread'])

  AC_LANG_PUSH(C++)

  # We need to get to the 5th arg to link with -lpthread too. Mimic the default
  # AC_CHECK_LIB action when found.
  AC_CHECK_LIB([gtest], [main],
               [AC_DEFINE(HAVE_LIBGTEST) LIBS="-lgtest $LIBS"],
               [],
               [-lpthread])

  AC_LANG_POP
]) # AC_CHECK_GTEST


[profiles]
  [[default]]
    scrollback_lines = 10000
    scrollbar_position = hidden
    show_titlebar = False

Set font to monospace 11

[global_config]
  inactive_color_offset = 1.0
[profiles]
  [[default]]
    font = monospace 11
    scrollback_lines = 10000
    scrollbar_position = hidden
    show_titlebar = False
    use_system_font = False


dnl check for sidplay

AC_DEFUN([GST_PATH_SIDPLAY],
[
AC_MSG_CHECKING([for libsidplay 1.36.x])

AC_LANG_PUSH(C++)

AC_CHECK_HEADER(sidplay/player.h, HAVE_SIDPLAY="yes", HAVE_SIDPLAY="no")

if test $HAVE_SIDPLAY = "yes"; then
  SIDPLAY_LIBS="-lsidplay"

  AC_MSG_CHECKING([whether -lsidplay works])
  ac_libs_safe=$LIBS

  LIBS="-lsidplay"

  AC_TRY_RUN([
    #include <sidplay/player.h>
    int main()
    { sidTune tune = sidTune(0);  }
    ],
    HAVE_SIDPLAY="yes",
    HAVE_SIDPLAY="no",
    HAVE_SIDPLAY="no")

  LIBS="$ac_libs_safe"

  AC_MSG_RESULT([$HAVE_SIDPLAY])
fi

SIDPLAY_CFLAGS=
SIDPLAY_LIBS="-lsidplay"
AC_SUBST(SIDPLAY_CFLAGS)
AC_SUBST(SIDPLAY_LIBS)

AC_LANG_POP(C++)
])

Fix cross-compilation by using AC_TRY_LINK instead of AC_TRY_RUN

dnl check for sidplay

AC_DEFUN([GST_PATH_SIDPLAY],
[
AC_MSG_CHECKING([for libsidplay 1.36.x])

AC_LANG_PUSH(C++)

AC_CHECK_HEADER(sidplay/player.h, HAVE_SIDPLAY="yes", HAVE_SIDPLAY="no")

if test $HAVE_SIDPLAY = "yes"; then
  SIDPLAY_LIBS="-lsidplay"

  AC_MSG_CHECKING([whether -lsidplay works])
  ac_libs_safe=$LIBS

  LIBS="-lsidplay"

  AC_TRY_LINK([#include <sidplay/player.h>],
    [sidTune tune = sidTune(0);],
    HAVE_SIDPLAY="yes",
    HAVE_SIDPLAY="no")

  LIBS="$ac_libs_safe"

  AC_MSG_RESULT([$HAVE_SIDPLAY])
fi

SIDPLAY_CFLAGS=
SIDPLAY_LIBS="-lsidplay"
AC_SUBST(SIDPLAY_CFLAGS)
AC_SUBST(SIDPLAY_LIBS)

AC_LANG_POP(C++)
])


m4_include(env_config.m4)m4_dnl
m4_ifdef(??[[<<m4_env_config_LANG>>]]??,LANG=m4_env_config_LANG)
m4_ifdef(??[[<<m4_env_config_LC_TIME>>]]??,LC_TIME=m4_env_config_LC_TIME)

Set LC_ALL (and removed useless LC_TIME)


##############################################################################
# -*- Autoconf -*-
#
#

##############################################################################
#
# CIGMA_OPTIONS_HDF5
#
AC_DEFUN([CIGMA_OPTIONS_HDF5], [
    AC_ARG_VAR(HDF5_HOME, [home path to HDF5 library])
    AC_ARG_WITH([hdf5],
        [AC_HELP_STRING([--with-hdf5],
                        [enable HDF5 @<:@default=/usr@:>@])],
        [with_hdf5="$withval"],
        [with_hdf5="/usr"])
])

##############################################################################
#
# CIGMA_PATH_HDF5([action-if-found], [action-if-not-found])
#
AC_DEFUN([CIGMA_PATH_HDF5],[

    if [[ $with_hdf5 = "yes" ]]; then

        dnl in case user wrote --with-hdf5=yes
        with_hdf5="/usr"

    fi

    if [[ $with_hdf5 != "no" ]]; then

        HDF5_PREFIX="$with_hdf5"

        AC_CHECK_FILE([$HDF5_PREFIX/include/hdf5.h],[hdf5Found="OK"])
        AC_MSG_CHECKING([if HDF5 is installed in $HDF5_PREFIX])

        if [[ -z "$hdf5Found" ]]; then

            dnl HDF5 not found!
            AC_MSG_RESULT([no])
            $3

        else

            dnl HDF5 found!
            AC_MSG_RESULT([yes])
            HDF5_CFLAGS="-I$HDF5_PREFIX/include"
            HDF5_CXXFLAGS="$HDF5_CFLAGS"
            HDF5_LIBS="-lhdf5"
            HDF5_LDFLAGS="-L$HDF5_PREFIX/lib $HDF5_LIBS -Wl,--rpath -Wl,$HDF5_PREFIX/lib"
            $2

        fi

    else

        dnl user specified --with-hdf5=no
        dnl nothing to do?
        /bin/false

    fi  # if [[ $with_hdf5 != "no" ]];

])

# vim: syntax=config


m4_include(user_config.m4)m4_dnl
m4_include(env_config.m4)m4_dnl
if [[ -f ~/.profile ]]; then
	source ~/.profile;
elif [[ -f ~/.bashrc ]]; then
	source ~/.bashrc;
fi
m4_ifdef(??[[<<m4_env_config_KEYCHAIN>>]]??,
eval $(keychain --eval --agents ssh --quick --quiet)
)m4_dnl
m4_ifdef(??[[<<m4_env_config_BREW_BIN_PATH>>]]??,
export PATH=$PATH:m4_env_config_BREW_BIN_PATH
)m4_dnl

Include GEM_BIN_PATH in bash path

m4_include(user_config.m4)m4_dnl
m4_include(env_config.m4)m4_dnl
if [[ -f ~/.profile ]]; then
	source ~/.profile;
elif [[ -f ~/.bashrc ]]; then
	source ~/.bashrc;
fi
m4_ifdef(??[[<<m4_env_config_KEYCHAIN>>]]??,
eval $(keychain --eval --agents ssh --quick --quiet)
)m4_dnl
m4_ifdef(??[[<<m4_env_config_BREW_BIN_PATH>>]]??,
export PATH=$PATH:m4_env_config_BREW_BIN_PATH
)m4_dnl
m4_ifdef(??[[<<m4_env_config_GEM_BIN_PATH>>]]??,
export PATH=$PATH:m4_env_config_GEM_BIN_PATH
)m4_dnl


CONFIG_FILE(x, ~/.xinitrc)

source /etc/X11/xinit/xinitrc.d/*

xset r rate 200 25 &
setxkbmap gb
xmodmap ~/.Xmodmap
xrdb -merge ~/.Xdefaults
xrdb -merge ~/.Xsolarized

ON_COMPUTER(LAPTOP)
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Axes" 8 6 7 4 5

mpd &
nm-applet &
angel ~/.angel &
mpdscribble -D --conf ~/.mpdscribble &
dropbox start &
END_COMPUTER()

while true; do
        IF_COMPUTER(!UNI, `ck-launch-session ')i3
        xmessage 'Restart the Window Manager?' \
                 -buttons 'Yes:1,No:0' -center \
                 -default 'Yes' -timeout 30    \
        && break
done

Make keyboard work properly on startup.

CONFIG_FILE(x, ~/.xinitrc)

source /etc/X11/xinit/xinitrc.d/*

xset r rate 200 25 &
setxkbmap gb
xmodmap ~/.Xmodmap
xrdb -merge ~/.Xdefaults
xrdb -merge ~/.Xsolarized

ON_COMPUTER(LAPTOP)
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Axes" 8 6 7 4 5

xinput set-int-prop "pointer:Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint" "Evdev Wheel Emulation" 8 1
xinput set-int-prop "pointer:Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint" "Evdev Wheel Emulation Button" 8 2
xinput set-int-prop "pointer:Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint" "Evdev Wheel Emulation Axes" 8 6 7 4 5

xset +fp /usr/share/fonts/local/

mpd &
nm-applet &
angel ~/.angel &
mpdscribble -D --conf ~/.mpdscribble &
dropbox start &
END_COMPUTER()

while true; do
        IF_COMPUTER(!UNI, `ck-launch-session ')i3
        xmessage 'Restart the Window Manager?' \
                 -buttons 'Yes:1,No:0' -center \
                 -default 'Yes' -timeout 30    \
        && break
done


# From https://github.com/collectd/collectd/blob/master/configure.ac
# Dependency handling currently unused

define([toupper], [translit([$1], [a-z], [A-Z])])
define([sanitize], [translit([$1], [-], [_])])

# AC_PLUGIN(name, default, info)
# ------------------------------------------------------------
AC_DEFUN([AC_PLUGIN],[
    m4_divert_once([HELP_ENABLE], [
Optional Plugins:])
    enable_plugin="no"
    define(pluggy, sanitize($1))
    define(PLUGGY, toupper(pluggy))
    AC_ARG_ENABLE([$1-plugin], AS_HELP_STRING([--enable-$1-plugin], [$3]), [
    if test "x$enableval" = "xyes"; then
             enable_plugin="yes"
    else
             enable_plugin="no"
    fi], [
    if test "x$enable_all_plugins" = "xauto"; then
             if test "x$2" = "xyes"; then
                     enable_plugin="yes"
             else
                     enable_plugin="no"
             fi
    else
             enable_plugin="$enable_all_plugins"
    fi])
    if test "x$enable_plugin" = "xyes"; then
       	    AC_DEFINE([HAVE_]PLUGGY[_PLUGIN], 1, [Define to 1 if the $1 plugin is enabled.])
    fi
    AM_CONDITIONAL([BUILD_]PLUGGY[_PLUGIN], test "x$enable_plugin" = "xyes")
    enable_pluggy="$enable_plugin"])

Fix default handling in M4 macro AC_PLUGIN()

# From https://github.com/collectd/collectd/blob/master/configure.ac
# Dependency handling currently unused

define([toupper], [translit([$1], [a-z], [A-Z])])
define([sanitize], [translit([$1], [-], [_])])
define([enadis], [ifelse([$1], [yes], [disable], [enable])])

# AC_PLUGIN(name, default, info)
# ------------------------------------------------------------
AC_DEFUN([AC_PLUGIN],[
    m4_divert_once([HELP_ENABLE], [
Optional Plugins:])
    enable_plugin="no"
    define(pluggy, sanitize($1))
    define(PLUGGY, toupper(pluggy))
    AC_ARG_ENABLE([$1-plugin], AS_HELP_STRING([--enadis($2)-$1-plugin], [$3]), [
    if test "x$enableval" = "xyes"; then
             enable_plugin="yes"
    else
             enable_plugin="no"
    fi], [
    if test "x$enable_all_plugins" = "xauto"; then
             if test "x$2" = "xyes"; then
                     enable_plugin="yes"
             else
                     enable_plugin="no"
             fi
    else
             enable_plugin="$enable_all_plugins"
    fi])
    if test "x$enable_plugin" = "xyes"; then
       	    AC_DEFINE([HAVE_]PLUGGY[_PLUGIN], 1, [Define to 1 if the $1 plugin is enabled.])
    fi
    AM_CONDITIONAL([BUILD_]PLUGGY[_PLUGIN], test "x$enable_plugin" = "xyes")
    enable_pluggy="$enable_plugin"])


AC_DEFUN([DETECT_BYTEORDER],
[
    AC_REQUIRE([AC_C_BIGENDIAN])
    AC_CACHE_CHECK([for htonll], [ac_cv_have_htonll],
        [AC_TRY_COMPILE([
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
                        ], [
return htonll(0);
                        ],
                        [ ac_cv_have_htonll=yes ],
                        [ ac_cv_have_htonll=no ])
        ])
    AS_IF([test "x$ac_cv_have_htonll" = "xyes"],[
          AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])])

    AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$ac_cv_have_htonll" = "xno"])
])

Fix ntohll test.. we need to link, not just compile ;-)

AC_DEFUN([DETECT_BYTEORDER],
[
    AC_REQUIRE([AC_C_BIGENDIAN])
    AC_CACHE_CHECK([for htonll], [ac_cv_have_htonll],
        [AC_TRY_LINK([
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
                        ], [
return htonll(0);
                        ],
                        [ ac_cv_have_htonll=yes ],
                        [ ac_cv_have_htonll=no ])
        ])
    AS_IF([test "x$ac_cv_have_htonll" = "xyes"],[
          AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])])

    AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$ac_cv_have_htonll" = "xno"])
])


AM_CONDITIONAL([ENABLE_X11],
                [test "$enable_x11" == "yes"])

AM_CONDITIONAL([ENABLE_JPEG],
                [test "$enable_jpeg" == "yes"])

AM_CONDITIONAL([ENABLE_PNG],
                [test "$enable_png" == "yes"])

Fix interpretation of configuration flags.

AM_CONDITIONAL([ENABLE_X11],
                [test "$enable_x11" != "no"])

AM_CONDITIONAL([ENABLE_JPEG],
                [test "$enable_jpeg" != "no"])

AM_CONDITIONAL([ENABLE_PNG],
                [test "$enable_png" != "no"])


# See man gsimplecal for other options

# Setting to 0 prevents i3 from tiling the window.
mainwindow_resizable = 0

Set gsimplecal position to be the center to avoid clipped windows

# See man gsimplecal for other options

# Setting to 0 prevents i3 from tiling the window.
mainwindow_resizable = 0
# Temporary workaround until sort out positioning by the bottom right that is
# entirely within the screen
mainwindow_position = center


AC_DEFUN([MACRO_STATIC_ASSERT],
  [AC_CACHE_CHECK([for static_assert],
    [neo4j_cv_macro_static_assert],
    [AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM([[
#include <assert.h>
static_assert(1, "impossible");
      ]],[[return 0;]])],
      [neo4j_cv_macro_static_assert=yes],
      [neo4j_cv_macro_static_assert=no])])

  if test "X$neo4j_cv_macro_static_assert" = "Xno"; then
    AC_DEFINE(static_assert(c,m), , [Substitute for static_assert])
  fi
])

Improve handling of missing static_assert

AC_DEFUN([MACRO_STATIC_ASSERT],
  [AC_CACHE_CHECK([for static_assert],
    [neo4j_cv_macro_static_assert],
    [AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM([[
#include <assert.h>
static_assert(1, "impossible");
      ]],[[return 0;]])],
      [neo4j_cv_macro_static_assert=yes],
      [neo4j_cv_macro_static_assert=no])])

  if test "X$neo4j_cv_macro_static_assert" = "Xno"; then
    AC_DEFINE([static_assert(c,m)],[struct _no_static_assert{}], [Substitute for static_assert])
  fi
])


dnl @synopsis AC_PYTHON_MODULE(modname[, fatal])
dnl
dnl Checks for Python 2 module.
dnl
dnl If fatal is non-empty then absence of a module will trigger an
dnl error.
dnl
dnl @category InstalledPackages
dnl @author Andrew Collier <colliera@nu.ac.za>.
dnl @version 2014-09-08
dnl @license AllPermissive

AC_DEFUN([AC_PYTHON_MODULE],[
	AC_MSG_CHECKING(python2 module: $1)
	python -c "import $1" 2>/dev/null
	if test $? -eq 0;
	then
		AC_MSG_RESULT(yes)
		eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
	else
		AC_MSG_RESULT(no)
		eval AS_TR_CPP(HAVE_PYMOD_$1)=no

		$3

		if test "$2" = "yes"; then
			AC_MSG_ERROR(failed to find required module $1)
			exit 1
		fi
	fi
])

Fix protobuf detection on systems with Python 3 as default (part2)

dnl @synopsis AC_PYTHON_MODULE(modname[, fatal])
dnl
dnl Checks for Python 2 module.
dnl
dnl If fatal is non-empty then absence of a module will trigger an
dnl error.
dnl
dnl @category InstalledPackages
dnl @author Andrew Collier <colliera@nu.ac.za>.
dnl @version 2014-09-08
dnl @license AllPermissive

AC_DEFUN([AC_PYTHON_MODULE],[
	AC_MSG_CHECKING(python2 module: $1)
	python2 -c "import $1" 2>/dev/null
	if test $? -eq 0;
	then
		AC_MSG_RESULT(yes)
		eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
	else
		AC_MSG_RESULT(no)
		eval AS_TR_CPP(HAVE_PYMOD_$1)=no

		$3

		if test "$2" = "yes"; then
			AC_MSG_ERROR(failed to find required module $1)
			exit 1
		fi
	fi
])


dnl @synopsis AC_PYTHON_MODULE(modname[, fatal])
dnl
dnl Checks for Python module.
dnl
dnl If fatal is non-empty then absence of a module will trigger an
dnl error.
dnl
dnl @category InstalledPackages
dnl @author Andrew Collier <colliera@nu.ac.za>.
dnl @version 2004-07-14
dnl @license AllPermissive

AC_DEFUN([AC_PYTHON_MODULE],[
	AC_MSG_CHECKING(python module: $1)
	python -c "import $1" 2>/dev/null
	if test $? -eq 0;
	then
		AC_MSG_RESULT(yes)
		eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
	else
		AC_MSG_RESULT(no)
		eval AS_TR_CPP(HAVE_PYMOD_$1)=no

		$3

		if test "$2" = "yes"; then
			AC_MSG_ERROR(failed to find required module $1)
			exit 1
		fi
	fi
])

Fix protobuf detection on systems with Python 3 as default

dnl @synopsis AC_PYTHON_MODULE(modname[, fatal])
dnl
dnl Checks for Python 2 module.
dnl
dnl If fatal is non-empty then absence of a module will trigger an
dnl error.
dnl
dnl @category InstalledPackages
dnl @author Andrew Collier <colliera@nu.ac.za>.
dnl @version 2014-09-08
dnl @license AllPermissive

AC_DEFUN([AC_PYTHON_MODULE],[
	AC_MSG_CHECKING(python2 module: $1)
	python -c "import $1" 2>/dev/null
	if test $? -eq 0;
	then
		AC_MSG_RESULT(yes)
		eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
	else
		AC_MSG_RESULT(no)
		eval AS_TR_CPP(HAVE_PYMOD_$1)=no

		$3

		if test "$2" = "yes"; then
			AC_MSG_ERROR(failed to find required module $1)
			exit 1
		fi
	fi
])


dnl The libxml-2.0 library
dnl
dnl Copyright (C) 2016 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library.  If not, see
dnl <http://www.gnu.org/licenses/>.
dnl

AC_DEFUN([LIBVIRT_ARG_LIBXML], [
  LIBVIRT_ARG_WITH([LIBXML], [libxml-2.0 (>= 2.9.1) location], [check])
])

AC_DEFUN([LIBVIRT_CHECK_LIBXML], [
  LIBXML_REQUIRED="2.9.1"

  LIBVIRT_CHECK_PKG([LIBXML], [libxml-2.0], [$LIBXML_REQUIRED])

  if test "$with_libxml" = "no" ; then
    AC_MSG_ERROR([libxml2 >= $LIBXML_REQUIRED is required for libvirt])
  fi
])

AC_DEFUN([LIBVIRT_RESULT_LIBXML], [
  LIBVIRT_RESULT_LIB([LIBXML])
])

Drop libxml2 version number from configure help

dnl The libxml-2.0 library
dnl
dnl Copyright (C) 2016 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library.  If not, see
dnl <http://www.gnu.org/licenses/>.
dnl

AC_DEFUN([LIBVIRT_ARG_LIBXML], [
  LIBVIRT_ARG_WITH([LIBXML], [libxml-2.0 location], [check])
])

AC_DEFUN([LIBVIRT_CHECK_LIBXML], [
  LIBXML_REQUIRED="2.9.1"

  LIBVIRT_CHECK_PKG([LIBXML], [libxml-2.0], [$LIBXML_REQUIRED])

  if test "$with_libxml" = "no" ; then
    AC_MSG_ERROR([libxml2 >= $LIBXML_REQUIRED is required for libvirt])
  fi
])

AC_DEFUN([LIBVIRT_RESULT_LIBXML], [
  LIBVIRT_RESULT_LIB([LIBXML])
])


dnl The libvirt-php.so config
dnl
dnl Copyright (C) 2016 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library.  If not, see
dnl <http://www.gnu.org/licenses/>.
dnl

dnl
dnl Check whether php module exists
dnl
dnl LIBVIRT_CHECK_PHP_EXTENSION([EXTENSION])
dnl
AC_DEFUN([LIBVIRT_CHECK_PHP_EXTENSION],[
  AC_MSG_CHECKING([for php module $1])

  module="$(php -m | grep $1)"

  if test "x$module" = "x"; then
    AC_MSG_ERROR([php module $1 not found])
  else
    AC_MSG_RESULT([found])
  fi
])

Check for php modules more wisely

dnl The libvirt-php.so config
dnl
dnl Copyright (C) 2016 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library.  If not, see
dnl <http://www.gnu.org/licenses/>.
dnl

dnl
dnl Check whether php module exists
dnl
dnl LIBVIRT_CHECK_PHP_EXTENSION([EXTENSION])
dnl
AC_DEFUN([LIBVIRT_CHECK_PHP_EXTENSION],[
  AC_MSG_CHECKING([for php module $1])

  phpbinary="$($PHPCONFIG --php-binary)"
  if test "x$phpbinary" = "x"; then
    phpbinary="$($PHPCONFIG --prefix)/bin/php"
  fi

  if test ! -x "$phpbinary"; then
    AC_MSG_ERROR([php binary not found])
  fi

  AC_SUBST([phpbinary])

  module="$($phpbinary -m | grep $1)"

  if test "x$module" = "x"; then
    AC_MSG_ERROR([php module $1 not found])
  else
    AC_MSG_RESULT([found])
  fi
])


[options]
allow_bold = true
clickable_url = true
mouse_autohide = true
scrollback_lines = 10000
search_wrap = true
font = DejaVu Sans Mono 10

[colors]
# blue
color4  = #6a9fb5
color12 = #6a9fb5

Set a full colour scheme

[options]
allow_bold = true
clickable_url = true
mouse_autohide = true
scrollback_lines = 10000
search_wrap = true
font = DejaVu Sans Mono 10

[colors]
# This color scheme is what gnome-terminal calls the "xterm" profile
# special
foreground      = #ffffff
foreground_bold = #ffffff
cursor          = #ffffff
background      = #000000

# black
color0  = #000000
color8  = #7f7f7f

# red
color1  = #cd0000
color9  = #ff0000

# green
color2  = #00cd00
color10 = #00ff00

# yellow
color3  = #cdcd00
color11 = #ffff00

# blue
color4  = #0000ee
color12 = #5c5cff

# magenta
color5  = #cd00cd
color13 = #ff00ff

# cyan
color6  = #00cdcd
color14 = #00ffff

# white
color7  = #e5e5e5
color15 = #ffffff


# This is included from fizmo-dist and not required by libfizmo's own
# configuration. It nevertheless needs to be maintained so fizmo-dist
# will still work.
#
# The $build_prefix, $build_prefix_cflags and $build_prefix_libs are
# pre-defined by fizmo-dist.

AC_SUBST([libpixelif_CFLAGS], "-I$build_prefix_cflags $libdrilbo_CFLAGS $freetype2_CFLAGS")
AC_SUBST([libpixelif_LIBS], "-L$build_prefix_libs -lpixelif $libdrilbo_LIBS $freetype2_LIBS")

Fix substs for distribution build.

# This is included from fizmo-dist and not required by libfizmo's own
# configuration. It nevertheless needs to be maintained so fizmo-dist
# will still work.
#
# The $build_prefix, $build_prefix_cflags and $build_prefix_libs are
# pre-defined by fizmo-dist.

AC_SUBST([libpixelif_CFLAGS], "-I$build_prefix_cflags $libdrilbo_CFLAGS $libfreetype2_CFLAGS")
AC_SUBST([libpixelif_LIBS], "-L$build_prefix_libs -lpixelif $libdrilbo_LIBS $libfreetype2_LIBS")


AC_DEFUN([SHAMROCK_CHECK_MONODOC],
[
	AC_ARG_ENABLE(docs, AC_HELP_STRING([--disable-docs],
		[Do not build documentation]), , enable_docs=yes)

	if test "x$enable_docs" = "xyes"; then
		AC_PATH_PROG(MONODOCER, monodocer, no)
		if test "x$MONODOCER" = "xno"; then
			AC_MSG_ERROR([You need to install monodoc, or pass --disable-docs to configure to skip documentation installation])
		fi

		AC_PATH_PROG(MDASSEMBLER, mdassembler, no)
		if test "x$MDASSEMBLER" = "xno"; then
			AC_MSG_ERROR([You need to install mdassembler, or pass --disable-docs to configure to skip documentation installation])
		fi

		DOCDIR=`$PKG_CONFIG monodoc --variable=sourcesdir`
		AC_SUBST(DOCDIR)
		AM_CONDITIONAL(BUILD_DOCS, true)
	else
		AC_MSG_NOTICE([not building ${PACKAGE} API documentation])
		AM_CONDITIONAL(BUILD_DOCS, false)
	fi
])

Allow docs to install into a prefix

AC_DEFUN([SHAMROCK_CHECK_MONODOC],
[
	AC_ARG_ENABLE(docs, AC_HELP_STRING([--disable-docs],
		[Do not build documentation]), , enable_docs=yes)

	if test "x$enable_docs" = "xyes"; then
		AC_PATH_PROG(MONODOCER, monodocer, no)
		if test "x$MONODOCER" = "xno"; then
			AC_MSG_ERROR([You need to install monodoc, or pass --disable-docs to configure to skip documentation installation])
		fi

		AC_PATH_PROG(MDASSEMBLER, mdassembler, no)
		if test "x$MDASSEMBLER" = "xno"; then
			AC_MSG_ERROR([You need to install mdassembler, or pass --disable-docs to configure to skip documentation installation])
		fi

		DOCDIR=`$PKG_CONFIG monodoc --define-variable=libdir=${libdir} --variable=sourcesdir`
		AC_SUBST(DOCDIR)
		AM_CONDITIONAL(BUILD_DOCS, true)
	else
		AC_MSG_NOTICE([not building ${PACKAGE} API documentation])
		AM_CONDITIONAL(BUILD_DOCS, false)
	fi
])


#
# Check for GNU Make.  This is from
# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html
#
AC_DEFUN([AC_CHECK_GNU_MAKE],
[ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
                _cv_gnu_make_command='' ;
dnl Search all the common names for GNU make
                for a in "$MAKE" make gmake gnumake ; do
                        if test -z "$a" ; then continue ; fi ;
                        if  ( sh -c "$a --version" 2> /dev/null | grep GNU  2>&1 > /dev/null ) ;  then
                                _cv_gnu_make_command=$a ;
                                break;
                        fi
                done ;
        ) ;
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
        if test  "x$_cv_gnu_make_command" != "x"  ; then
                ifGNUmake='' ;
        else
                ifGNUmake='#' ;
                AC_MSG_RESULT("Not found");
        fi
        AC_SUBST(ifGNUmake)
])

Tidy up the indentation. Give the cache variable a proper name.

#
# Check for GNU Make.  This is originally from
# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html
#
AC_DEFUN([AC_CHECK_GNU_MAKE],
[AC_CACHE_CHECK([for GNU make],[llvm_cv_gnu_make_command],
dnl Search all the common names for GNU make
[llvm_cv_gnu_make_command=''
 for a in "$MAKE" make gmake gnumake ; do
  if test -z "$a" ; then continue ; fi ;
  if  ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null )
  then
   llvm_cv_gnu_make_command=$a ;
   break;
  fi
 done])
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string,
dnl '#' otherwise
 if test "x$llvm_cv_gnu_make_command" != "x"  ; then
   ifGNUmake='' ;
 else
   ifGNUmake='#' ;
   AC_MSG_RESULT("Not found");
 fi
 AC_SUBST(ifGNUmake)
])


AC_DEFUN([BANSHEE_CHECK_OSX],
[
	IGE_MAC_INTEGRATION_REQUIRED=0.8.6

	AC_ARG_ENABLE(osx, AC_HELP_STRING([--enable-osx], [Enable OSX support]), enable_osx=$enableval, enable_osx="no")

	if test "x$enable_osx" = "xyes"; then
		dnl FIXME: detect osx
		have_osx="yes"

		PKG_CHECK_MODULES(IGE_MAC_INTEGRATION,
			ige-mac-integration >= $IGE_MAC_INTEGRATION_REQUIRED,
			have_ige_mac_integration=yes, have_ige_mac_integration=no)

		if test "x$have_ige_mac_integration" = "xno"; then
			AC_MSG_ERROR([ige-mac-integration was not found or is not up to date. Please install ige-mac-integration of at least version $IGE_MAC_INTEGRATION_REQUIRED])
		fi
		AC_SUBST(IGE_MAC_INTEGRATION_LIBS)
	fi

	AM_CONDITIONAL(ENABLE_OSX, test "x$have_osx" = "xyes")
])

Revert "[build] check for ige-mac-integration"

AC_DEFUN([BANSHEE_CHECK_OSX],
[
	IGEMACINTEGRATIONSHARP_REQUIRED=0.8.2

	AC_ARG_ENABLE(osx, AC_HELP_STRING([--enable-osx], [Enable OSX support]), enable_osx=$enableval, enable_osx="no")

	if test "x$enable_osx" = "xyes"; then
		dnl FIXME: detect osx
		have_osx="yes"

		PKG_CHECK_MODULES(IGEMACINTEGRATIONSHARP,
			ige-mac-integration-sharp >= $IGEMACINTEGRATIONSHARP_REQUIRED,
			have_igemacintegrationsharp=yes, have_igemacintegrationsharp=no)

		if test "x$have_igemacintegrationsharp" = "xno"; then
			AC_MSG_ERROR([ige-mac-integration-sharp was not found or is not up to date. Please install ige-mac-integration-sharp of at least version $IGEMACINTEGRATIONSHARP_REQUIRED])
		fi
		AC_SUBST(IGEMACINTEGRATIONSHARP_LIBS)
	fi

	AM_CONDITIONAL(ENABLE_OSX, test "x$have_osx" = "xyes")
])


#
# Copyright (C) 2015 CossackLabs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

PHP_ARG_ENABLE(phpthemis, whether to enable themis support,[ --enable-phpthemis   Enable themis support])

if test "$PHP_PHPTHEMIS" = "yes"; then
  AC_DEFINE(HAVE_PHPTHEMIS, 1, [Whether you have themis])
  PHP_ADD_LIBRARY(themis, 1, PHPTHEMIS_SHARED_LIBADD)
  PHP_ADD_LIBRARY(soter, 1, PHPTHEMIS_SHARED_LIBADD)
  PHP_ADD_LIBRARY(crypto, 1, PHPTHEMIS_SHARED_LIBADD)
  PHP_NEW_EXTENSION(phpthemis, php_themis.c, $ext_shared)
fi

Add dependences to PHP Extensions

#
# Copyright (C) 2015 CossackLabs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

PHP_ARG_ENABLE(phpthemis, whether to enable themis support,[ --enable-phpthemis   Enable themis support])

if test "$PHP_PHPTHEMIS" = "yes"; then
  AC_DEFINE(HAVE_PHPTHEMIS, 1, [Whether you have themis])
  PHP_SUBST(PHPTHEMIS_SHARED_LIBADD)
  PHP_ADD_LIBRARY(themis, 1, PHPTHEMIS_SHARED_LIBADD)
  PHP_ADD_LIBRARY(soter, 1, PHPTHEMIS_SHARED_LIBADD)
  PHP_ADD_LIBRARY(crypto, 1, PHPTHEMIS_SHARED_LIBADD)
  PHP_NEW_EXTENSION(phpthemis, php_themis.c, $ext_shared)
fi


Package: rtvs-daemon
Version: RTVS_VERSION
Section: devel
Priority: optional
Architecture: amd64
Depends: libexplain51 (>= 1.4.D001-2), libzip4 (>= 1.0.1-0ubuntu1), dotnet-dev-1.0.4 (>= 1.0.4-1), libc6 (>= 2.23-0ubuntu7), bash (>= 4.3-14ubuntu1.2), systemd(>= 229-4ubuntu17)
Suggests: r-base (>= 3.2.0), microsoft-r-open-mro-3.2 (>= 3.2.0)
Maintainer: R Tools for Visual Studio Support <rtvs-support@microsoft.com>
Homepage: https://www.visualstudio.com/vs/rtvs/
Description: R execution environment for R Tools for Visual Studio
 R execution environment allows you to use the Visual Studio 2017 (or greater)
 on Microsoft Windows to work with R interpreter running on linux. R execution
 environment supports popular R distributions such as CRAN R and Microsoft R
 Open (enhanced with multi-threaded math libs, cluster scale computing, and a
 high performance CRAN repo with checkpoint capabilities). This service enables
 R interactive window, debugging, intellisence, plots, history, variable
 explorer, R package management on linux from Visual Studio 2017 (or greater).

Add lshw as a dependency.

Package: rtvs-daemon
Version: RTVS_VERSION
Section: devel
Priority: optional
Architecture: amd64
Depends: libexplain51 (>= 1.4.D001-2), lshw (>=02.17-1.1ubuntu3.2), libzip4 (>= 1.0.1-0ubuntu1), dotnet-dev-1.0.4 (>= 1.0.4-1), libc6 (>= 2.23-0ubuntu7), bash (>= 4.3-14ubuntu1.2), systemd(>= 229-4ubuntu17)
Suggests: r-base (>= 3.2.0), microsoft-r-open-mro-3.2 (>= 3.2.0)
Maintainer: R Tools for Visual Studio Support <rtvs-support@microsoft.com>
Homepage: https://www.visualstudio.com/vs/rtvs/
Description: R execution environment for R Tools for Visual Studio
 R execution environment allows you to use the Visual Studio 2017 (or greater)
 on Microsoft Windows to work with R interpreter running on linux. R execution
 environment supports popular R distributions such as CRAN R and Microsoft R
 Open (enhanced with multi-threaded math libs, cluster scale computing, and a
 high performance CRAN repo with checkpoint capabilities). This service enables
 R interactive window, debugging, intellisence, plots, history, variable
 explorer, R package management on linux from Visual Studio 2017 (or greater).


#
# urbi-win32.m4: This file is part of build-aux.
# Copyright (C) 2006-2008, Gostai S.A.S.
#
# This software is provided "as is" without warranty of any kind,
# either expressed or implied, including but not limited to the
# implied warranties of fitness for a particular purpose.
#
# See the LICENSE file for more information.
# For comments, bug reports and feedback: http://www.urbiforge.com
#

# URBI_WIN32
# ----------
# Look for windows. Define the automake conditional WIN32 as well
# as $windows.
AC_DEFUN([URBI_WIN32],
[AC_CHECK_HEADERS([windows.h], [windows=true], [windows=false])
AM_CONDITIONAL([WIN32], [$windows])
])

Fix windows-style dependencies paths under mingw.

#
# urbi-win32.m4: This file is part of build-aux.
# Copyright (C) 2006-2008, Gostai S.A.S.
#
# This software is provided "as is" without warranty of any kind,
# either expressed or implied, including but not limited to the
# implied warranties of fitness for a particular purpose.
#
# See the LICENSE file for more information.
# For comments, bug reports and feedback: http://www.urbiforge.com
#

# URBI_WIN32
# ----------
# Look for windows. Define the automake conditional WIN32 as well
# as $windows.
AC_DEFUN([URBI_WIN32],
[AC_CHECK_HEADERS([windows.h], [windows=true], [windows=false])
AM_CONDITIONAL([WIN32], [$windows])

case $host_alias in
     (*mingw*)
       # Remove windows-style paths from dependencies files
       AC_CONFIG_COMMANDS([mingw-fix-path],
           [sed -i \
              "/mv.*Pl\?o$/{;s/$/;\\\\/;p;s/;\\$//;s,.*\.Tpo \(.*\),	sed -i s/c:\\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\\/g \1,;};" \
              Makefile
            ])
     ;;
esac
])


# https://www.gnu.org/software/autoconf-archive/ax_prog_apache.html#ax_prog_apache
AC_DEFUN([FIND_LIBMOD],[
AC_MSG_NOTICE(looking for libmodsecurity)
# Check if the user provided --with-libmodsecurity
AC_ARG_WITH(libmodsecurity,
            [AS_HELP_STRING([[--with-libmodsecurity=FILE]],
                            [FILE is the path to libmodsecurity install dir; defaults to "/usr/local/modsecurity/".])],
[
  if test "$withval" = "yes"; then
    V3PATH=/usr/local/modsecurity/
  else
    V3PATH="$withval"
  fi
])

if test -z "$V3PATH"; then
  for i in /usr/local/modsecurity/ \
           /usr/local/sbin \
           /usr/local/bin \
           /usr/sbin \
           /usr/bin;
  do
    if test -f "$i/lib/libmodsecurity.so"; then
      V3LIB="$i/lib/"
    fi
    if test -f "$i/include/modsecurity/modsecurity.h"; then
      V3INCLUDE="$i/include/"
      # TODO: test if V3LIB is set
      break
    fi
  done
fi
if test -n "$V3LIB" -a "$V3LIB" != "no" -a -x "$V3LIB" ; then
    AC_MSG_NOTICE(found libmodsecurity at $V3LIB)
else
    AC_MSG_ERROR(couldn't find libmodsecurity)
fi
])

Add support for 64bit systems when looking for libmodsecurity

# https://www.gnu.org/software/autoconf-archive/ax_prog_apache.html#ax_prog_apache
AC_DEFUN([FIND_LIBMOD],[
AC_MSG_NOTICE(looking for libmodsecurity)
# Check if the user provided --with-libmodsecurity
AC_ARG_WITH(libmodsecurity,
            [AS_HELP_STRING([[--with-libmodsecurity=FILE]],
                            [FILE is the path to libmodsecurity install dir; defaults to "/usr/local/modsecurity/".])],
[
  if test "$withval" = "yes"; then
    V3PATH=/usr/local/modsecurity/
  else
    V3PATH="$withval"
  fi
])

if test -z "$V3PATH"; then
  for i in /usr/local/modsecurity/ \
           /usr/local/sbin \
           /usr/local/bin \
           /usr/sbin \
           /usr/bin \
           /usr;
  do
    if test -f "$i/lib/libmodsecurity.so"; then
      V3LIB="$i/lib/"
    fi
    if test -f "$i/lib64/libmodsecurity.so"; then
      V3LIB="$i/lib64/"
    fi
    if test -f "$i/include/modsecurity/modsecurity.h"; then
      V3INCLUDE="$i/include/"
      # TODO: test if V3LIB is set
      break
    fi
  done
fi
if test -n "$V3LIB" -a "$V3LIB" != "no" -a -x "$V3LIB" ; then
    AC_MSG_NOTICE(found libmodsecurity at $V3LIB)
else
    AC_MSG_ERROR(couldn't find libmodsecurity)
fi
])


dnl @synopsis XERCES_ICU_PREFIX
dnl
dnl Determines the prefix for icu
dnl
dnl @category C
dnl @author James Berry
dnl @version 2005-05-23
dnl @license AllPermissive
dnl
dnl $Id$

AC_DEFUN([XERCES_ICU_PREFIX],
	[
	AC_ARG_WITH([icu],
		[  --with-icu[[=DIR]]        Specify location of icu],
		[with_icu=m4_if($with_icu, [yes], [], $with_icu)],
		[with_icu=])

	# Determine if icu is available
	AC_CACHE_CHECK([for icu], [xerces_cv_icu_prefix],
	[
		xerces_cv_icu_prefix=
		if test x"$with_icu" != x"no"; then
			search_list="$with_icu /usr/local /usr"
			for i in $search_list; do
				if test -r "$i/include/unicode/ucnv.h"; then
					xerces_cv_icu_prefix=$i
					break
				fi
			done
		fi
	])

	AC_SUBST([ICU_PREFIX], [$xerces_cv_icu_prefix])
	]
)

Check for genrb when checking for icu

dnl @synopsis XERCES_ICU_PREFIX
dnl
dnl Determines the prefix for icu
dnl
dnl @category C
dnl @author James Berry
dnl @version 2005-05-23
dnl @license AllPermissive
dnl
dnl $Id$

AC_DEFUN([XERCES_ICU_PREFIX],
	[
	AC_ARG_WITH([icu],
		[  --with-icu[[=DIR]]        Specify location of icu],
		[with_icu=m4_if($with_icu, [yes], [], $with_icu)],
		[with_icu=])

	# Determine if icu is available
	AC_CACHE_CHECK([for icu], [xerces_cv_icu_prefix],
	[
		xerces_cv_icu_prefix=
		if test x"$with_icu" != x"no"; then
			search_list="$with_icu /usr/local /usr"
			for i in $search_list; do
				if test -x $i/bin/genrb -a -r $i/include/unicode/ucnv.h; then
					xerces_cv_icu_prefix=$i
					break
				fi
			done
		fi
	])

	AC_SUBST([ICU_PREFIX], [$xerces_cv_icu_prefix])
	]
)


AC_DEFUN([BANSHEE_CHECK_DAP_MTP],
[
	LIBMTP_REQUIRED=0.2.0

	AC_ARG_ENABLE(mtp, AC_HELP_STRING([--disable-mtp], [Disable MTP DAP support]), , enable_mtp="yes")

	enable_libmtp="${enable_mtp}"

	PKG_CHECK_MODULES(LIBMTP,
		libmtp >= $LIBMTP_REQUIRED,
		enable_libmtp="$enable_libmtp", enable_libmtp=no)

	if test "x$enable_mtp" = "xyes" -a "x$enable_libmtp" = "xno"; then
		AC_MSG_ERROR([libmtp was not found or is not up to date. Please install libmtp of at least version $LIBMTP_REQUIRED, or disable MTP support by passing --disable-mtp])
	fi

	if test "x$enable_libmtp" = "xyes"; then
		LIBMTP_SO_MAP=$(basename $(find $($PKG_CONFIG --variable=libdir libmtp) -maxdepth 1 -regex '.*libmtp\.so\.\w+$' | sort | tail -n 1))
		AC_SUBST(LIBMTP_SO_MAP)
	fi

	AM_CONDITIONAL(ENABLE_MTP, test "x$enable_libmtp" = "xyes")
	AM_CONDITIONAL(LIBMTP_EIGHT, test "x$LIBMTP_SO_MAP" = "xlibmtp.so.8")
])

Fix libmtp.so.* detection for FreeBSD

AC_DEFUN([BANSHEE_CHECK_DAP_MTP],
[
	LIBMTP_REQUIRED=0.2.0

	AC_ARG_ENABLE(mtp, AC_HELP_STRING([--disable-mtp], [Disable MTP DAP support]), , enable_mtp="yes")

	enable_libmtp="${enable_mtp}"

	PKG_CHECK_MODULES(LIBMTP,
		libmtp >= $LIBMTP_REQUIRED,
		enable_libmtp="$enable_libmtp", enable_libmtp=no)

	if test "x$enable_mtp" = "xyes" -a "x$enable_libmtp" = "xno"; then
		AC_MSG_ERROR([libmtp was not found or is not up to date. Please install libmtp of at least version $LIBMTP_REQUIRED, or disable MTP support by passing --disable-mtp])
	fi

	if test "x$enable_libmtp" = "xyes"; then
		LIBMTP_SO_MAP=$(basename $(find $($PKG_CONFIG --variable=libdir libmtp) -maxdepth 1 -regex '.*libmtp\.so\.[[0-9]][[0-9]]*$' | sort | tail -n 1))
		AC_SUBST(LIBMTP_SO_MAP)
	fi

	AM_CONDITIONAL(ENABLE_MTP, test "x$enable_libmtp" = "xyes")
	AM_CONDITIONAL(LIBMTP_EIGHT, test "x$LIBMTP_SO_MAP" = "xlibmtp.so.8")
])


# Dockerfile for Stackage LTS on Centos6, with some custom dependencies.
FROM       lancelet/centos6-lts-a:M4_DOCKER_IMAGE_VERSION
MAINTAINER Jonathan Merritt <j.s.merritt@gmail.com>

## Haskell environment
ENV PATH $HOME/local/.bin:$PATH
ENV STACK_SETUP M4_STACK_SETUP
ENV STACK_INSTALL M4_STACK_INSTALL
ENV STACK_WORKDIR M4_STACK_WORKDIR

## Copy across stack.yaml
RUN mkdir -p $STACK_WORKDIR
WORKDIR $STACK_WORKDIR
ADD stack.yaml $STACK_WORKDIR/stack.yaml
ADD dummy.cabal $STACK_WORKDIR/dummy.cabal

## Some common libraries
RUN $STACK_INSTALL \
    SHA \
    base64-bytestring \
    byteable \
    cereal \
    cmdargs \
    digest \
    dlist \
    extra \
    hslua \
    mtl \
    cryptonite \
    happy \
    network \
    primitive \
    socks \
    stm \
    async \
    strict \
    transformers-compat \
    exceptions \
    mmorph \
    attoparsec \
    semigroups

Move some stuff to an earlier build phase

# Dockerfile for Stackage LTS on Centos6, with some custom dependencies.
FROM       lancelet/centos6-lts-a:M4_DOCKER_IMAGE_VERSION
MAINTAINER Jonathan Merritt <j.s.merritt@gmail.com>

## Haskell environment
ENV PATH $HOME/local/.bin:$PATH
ENV STACK_SETUP M4_STACK_SETUP
ENV STACK_INSTALL M4_STACK_INSTALL
ENV STACK_WORKDIR M4_STACK_WORKDIR

## Copy across stack.yaml
RUN mkdir -p $STACK_WORKDIR
WORKDIR $STACK_WORKDIR
ADD stack.yaml $STACK_WORKDIR/stack.yaml
ADD dummy.cabal $STACK_WORKDIR/dummy.cabal

## Some common libraries
RUN $STACK_INSTALL \
    SHA \
    base64-bytestring \
    byteable \
    cereal \
    cmdargs \
    digest \
    dlist \
    extra \
    hslua \
    mtl \
    cryptonite \
    happy \
    network \
    primitive \
    socks \
    stm \
    async \
    strict \
    transformers-compat \
    exceptions \
    mmorph \
    attoparsec \
    semigroups \
    haskell-src-exts


# Current identity file
IdentityFile ~/.ssh/keys/identity

# Allow local commands to run from ~C !command
PermitLocalCommand yes

# Keepalive the connection by sending a keepalive message every 5 minutes
# Timeout only if there's no response after 2 tries
ServerAliveInterval 300
ServerAliveCountMax 2

m4_ifelse(PH_SYSTEM, CYGWIN, ,
    # Allow sharing of already existing connections (only for non-Cygwin)
    ControlMaster auto
    ControlPath /tmp/ssh-control:%h:%p:%r
)

Include hosts

Disable host authentication for localhost

# Current identity file
IdentityFile ~/.ssh/keys/identity

# Allow local commands to run from ~C !command
PermitLocalCommand yes

# Keepalive the connection by sending a keepalive message every 5 minutes
# Timeout only if there's no response after 2 tries
ServerAliveInterval 300
ServerAliveCountMax 2

m4_ifelse(PH_SYSTEM, CYGWIN, ,
    # Allow sharing of already existing connections (only for non-Cygwin)
    ControlMaster auto
    ControlPath /tmp/ssh-control:%h:%p:%r
)

# Disable host authentication for localhost addresses
NoHostAuthenticationForLocalhost yes

Include hosts


dnl -------------------------------------------------------------
dnl Triangle Delaunay triangulation library by J.R. Shewchuk
dnl -------------------------------------------------------------
AC_DEFUN([CONFIGURE_TRIANGLE],
[
  AC_ARG_ENABLE(triangle,
                AS_HELP_STRING([--disable-triangle],
                               [build without Triangle Delaunay triangulation library support]),
                [AS_CASE("${enableval}",
                         [yes], [enabletriangle=yes],
                         [no],  [enabletriangle=no],
                         [AC_MSG_ERROR(bad value ${enableval} for --enable-triangle)])],
                [enabletriangle=$enableoptional])

  dnl The TRIANGLE API is distributed with libmesh, so we don't have to guess
  dnl where it might be installed...
  AS_IF([test "x$enabletriangle" = "xyes"],
        [
          TRIANGLE_INCLUDE="-I\$(top_srcdir)/contrib/triangle"
          TRIANGLE_LIBRARY="\$(EXTERNAL_LIBDIR)/libtriangle\$(libext)"
          AC_DEFINE(HAVE_TRIANGLE, 1, [Flag indicating whether the library will be compiled with Triangle support])
          AC_MSG_RESULT(<<< Configuring library with Triangle support >>>)
        ],
        [
          TRIANGLE_INCLUDE=""
          TRIANGLE_LIBRARY=""
          enabletriangle=no
        ])

  AC_SUBST(TRIANGLE_INCLUDE)
  AC_SUBST(TRIANGLE_LIBRARY)
])

Disable Triangle in quad precision

dnl -------------------------------------------------------------
dnl Triangle Delaunay triangulation library by J.R. Shewchuk
dnl -------------------------------------------------------------
AC_DEFUN([CONFIGURE_TRIANGLE],
[
  AC_ARG_ENABLE(triangle,
                AS_HELP_STRING([--disable-triangle],
                               [build without Triangle Delaunay triangulation library support]),
                [AS_CASE("${enableval}",
                         [yes], [enabletriangle=yes],
                         [no],  [enabletriangle=no],
                         [AC_MSG_ERROR(bad value ${enableval} for --enable-triangle)])],
                [enabletriangle=$enableoptional])

  AS_IF([test "x$enabletriangle" = "xyes" &&
         test "x$enablequadrupleprecision" != "xno"],
        [enabletriangle=no
         AC_MSG_RESULT(<<< Disabling Triangle support due to quadruple precision >>>)
        ], [])

  dnl The TRIANGLE API is distributed with libmesh, so we don't have to guess
  dnl where it might be installed...
  AS_IF([test "x$enabletriangle" = "xyes"],
        [
          TRIANGLE_INCLUDE="-I\$(top_srcdir)/contrib/triangle"
          TRIANGLE_LIBRARY="\$(EXTERNAL_LIBDIR)/libtriangle\$(libext)"
          AC_DEFINE(HAVE_TRIANGLE, 1, [Flag indicating whether the library will be compiled with Triangle support])
          AC_MSG_RESULT(<<< Configuring library with Triangle support >>>)
        ],
        [
          TRIANGLE_INCLUDE=""
          TRIANGLE_LIBRARY=""
          enabletriangle=no
        ])

  AC_SUBST(TRIANGLE_INCLUDE)
  AC_SUBST(TRIANGLE_LIBRARY)
])


AC_DEFUN([DETECT_BYTEORDER],
[
    AC_REQUIRE([AC_C_BIGENDIAN])
    AC_CACHE_CHECK([for htonll], [ac_cv_have_htonll],
        [AC_TRY_COMPILE([
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
                        ], [
return htonll(0);
                        ],
                        [ ac_cv_have_htonll=yes ],
                        [ ac_cv_have_htonll=no ])
        ])
    AS_IF([test "x$ac_cv_have_htonll" = "xyes"],[
          AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])])

    AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$ac_cv_have_htonll" = "xno"])
])

Fix ntohll test.. we need to link, not just compile ;-)

AC_DEFUN([DETECT_BYTEORDER],
[
    AC_REQUIRE([AC_C_BIGENDIAN])
    AC_CACHE_CHECK([for htonll], [ac_cv_have_htonll],
        [AC_TRY_LINK([
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
                        ], [
return htonll(0);
                        ],
                        [ ac_cv_have_htonll=yes ],
                        [ ac_cv_have_htonll=no ])
        ])
    AS_IF([test "x$ac_cv_have_htonll" = "xyes"],[
          AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])])

    AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$ac_cv_have_htonll" = "xno"])
])


m4_include(env_config.m4)m4_dnl
m4_ifdef(??[[<<m4_env_config_DISPLAY_NAME>>]]??,m4_dnl
Section "Monitor"
	Identifier		"m4_env_config_DISPLAY_NAME"
	DisplaySize		m4_env_config_DISPLAY_DIMS
EndSection)

m4_ifdef(??[[<<m4_env_config_BATTERY_0>>]]??,m4_dnl Use defaults for desktop
# Set laptop screens to turn off after 2 minutes of inactivity
Section "ServerLayout"
	Identifier "Main Layout"
	Option "StandByTime" "2"
	Option "SuspendTime" "2"
	Option "OffTime" "2"
EndSection)

Increase laptop inactivity timer to 5 minutes

m4_include(env_config.m4)m4_dnl
m4_ifdef(??[[<<m4_env_config_DISPLAY_NAME>>]]??,m4_dnl
Section "Monitor"
	Identifier		"m4_env_config_DISPLAY_NAME"
	DisplaySize		m4_env_config_DISPLAY_DIMS
EndSection)

m4_ifdef(??[[<<m4_env_config_BATTERY_0>>]]??,m4_dnl Use defaults for desktop
# Set laptop screens to turn off after a few minutes of inactivity
Section "ServerLayout"
	Identifier "Main Layout"
	Option "StandByTime" "5"
	Option "SuspendTime" "5"
	Option "OffTime" "5"
EndSection)


# vim: ft=gitconfig
[alias]
	alias = !git config --global --list | grep ^alias
	amend = commit --all --amend
	br = branch
	ci = commit
	co = checkout
	ctags = !.git/hooks/ctags
	hist = log --graph --pretty=format:'%Cred%h%Creset %Cblue%ad%Creset %s %Cgreen[%an] %C(auto)%d%Creset' --date=DF_GIT_DATE_FORMAT
	st = status
[log]
	date = iso
[rebase]
	autoSquash = true
ifdef(`DF_GIT_VERSION_21', `dnl
[push]
	default = simple
', `')dnl
[core]
	autocrlf = input
[grep]
	lineNumber = true
	patternType = perl
[merge]
	conflictStyle = diff3
	tool = vimdiff
[init]
	templatedir = ~/.dotfiles/git_template
[color]
	ui = auto
[include]
	path = ~/.gitconfig_local

Change git grep.patternType to extended

# vim: ft=gitconfig
[alias]
	alias = !git config --global --list | grep ^alias
	amend = commit --all --amend
	br = branch
	ci = commit
	co = checkout
	ctags = !.git/hooks/ctags
	hist = log --graph --pretty=format:'%Cred%h%Creset %Cblue%ad%Creset %s %Cgreen[%an] %C(auto)%d%Creset' --date=DF_GIT_DATE_FORMAT
	st = status
[log]
	date = iso
[rebase]
	autoSquash = true
ifdef(`DF_GIT_VERSION_21', `dnl
[push]
	default = simple
', `')dnl
[core]
	autocrlf = input
[grep]
	lineNumber = true
	patternType = extended
[merge]
	conflictStyle = diff3
	tool = vimdiff
[init]
	templatedir = ~/.dotfiles/git_template
[color]
	ui = auto
[include]
	path = ~/.gitconfig_local


dnl Check a program for version sanity. The test runs a program, passes it an
dnl argument to make it print out some identification string, and filters that
dnl output with a regular expression. If the output is non-empty, the program
dnl passes the sanity check.
dnl   $1 - Name or full path of the program to run
dnl   $2 - Argument to pass to print out identification string
dnl   $3 - grep RE to match identification string
dnl   $4 - set to 1 to make errors only a warning
AC_DEFUN([CHECK_PROGRAM_SANITY],
[
AC_MSG_CHECKING([sanity for program ]$1)
sanity_path=`which $1 2>/dev/null`
if test "$?" -eq 0 -a -x "$sanity_path" ; then
  sanity=`$1 $2 2>&1 | grep "$3"`
  if test -z "$sanity" ; then
    AC_MSG_RESULT([no])
    sanity="0"
    if test "$4" -eq 1 ; then
      AC_MSG_WARN([Program ]$1[ failed to pass sanity check.])
    else
      AC_MSG_ERROR([Program ]$1[ failed to pass sanity check.])
    fi
  else
    AC_MSG_RESULT([yes])
    sanity="1"
  fi
else
  AC_MSG_RESULT([not found])
fi
])

Fix a configure warning noticed by Duncan Sands.

dnl Check a program for version sanity. The test runs a program, passes it an
dnl argument to make it print out some identification string, and filters that
dnl output with a regular expression. If the output is non-empty, the program
dnl passes the sanity check.
dnl   $1 - Name or full path of the program to run
dnl   $2 - Argument to pass to print out identification string
dnl   $3 - grep RE to match identification string
dnl   $4 - set to 1 to make errors only a warning
AC_DEFUN([CHECK_PROGRAM_SANITY],
[
AC_MSG_CHECKING([sanity for program ]$1)
sanity="0"
sanity_path=`which $1 2>/dev/null`
if test "$?" -eq 0 -a -x "$sanity_path" ; then
  sanity=`$1 $2 2>&1 | grep "$3"`
  if test -z "$sanity" ; then
    AC_MSG_RESULT([no])
    sanity="0"
    if test "$4" -eq 1 ; then
      AC_MSG_WARN([Program ]$1[ failed to pass sanity check.])
    else
      AC_MSG_ERROR([Program ]$1[ failed to pass sanity check.])
    fi
  else
    AC_MSG_RESULT([yes])
    sanity="1"
  fi
else
  AC_MSG_RESULT([not found])
fi
])


#
# urbi-win32.m4: This file is part of build-aux.
# Copyright (C) 2006-2008, Gostai S.A.S.
#
# This software is provided "as is" without warranty of any kind,
# either expressed or implied, including but not limited to the
# implied warranties of fitness for a particular purpose.
#
# See the LICENSE file for more information.
# For comments, bug reports and feedback: http://www.urbiforge.com
#

# URBI_WIN32
# ----------
# Look for windows. Define the automake conditional WIN32 as well
# as $windows.
AC_DEFUN([URBI_WIN32],
[AC_CHECK_HEADERS([windows.h], [windows=true], [windows=false])
AM_CONDITIONAL([WIN32], [$windows])

case $host_alias in
     (*mingw*)
       # Remove windows-style paths from dependencies files
       AC_CONFIG_COMMANDS([mingw-fix-path],
           [sed -i \
              "/mv.*Pl\?o$/{;s/$/;\\\\/;p;s/;\\$//;s,.*\.Tpo \(.*\),	sed -i s/c:\\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\\/g \1,;};" \
              Makefile
            ])
     ;;
esac
])

Fix mingw build: do not ignore compilation errors.

#
# urbi-win32.m4: This file is part of build-aux.
# Copyright (C) 2006-2008, Gostai S.A.S.
#
# This software is provided "as is" without warranty of any kind,
# either expressed or implied, including but not limited to the
# implied warranties of fitness for a particular purpose.
#
# See the LICENSE file for more information.
# For comments, bug reports and feedback: http://www.urbiforge.com
#

# URBI_WIN32
# ----------
# Look for windows. Define the automake conditional WIN32 as well
# as $windows.
AC_DEFUN([URBI_WIN32],
[AC_CHECK_HEADERS([windows.h], [windows=true], [windows=false])
AM_CONDITIONAL([WIN32], [$windows])

case $host_alias in
     (*mingw*)
       # Remove windows-style paths from dependencies files
       AC_CONFIG_COMMANDS([mingw-fix-path],
           [sed -i \
              "/mv.*Pl\?o$/{;h;s/$/ \\&\\&\\\\/;p;g;s,.*\.Tpo \(.*\),	sed -i s/c:\\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\\/g \1,;};" \
              Makefile
            ])
     ;;
esac
])


dnl @synopsis AX_THRIFT_GEN(SHORT_LANGUAGE, LONG_LANGUAGE, DEFAULT)
dnl
dnl Allow a particular language generator to be disabled.
dnl
dnl This macro has poor error handling and is poorly documented.
dnl It is intended only for internal use by the Thrift compiler.
dnl
dnl @author David Reiss <dreiss@facebook.com>
dnl @version 2008-02-20
dnl @license AllPermissive

AC_DEFUN([AX_THRIFT_GEN],
         [
          AC_ARG_ENABLE([gen-$1],
                        AC_HELP_STRING([--enable-gen-$1], [Enable the $2 compiler.  Default is $3]),
                        [ax_thrift_gen_$1="$enableval"],
                        [ax_thrift_gen_$1=$3]
                        )
          dnl I'd like to run the AM_CONDITIONAL here, but automake likes
          dnl all AM_CONDITIONALs to be nice and explicit in configure.ac.
          dnl AM_CONDITIONAL([THRIFT_GEN_$1], [test "$ax_thrift_gen_$1" = "yes"])
         ])

Make the configure help more consistent.

dnl @synopsis AX_THRIFT_GEN(SHORT_LANGUAGE, LONG_LANGUAGE, DEFAULT)
dnl
dnl Allow a particular language generator to be disabled.
dnl
dnl This macro has poor error handling and is poorly documented.
dnl It is intended only for internal use by the Thrift compiler.
dnl
dnl @author David Reiss <dreiss@facebook.com>
dnl @version 2008-02-20
dnl @license AllPermissive

AC_DEFUN([AX_THRIFT_GEN],
         [
          AC_ARG_ENABLE([gen-$1],
                        AC_HELP_STRING([--enable-gen-$1], [enable the $2 compiler @<:@default=$3@:>@]),
                        [ax_thrift_gen_$1="$enableval"],
                        [ax_thrift_gen_$1=$3]
                        )
          dnl I'd like to run the AM_CONDITIONAL here, but automake likes
          dnl all AM_CONDITIONALs to be nice and explicit in configure.ac.
          dnl AM_CONDITIONAL([THRIFT_GEN_$1], [test "$ax_thrift_gen_$1" = "yes"])
         ])


AC_DEFUN([FIBRIL_IF_ENABLED_NOHELP],[
case "$enable_[]patsubst([$1], -, _)" in
  '' | no) :
      $3 ;;
  *)  $2 ;;
esac
])

AC_DEFUN([FIBRIL_IF_ENABLED],[
AC_MSG_CHECKING(whether to enable $1)
AC_ARG_ENABLE($1,AS_HELP_STRING(enable-$1,[$2]))
FIBRIL_IF_ENABLED_NOHELP([$1],[$3],[$4])
AC_MSG_RESULT($enable_[]patsubst([$1], -, _))
])

Add "--" before enable-debug in help.

AC_DEFUN([FIBRIL_IF_ENABLED_NOHELP],[
case "$enable_[]patsubst([$1], -, _)" in
  '' | no) :
      $3 ;;
  *)  $2 ;;
esac
])

AC_DEFUN([FIBRIL_IF_ENABLED],[
AC_MSG_CHECKING(whether to enable $1)
AC_ARG_ENABLE($1,AS_HELP_STRING(--enable-$1,[$2]))
FIBRIL_IF_ENABLED_NOHELP([$1],[$3],[$4])
AC_MSG_RESULT($enable_[]patsubst([$1], -, _))
])


dnl Check for lcov utility

AC_DEFUN([SALUT_LCOV],
[
  AC_PATH_PROG(LCOV_PATH, [lcov], [no])

  if test X$LCOV_PATH != Xno ; then
    AC_MSG_CHECKING([whether lcov accepts --compat-libtool])
    if $LCOV_PATH --compat-libtool --help > /dev/null 2>&1 ; then
      AC_MSG_RESULT(ok)
    else
      AC_MSG_WARN([lcov option --compat-libtool is not supported])
      AC_MSG_WARN([update lcov to version > 1.5])
      LCOV_PATH=no
    fi
  fi

  if test X$LCOV_PATH == Xno ; then
    AC_MSG_WARN([will use an internal lcov copy])
    LCOV_PATH='$(top_srcdir)/scripts/lcov/lcov'
  fi
])

Print 'no' when checking for the lcov executable

dnl Check for lcov utility

AC_DEFUN([SALUT_LCOV],
[
  AC_PATH_PROG(LCOV_PATH, [lcov], [no])

  if test X$LCOV_PATH != Xno ; then
    AC_MSG_CHECKING([whether lcov accepts --compat-libtool])
    if $LCOV_PATH --compat-libtool --help > /dev/null 2>&1 ; then
      AC_MSG_RESULT(ok)
    else
      AC_MSG_RESULT(no)
      AC_MSG_WARN([lcov option --compat-libtool is not supported])
      AC_MSG_WARN([update lcov to version > 1.5])
      LCOV_PATH=no
    fi
  fi

  if test X$LCOV_PATH == Xno ; then
    AC_MSG_WARN([will use an internal lcov copy])
    LCOV_PATH='$(top_srcdir)/scripts/lcov/lcov'
  fi
])


# ==================== Ragel ====================
AC_DEFUN([CHECK_RAGEL],
[
  AC_ARG_WITH([ragel],
              [  --with-ragel=PROG ragel executable],
              [ragel="$withval"],[ragel=no])
  if test "$ragel" != "no"; then
    AC_MSG_NOTICE([Using ragel: $ragel])
    AC_SUBST(RAGEL)
  else
    AC_PATH_PROG([RAGEL], ragel)
  fi

  if test "x$RAGEL" != "x" ; then
	  exactRagelVersion=[$1]
	  AC_MSG_CHECKING([for exact version $ragelVersion])

	  ragelVersion=`$RAGEL --version | awk '{print $ 6}'`

	  AX_COMPARE_VERSION([$ragelVersion],[eq],[$exactRagelVersion],
	       [AC_MSG_RESULT($ragelVersion is ok)],
	       [
		   		AC_MSG_WARN([ragel version must be == $exactRagelVersion - found $ragelVersion])
				RAGEL=""
		   ]
	  )
  fi
  AC_SUBST(RAGEL)
])

Remove extraneous output produced by last commit.

# ==================== Ragel ====================
AC_DEFUN([CHECK_RAGEL],
[
  AC_ARG_WITH([ragel],
              [  --with-ragel=PROG ragel executable],
              [ragel="$withval"],[ragel=no])
  if test "$ragel" != "no"; then
    AC_MSG_NOTICE([Using ragel: $ragel])
    AC_SUBST(RAGEL)
  else
    AC_PATH_PROG([RAGEL], ragel)
  fi

  if test "x$RAGEL" != "x" ; then
	  exactRagelVersion=[$1]
	  AC_MSG_CHECKING([for exact version $ragelVersion])

	  ragelVersion=`$RAGEL --version | head -1 | awk '{print $ 6}'`

	  AX_COMPARE_VERSION([$ragelVersion],[eq],[$exactRagelVersion],
	       [AC_MSG_RESULT($ragelVersion is ok)],
	       [
		   		AC_MSG_WARN([ragel version must be == $exactRagelVersion - found $ragelVersion])
				RAGEL=""
		   ]
	  )
  fi
  AC_SUBST(RAGEL)
])


AC_DEFUN([BANSHEE_CHECK_GDATA],
[
	GDATASHARP_REQUIRED_VERSION=1.4
	AC_SUBST(GDATASHARP_REQUIRED_VERSION)

	AC_ARG_ENABLE(gdata, AC_HELP_STRING([--enable-gdata], [Enable experimental Youtube extension - unfinished, likely broken]), , enable_gdata="no")

	if test "x$enable_gdata" = "xyes"; then
		PKG_CHECK_MODULES(GDATASHARP,
			gdata-sharp-core >= $GDATASHARP_REQUIRED_VERSION
			gdata-sharp-youtube >= $GDATASHARP_REQUIRED_VERSION)
		AC_SUBST(GDATASHARP_LIBS)
		AM_CONDITIONAL(HAVE_GDATA, true)
	else
		AM_CONDITIONAL(HAVE_GDATA, false)
	fi
])

Build YouTube extension by default

AC_DEFUN([BANSHEE_CHECK_GDATA],
[
	GDATASHARP_REQUIRED_VERSION=1.4
	AC_SUBST(GDATASHARP_REQUIRED_VERSION)

	AC_ARG_ENABLE(gdata, AC_HELP_STRING([--disable-gdata], [Disable Youtube extension]), , enable_gdata="yes")

	if test "x$enable_gdata" = "xyes"; then
		PKG_CHECK_MODULES(GDATASHARP,
			gdata-sharp-core >= $GDATASHARP_REQUIRED_VERSION
			gdata-sharp-youtube >= $GDATASHARP_REQUIRED_VERSION)
		AC_SUBST(GDATASHARP_LIBS)
		AM_CONDITIONAL(HAVE_GDATA, true)
	else
		AM_CONDITIONAL(HAVE_GDATA, false)
	fi
])


dnl Check for lcov utility

AC_DEFUN([WOCKY_LCOV],
[
  AC_PATH_PROG(LCOV_PATH, [lcov], [no])

  if test X$LCOV_PATH != Xno ; then
    AC_MSG_CHECKING([whether lcov accepts --compat-libtool])
    if $LCOV_PATH --compat-libtool --help > /dev/null 2>&1 ; then
      AC_MSG_RESULT(ok)
    else
      AC_MSG_WARN([lcov option --compat-libtool is not supported])
      AC_MSG_WARN([update lcov to version > 1.5])
      LCOV_PATH=no
    fi
  fi

  if test X$LCOV_PATH == Xno ; then
    AC_MSG_WARN([will use an internal lcov copy])
    LCOV_PATH='$(top_srcdir)/scripts/lcov/lcov'
  fi
])

Print 'no' when checking for the lcov executable

dnl Check for lcov utility

AC_DEFUN([WOCKY_LCOV],
[
  AC_PATH_PROG(LCOV_PATH, [lcov], [no])

  if test X$LCOV_PATH != Xno ; then
    AC_MSG_CHECKING([whether lcov accepts --compat-libtool])
    if $LCOV_PATH --compat-libtool --help > /dev/null 2>&1 ; then
      AC_MSG_RESULT(ok)
    else
      AC_MSG_RESULT(no)
      AC_MSG_WARN([lcov option --compat-libtool is not supported])
      AC_MSG_WARN([update lcov to version > 1.5])
      LCOV_PATH=no
    fi
  fi

  if test X$LCOV_PATH == Xno ; then
    AC_MSG_WARN([will use an internal lcov copy])
    LCOV_PATH='$(top_srcdir)/scripts/lcov/lcov'
  fi
])


#
# Provide the arguments and other processing needed for an LLVM project
#
AC_DEFUN([LLVM_CONFIG_PROJECT],
  [AC_ARG_WITH([llvmsrc],
    AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),
    [llvm_src="$withval"],[llvm_src=`cd ${srcdir}/../..; pwd`])
  AC_SUBST(LLVM_SRC,$llvm_src)
  AC_ARG_WITH([llvmobj],
    AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),
    [llvm_obj="$withval"],[llvm_obj=`cd ../..; pwd`])
  AC_SUBST(LLVM_OBJ,$llvm_obj)
  AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"])
])

Make it possible to default the llvm_src and llvm_obj variables based on the arguments to the macro. This better supports the AutoRegen.sh script in projects/sample/autoconf.

#
# Provide the arguments and other processing needed for an LLVM project
#
AC_DEFUN([LLVM_CONFIG_PROJECT],
  [AC_ARG_WITH([llvmsrc],
    AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),
    [llvm_src="$withval"],[llvm_src="]$1["])
  AC_SUBST(LLVM_SRC,$llvm_src)
  AC_ARG_WITH([llvmobj],
    AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),
    [llvm_obj="$withval"],[llvm_obj="]$2["])
  AC_SUBST(LLVM_OBJ,$llvm_obj)
  AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"])
])


define(`COMMON_DEPS', `base
                     , HTTP
                     , MissingH
                     , aeson
                     , attoparsec
                     , bytestring
                     , either
                     , hslogger
                     , mtl
                     , network
                     , old-time
                     , optparse-applicative
                     , process
                     , scotty
                     , split
                     , system-fileio
                     , system-filepath
                     , template-haskell
                     , temporary
                     , text
                     , unix
                     , vector')dnl
name:                gratte-papier
version:             0.2.0.0
synopsis:            Command-line tool to facilitate document archive via OCR.
license:             MIT
license-file:        LICENSE
author:              Thomas Franquelin
build-type:          Simple
cabal-version:       >=1.10

executable gratte-papier
  ghc-options:       -Wall
  main-is:           Main.hs
  hs-source-dirs:    src
  build-depends:     COMMON_DEPS

executable gratte-server
  ghc-options:       -Wall
  main-is:           Server.hs
  hs-source-dirs:    src
  build-depends:     COMMON_DEPS

test-suite integration
  type:              exitcode-stdio-1.0
  main-is:           Suite.hs
  hs-source-dirs:    tests/integration
                     , src
                     , tests/

  build-depends:     COMMON_DEPS
                   , hspec

Put upper bound on optparse-applicative

define(`COMMON_DEPS', `base
                     , HTTP
                     , MissingH
                     , aeson
                     , attoparsec
                     , bytestring
                     , either
                     , hslogger
                     , mtl
                     , network
                     , old-time
                     , optparse-applicative ==0.9.1.1
                     , process
                     , scotty
                     , split
                     , system-fileio
                     , system-filepath
                     , template-haskell
                     , temporary
                     , text
                     , unix
                     , vector')dnl
name:                gratte-papier
version:             0.2.0.0
synopsis:            Command-line tool to facilitate document archive via OCR.
license:             MIT
license-file:        LICENSE
author:              Thomas Franquelin
build-type:          Simple
cabal-version:       >=1.10

executable gratte-papier
  ghc-options:       -Wall
  main-is:           Main.hs
  hs-source-dirs:    src
  build-depends:     COMMON_DEPS

executable gratte-server
  ghc-options:       -Wall
  main-is:           Server.hs
  hs-source-dirs:    src
  build-depends:     COMMON_DEPS

test-suite integration
  type:              exitcode-stdio-1.0
  main-is:           Suite.hs
  hs-source-dirs:    tests/integration
                     , src
                     , tests/

  build-depends:     COMMON_DEPS
                   , hspec