Autotools machinery.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Tue, 2 Feb 2010 22:06:52 +0000 (17:06 -0500)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Tue, 2 Feb 2010 22:06:52 +0000 (17:06 -0500)
Makefile.am [new file with mode: 0644]
bootstrap.sh [new file with mode: 0755]
cleanup.sh [new file with mode: 0755]
configure.in [new file with mode: 0644]
m4/ax_gcc_plugin.m4 [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]

diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100755 (executable)
index 0000000..b8d07ec
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -x
+
+mkdir -p config
+
+# Create an aclocal file with macros for libtool.
+touch aclocal.m4
+
+if [ -e /usr/local/share/aclocal/libtool.m4 ]
+then
+       cat /usr/local/share/aclocal/libtool.m4 >> aclocal.m4
+fi
+
+if [ -e /usr/share/aclocal/libtool.m4 ]
+then
+       cat /usr/share/aclocal/libtool.m4 >> aclocal.m4
+fi
+
+libtoolize --copy
+aclocal
+autoheader
+automake --gnu --add-missing
+autoconf
+
+cp -r config config.new
+rm -rf config
+mv config.new config
diff --git a/cleanup.sh b/cleanup.sh
new file mode 100755 (executable)
index 0000000..2fe42ab
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# Clean up _everything_, especially the files generated by
+# bootstrap.sh.  Do not run this from outside the source directory: it
+# could delete your files!
+
+# Files to preserve:
+#./COPYING
+#./INSTALL
+#./NEWS
+#./README
+#./ChangeLog
+#./AUTHORS
+#./bootstrap.sh
+#./cleanup.sh
+#./Makefile.am
+#./configure.in
+
+set -x
+
+make clean
+make distclean
+
+rm -f .in
+rm -f config.h.in
+rm -f config.h
+
+rm -f aclocal.m4
+rm -rf autom4te.cache
+rm -f stamp-h1
+
+rm -rf config
+
+rm -f libtool
+
+rm -f configure
+rm -f config.log config.status
+
+rm -f Makefile
+rm -f Makefile.in
+
+SRC_DIRS="src"
+
+for DIR in $SRC_DIRS
+do
+    rm -f $DIR/Makefile.in
+    rm -f $DIR/Makefile
+    rm -rf $DIR/.deps
+    rm -rf $DIR/.libs
+done
diff --git a/configure.in b/configure.in
new file mode 100644 (file)
index 0000000..4077534
--- /dev/null
@@ -0,0 +1,26 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT(InterAspect, 0.9.0)
+AC_CONFIG_SRCDIR([src/aop-main.c])
+# Note that we do not generate a config.h because GCC already uses a
+# config.h that plugins must include.
+#AC_CONFIG_HEADER([config.h])
+AC_CONFIG_AUX_DIR(config)
+
+m4_include(m4/ax_gcc_plugin.m4)
+
+AM_INIT_AUTOMAKE
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+# Get the plugin includes directory.
+AX_GCC_PLUGIN
+
+AC_CONFIG_FILES([Makefile
+                 src/Makefile])
+
+AC_OUTPUT
diff --git a/m4/ax_gcc_plugin.m4 b/m4/ax_gcc_plugin.m4
new file mode 100644 (file)
index 0000000..c259a8c
--- /dev/null
@@ -0,0 +1,64 @@
+# SYNOPSIS
+#
+#   AX_GCC_PLUGIN
+#
+# DESCRIPTION
+#
+#   This macro locates the headers necessary to compile a GCC plug-in.
+#
+#   If the --with-gcc-includes option is set to a directory, the macro
+#   checks for the tree.def header in that directory.  Otherwise, it
+#   looks for the include directory belonging to the actual build
+#   compiler (speified with CC).
+#
+#   AX_GCC_PLUGIN() fails with an error if it cannot find tree.def.
+#
+#   This macro calls:
+#
+#     AC_SUBST(gcc_includes)
+#
+# LICENSE
+#
+#    Copyright (c) 2009 Stony Brook University
+#
+#   Copying and distribution of this file, with or without
+#   modification, are permitted in any medium without royalty provided
+#   the copyright notice and this notice are preserved.
+
+AC_DEFUN([AX_GCC_PLUGIN],
+[
+  AC_ARG_WITH(
+    [gcc_includes],
+    AC_HELP_STRING([--with-gcc-includes], [Full path to directory with gcc plug-in header files. By default configure will ask GCC for this directory.]),
+    [gcc_includes=$withval],
+    [gcc_includes=`"$CC" -print-file-name=plugin`/include])
+
+  # Don't let the user specify --with-gcc-includes=no or --without-gcc-includes.
+  # That's bogus.
+  AS_IF(
+    [test "x$gcc_includes" == xno],
+    AC_MSG_FAILURE([Plug-ins cannot compile without a plug-in includes directory.]))
+
+  # If you ask a pre-plug-in GCC for the plug-in includes directory,
+  # it just returns "plugin"
+  AS_IF(
+    [test "x$gcc_includes" == xplugin/include],
+    AC_MSG_FAILURE([Bad plugin directory.  It looks like you are not using a plug-in-capable GCC.]))
+
+  # Make sure the path looks like an absolute path.
+  case "$gcc_includes" in
+      /*) ;;
+      ~*) ;;
+      *)
+          gcc_includes==`pwd`/$gcc_includes
+          ;;
+  esac
+
+  # Final check.  Did we actually find a directory with plug-in header files?
+  AS_IF(
+    [test "x$gcc_includes" == x -o ! -f "$gcc_includes/tree.def"],
+    AC_MSG_FAILURE([Cannot find plug-in headers in $gcc_includes]))
+
+  AC_MSG_NOTICE([Using GCC headers at $gcc_includes])
+  AC_SUBST([gcc_includes], [$gcc_includes])
+])
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..3d327f8
--- /dev/null
@@ -0,0 +1,4 @@
+lib_LTLIBRARIES = libinteraspect.la
+libinteraspect_la_SOURCES = aop-main.c
+libinteraspect_la_LDFLAGS = -version-info 1:0:0
+libinteraspect_la_CPPFLAGS = -DHAVE_CONFIG_H -DIN_GCC -I$(gcc_includes)