-*- mode: org -*- Autoconf / Automake Workflow ============================ * Autoconf ** Write configure.ac - Create with autoscan (configure.scan), then edit and rename to configure.ac - AC_CHECK_LIB(library, function, action if found, action if not, others) - AC_SEARCH_LIBS(function, libdir, action if found, action if not, others) - AC_CHECK_FILE(file, action if found, action if not) ** Create configuration headers - Run `autoheader' ** Create the configure script - Run `autoconf' ** Write Makefile.in - Unless you use Automake - Insert `AC_CONFIG_FILES([path/to/Makefile])' before `AC_OUTPUT' * Automake ** Update the autoconf files - Insert `AM_INIT_AUTOMAKE' after AC_INIT in configure.ac - Ensure that `AC_CONFIG_FILES([path/to/Makefile])' and `AC_OUTPUT' is present - Rename aclocal.m4 to acinclude.m4 (if any) - Run aclocal && autoconf ** Manually write Makefile.am *** Header - Customary comment: ## Process this file with automake to produce Makefile.in *** Variables **** Special variables ***** Canonicalization - All `strange' characters (even -, +, .) are converted to underscores - E.g. libmumble++.a => libmumble___a_SOURCES ***** Primaries ****** Prefixes - EXTRA_: these are built/not built depending on configure (pre-prefix) - noinst_: the built object will not be installed - check_: only build for a `make check' - Others indicate the standard directory: bin_, lib_, shared_ etc. - Automake extensions: pkglib_, pkginclude_ and pkgdata_, which result in `$(libdir)/$(PACKAGE)', `$(includedir)/$(PACKAGE)' etc. ****** Primary variables - PROGRAMS: list of program that are to be compiled & linked - LIBRARIES: list of libraries to be built - HEADERS - DATA - Languages: LISP (Emacs Lisp), PYTHON, JAVA, SCRIPTS (Shell scripts) - Documentation: MANS, TEXINFOS ***** Non-primary variables - Generated from primaries, e.g. bin_PROGRAMS = prog1 => prog1_SOURCES - SOURCES: source files - AR: static library - AM_CPPFLAGS, AM_CXXFLAGS: c++ flags, include directories - AM_LDFLAGS: linker flags, library directories, libraries - COMPILE, CXXCOMPILE: compilation command (the file name is appended) - LINK, CXXLINK: linking command - SUBDIRS: recursive make in the listed directories **** Non-special variables - Copied verbatim ** Create Makefile.in - Run `automake --add-missing' - Create the missing files - Runa automake again