Skip to content

Commit d6a1d3a

Browse files
authored
Annotate input (#50)
* annotate configure.ac * annotate Makefile.am Co-authored-by: Wolf Lammen <[email protected]>
1 parent 3ab9def commit d6a1d3a

File tree

3 files changed

+54
-125
lines changed

3 files changed

+54
-125
lines changed

doc/configure.ac.annotated

Lines changed: 0 additions & 125 deletions
This file was deleted.

src/Makefile.am

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
# This file is input to automake, that expands this high-level make description
2+
# to a Makefile containing the usual goals, and being capable of handling
3+
# portability issues.
4+
5+
# the executable created by make
16
bin_PROGRAMS = metamath
27

8+
# the following header files are used during build, but need not be installed.
9+
# There is nothing exported to external software.
310
noinst_HEADERS = \
411
mmcmdl.h \
512
mmcmds.h \
@@ -15,6 +22,7 @@ noinst_HEADERS = \
1522
mmword.h \
1623
mmwtex.h
1724

25+
# files used to build the executable.
1826
metamath_SOURCES = \
1927
metamath.c \
2028
mmcmdl.c \
@@ -33,9 +41,11 @@ metamath_SOURCES = \
3341
$(noinst_HEADERS)
3442

3543

44+
# the following files are not used during build, but are distributed to users
3645
EXTRA_DIST = \
3746
LICENSE.TXT \
3847
README.TXT \
3948
__README.TXT
4049

50+
# man pages for the executable´
4151
man_MANS = metamath.1

src/configure.ac

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,55 @@
11
# -*- Autoconf -*-
22
# Process this file with autoconf to produce a configure script.
33

4+
# seems to be created by autoscan and adapted to the needs of Metamath
5+
6+
# the version of autoconf needed to translate this file into a portable
7+
# configure script. As of this writing version 2.71 is published.
48
AC_PREREQ([2.65])
9+
10+
# program name, version, email to report bugs
511
AC_INIT([metamath], [0.114], [[email protected]])
12+
13+
# unique file name likely not existing outside the source tree.
14+
# catches incorrect --srcdir parameter in autoconf call.
615
AC_CONFIG_SRCDIR([metamath.c])
16+
17+
# requires a config.h.in file, that is used as a template for a config.h,
18+
# modified according to following commands. A script created by autoconf
19+
# (configure) will finally create the desired config.h.
20+
# Metamath sources do not include this config.h so far, although it is
21+
# common practise to do so.
722
AC_CONFIG_HEADERS([config.h])
823

24+
# Do not expect full GNU conformance (files like NEWS might be missing).
25+
# Minimal checks only.
926
AM_INIT_AUTOMAKE([foreign])
27+
28+
# requires a Makefile.am, that is modified according to following commands.
29+
# AC_OUTPUT creates a Makefile.in based on this modifications..
1030
AC_CONFIG_FILES([Makefile])
1131

1232
# Checks for programs.
33+
34+
# add this to support the tools folder
35+
# AC_PROG_AWK
36+
37+
# test existence of a C compiler
1338
AC_PROG_CC
39+
40+
# find an appropriate install executable
41+
# should be replaced with AC_PROG_MAKE_SET
1442
AC_PROG_INSTALL
1543

1644
# Checks for libraries.
1745

1846
# Checks for header files.
47+
48+
# Fill config.h.in with macros HAVE_<header>_H and define them to 1,
49+
# if a standard complient header is found.
1950
AC_CHECK_HEADERS([limits.h stdlib.h string.h])
51+
52+
# config.h: set HAVE_STDBOOL_H
2053
AC_HEADER_STDBOOL
2154

2255
# Checks for typedefs, structures, and compiler characteristics.
@@ -27,11 +60,17 @@ AC_FUNC_MALLOC
2760
AC_FUNC_REALLOC
2861
AC_CHECK_FUNCS([strchr strcspn strstr])
2962

63+
# copied to Makefile.am
3064
# Enable gcc warning flags, but only if they seem to work
3165
new_CFLAGS="-Wall -Wextra"
3266
saved_CFLAGS="$CFLAGS"
3367
CFLAGS="$CFLAGS $new_CFLAGS"
68+
69+
# configure displays this message
3470
AC_MSG_CHECKING([[for gcc warning flags]])
71+
72+
# compile this program with new_CFLAGS enabled, see if flags are
73+
# accepted, provide them to automake
3574
AC_LINK_IFELSE(
3675
[AC_LANG_PROGRAM([[
3776
#include <stdio.h>
@@ -43,6 +82,9 @@ int f() {
4382
[AC_MSG_RESULT([no])
4483
AM_CFLAGS="$AM_CFLAGS $new_CFLAGS"])
4584

85+
# compile the following program with a bunch of optimization flags.
86+
# If accepted, provide them to automake.
87+
# Take care of a possible collision with flag -O2.
4688
# Try to optimize.
4789
AC_MSG_CHECKING([[for optimization flags]])
4890
new_CFLAGS="-O3 -funroll-loops -finline-functions -fomit-frame-pointer"
@@ -79,6 +121,8 @@ AC_COMPILE_IFELSE(
79121
[AC_MSG_RESULT([no])])
80122
CFLAGS="$saved_CFLAGS"
81123

124+
# replace all @AM_CFLAGS@ and @CFLAGS@ variables in Makefile.am
125+
# with values found here
82126
echo "CFLAGS=$CFLAGS"
83127
AC_SUBST([AM_CFLAGS])
84128
AC_SUBST([CFLAGS])

0 commit comments

Comments
 (0)