diff --git a/.gitignore b/.gitignore
index 40bf394d6b40af3a9daa7838541df2c41cded157..4868b2d33fec92b5959c28ff9e63297d62090ea6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,5 +6,15 @@ build/trapping/*
 build/libnptm/*
 containers/singularity/*.sif
 doc/build/*
+src/aclocal.m4
+src/autom4te.cache
+src/config.*
+src/configure
+src/configure~
+src/libtool
+src/m4
+src/Makefile
+src/Makefile.in
+src/*/.deps
 src/*/objects/*
 src/*/dynobjects/*
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..037d6dc3f4716f90fd53dc30849636760ed2eb42
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,16 @@
+AUTOMAKE_OPTIONS=subdir-objects
+lib_LTLIBRARIES=libnptm.la
+libnptm_la_SOURCES=libnptm/algebraic.cpp libnptm/clu_subs.cpp libnptm/Commons.cpp libnptm/Configuration.cpp libnptm/file_io.cpp libnptm/lapack_calls.cpp libnptm/logging.cpp libnptm/magma_calls.cpp libnptm/Parsers.cpp libnptm/sph_subs.cpp libnptm/tfrfme.cpp libnptm/TransitionMatrix.cpp libnptm/tra_subs.cpp libnptm/types.cpp
+bin_PROGRAMS=edfb_clu clu np_cluster edfb_sph sph np_sphere frfme lffft np_trapping
+edfb_clu_SOURCES=cluster/edfb_clu.f
+clu_SOURCES=cluster/clu.f
+np_cluster_SOURCES=cluster/np_cluster.cpp cluster/cluster.cpp
+edfb_sph_SOURCES=sphere/edfb_sph.f
+sph_SOURCES=sphere/sph.f
+np_sphere_SOURCES=sphere/np_sphere.cpp sphere/sphere.cpp
+frfme_SOURCES=trapping/frfme.f
+lffft_SOURCES=trapping/lffft.f
+np_trapping_SOURCES=trapping/np_trapping.cpp trapping/cfrfme.cpp trapping/clffft.cpp
+check_PROGRAMS=test_TEDF test_TTMS
+test_TEDF_SOURCES=testing/test_TEDF.cpp
+test_TTMS_SOURCES=testing/test_TTMS.cpp
diff --git a/src/configure.ac b/src/configure.ac
new file mode 100644
index 0000000000000000000000000000000000000000..57f5b735964079bcebd32985d40fd552e8efa735
--- /dev/null
+++ b/src/configure.ac
@@ -0,0 +1,46 @@
+# CAPABILITY TESTING MACROS
+
+# END CAPABILITY TESTING MACROS
+
+# autoconf setup initialization
+AC_INIT([np_tmcode], [8.04], [giovanni.lamura@inaf.it])
+
+# Folder structure safety check
+AC_CONFIG_SRCDIR([libnptm/TransitionMatrix.cpp])
+
+# Auxiliary build folder
+AC_CONFIG_AUX_DIR([../build/aux])
+
+# automake initialization
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+
+# Compiler detection
+AM_PROG_AR
+AC_PROG_F77([mpif90 gfortran f77])
+AC_PROG_CXX([mpicxx g++ clang])
+
+# Libtool initialization
+LT_INIT
+
+# Environment setup
+FFLAGS="-std=legacy -O3"
+CXXFLAGS="-O3 -ggdb -Wno-format-contains-nul"
+SUBDIRS="cluster libnptm sphere testing trapping"
+AS_IF(
+	[test "x$HDF5_INCLUDE" = "x"],
+	[export HDF5_INCLUDE=/usr/include/hdf5/serial],
+	[AC_MSG_NOTICE(["HDF5_INCLUDE=$HDF5_INCLUDE"])]
+)
+
+# Check for required headers
+AC_CHECK_HEADER(
+	[$HDF5_INCLUDE/hdf5.h],
+	,
+	AC_MSG_ERROR(["Could not find HDF5 headers!]),
+	)
+
+# Send output to Makefiles
+AC_CONFIG_FILES([Makefile])
+
+# Generate the output
+AC_OUTPUT