1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
diff --git a/Demo/Makefile.am b/Demo/Makefile.am
new file mode 100644
--- /dev/null
+++ b/Demo/Makefile.am
@@ -0,0 +1,53 @@
+AM_CPPFLAGS = -I$(top_srcdir)/Include $(SUITESPARSECONFIG_CFLAGS)
+LDADD = $(top_builddir)/Source/libamd.la
+
+EXTRA_DIST = \
+ amd_demo.out \
+ amd_demo2.out \
+ amd_l_demo.out \
+ amd_simple.out \
+ amd_f77cross.out \
+ amd_f77demo.out \
+ amd_f77simple.out
+
+# Disable the .out implicit pattern rule. Prevents GNU make from
+# adding bogus dependencies for the .out files listed above.
+%.out: %
+
+check_PROGRAMS = \
+ amd_demo \
+ amd_demo2 \
+ amd_l_demo \
+ amd_simple \
+ amd_f77cross \
+ amd_f77demo \
+ amd_f77simple
+
+amd_demo_SOURCES = amd_demo.c
+amd_demo2_SOURCES = amd_demo2.c
+amd_l_demo_SOURCES = amd_l_demo.c
+amd_simple_SOURCES = amd_simple.c
+
+check_LTLIBRARIES = libamd_f77wrapper.la
+libamd_f77wrapper_la_SOURCES = amd_f77wrapper.c
+libamd_f77wrapper_la_CPPFLAGS = $(AM_CPPFLAGS) -DDINT
+
+amd_f77cross_SOURCES = amd_f77cross.f
+amd_f77cross_LDADD = $(LDADD) $(top_builddir)/Source/libamdf77.la libamd_f77wrapper.la
+amd_f77demo_SOURCES = amd_f77demo.f
+amd_f77demo_LDADD = $(LDADD) $(top_builddir)/Source/libamdf77.la
+amd_f77simple_SOURCES = amd_f77simple.f
+amd_f77simple_LDADD = $(LDADD) $(top_builddir)/Source/libamdf77.la
+
+check-local: $(check_PROGRAMS) $(check_PROGRAMS:=.out)
+ @for i in $(check_PROGRAMS); do \
+ echo "Testing $$i"; \
+ ./$$i$(EXEEXT) > my_$$i.out; \
+ if diff -u $(srcdir)/$$i.out my_$$i.out; then \
+ echo "Test $$i PASSED."; \
+ else \
+ echo "Test $$i FAILED."; \
+ fi; \
+ done
+
+CLEANFILES = my_*.out
diff --git a/Doc/Makefile.am b/Doc/Makefile.am
new file mode 100644
--- /dev/null
+++ b/Doc/Makefile.am
@@ -0,0 +1,27 @@
+EXTRA_DIST = ChangeLog License lesser.txt
+
+dist_noinst_DATA = AMD_UserGuide.tex AMD_UserGuide.bib
+dist_pdf_DATA = AMD_UserGuide.pdf
+
+AMD_UserGuide.pdf AMD_UserGuide.aux: amd_h.tex
+.INTERMEDIATE: AMD_UserGuide.aux amd_h.tex
+
+%_h.tex: $(top_srcdir)/Include/%.h
+ echo '\begin{verbatim}' > $@
+ expand -8 $< >> $@
+ echo '\end{verbatim}' >> $@
+
+TEX = TEXINPUTS="$(srcdir):" pdflatex -interaction nonstopmode -file-line-error
+BIB = BIBINPUTS="$(srcdir):" bibtex
+%.pdf: %.tex %.bbl
+ $(TEX) $*
+ while grep -q "Rerun to get cross-references right" $*.log; do \
+ $(TEX) $*; \
+ done
+%.bbl: %.aux %.bib
+ $(BIB) $*
+%.aux: %.tex
+ $(TEX) $*
+
+CLEANFILES = *.aux *.bbl *.blg *.log *.toc *_h.tex
+MAINTAINERCLEANFILES = $(dist_pdf_DATA)
diff --git a/Include/Makefile.am b/Include/Makefile.am
new file mode 100644
--- /dev/null
+++ b/Include/Makefile.am
@@ -0,0 +1 @@
+pkginclude_HEADERS = amd.h amd_internal.h
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = Include Source Demo Doc
+EXTRA_DIST = README.txt
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = amd.pc
diff --git a/Source/Makefile.am b/Source/Makefile.am
new file mode 100644
--- /dev/null
+++ b/Source/Makefile.am
@@ -0,0 +1,33 @@
+AM_CPPFLAGS = -I$(top_srcdir)/Include $(SUITESPARSECONFIG_CFLAGS)
+
+AMDSRC = \
+ amd_1.c \
+ amd_2.c \
+ amd_aat.c \
+ amd_control.c \
+ amd_defaults.c \
+ amd_dump.c \
+ amd_info.c \
+ amd_order.c \
+ amd_postorder.c \
+ amd_post_tree.c \
+ amd_preprocess.c \
+ amd_valid.c
+
+lib_LTLIBRARIES = libamd.la libamdf77.la
+noinst_LTLIBRARIES = libamdi.la libamdl.la
+
+libamdi_la_SOURCES = $(AMDSRC)
+libamdi_la_LIBADD = -lm
+libamdi_la_CPPFLAGS = $(AM_CPPFLAGS) -DDINT
+
+libamdl_la_SOURCES = $(AMDSRC)
+libamdl_la_LIBADD = -lm
+libamdl_la_CPPFLAGS = $(AM_CPPFLAGS) -DDLONG
+
+libamd_la_SOURCES = amd_global.c
+libamd_la_LIBADD = libamdl.la libamdi.la
+libamd_la_LDFLAGS = -no-undefined -version-number 2:3:1
+
+libamdf77_la_SOURCES = amd.f amdbar.f
+libamdf77_la_LDFLAGS = -no-undefined -version-number 2:3:1
diff --git a/amd.pc.in b/amd.pc.in
new file mode 100644
--- /dev/null
+++ b/amd.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@
+Description: Approximate minimum degree ordering
+Version: @PACKAGE_VERSION@
+URL: @PACKAGE_URL@
+Requires.private: suitesparseconfig
+Libs: -L${libdir} -lamd
+Libs.private: -lm
+Cflags: -I${includedir}/amd
diff --git a/configure.ac b/configure.ac
new file mode 100644
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,44 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([AMD],[2.3.1],[DrTimothyAldenDavis@gmail.com],[amd],[http://www.suitesparse.com/])
+AC_CONFIG_SRCDIR([Source/amd_global.c])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([foreign])
+LT_INIT
+
+# Checks for programs.
+AC_PROG_INSTALL
+AC_PROG_CC
+AC_PROG_F77
+
+LIBS_SAVED=$LIBS
+
+# Checks for libraries.
+AC_CHECK_LIB([m], [sqrt])
+
+PKG_PROG_PKG_CONFIG
+PKG_CHECK_MODULES([SUITESPARSECONFIG],[suitesparseconfig],
+ [],
+ [AC_MSG_ERROR([cannot find suitesparseconfig])])
+
+# Checks for header files.
+AC_CHECK_HEADERS([limits.h stddef.h stdlib.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_CHECK_FUNCS([sqrt])
+
+LIBS=$LIBS_SAVED
+
+AC_CONFIG_FILES([
+ amd.pc
+ Makefile
+ Demo/Makefile
+ Doc/Makefile
+ Include/Makefile
+ Source/Makefile])
+AC_OUTPUT
|