1
1
# -*- Autoconf -*-
2
2
# Process this file with autoconf to produce a configure script.
3
3
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.
4
8
AC_PREREQ ( [ 2.65] )
9
+
10
+ # program name, version, email to report bugs
5
11
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.
6
15
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.
7
22
AC_CONFIG_HEADERS ( [ config.h] )
8
23
24
+ # Do not expect full GNU conformance (files like NEWS might be missing).
25
+ # Minimal checks only.
9
26
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..
10
30
AC_CONFIG_FILES ( [ Makefile] )
11
31
12
32
# Checks for programs.
33
+
34
+ # add this to support the tools folder
35
+ # AC_PROG_AWK
36
+
37
+ # test existence of a C compiler
13
38
AC_PROG_CC
39
+
40
+ # find an appropriate install executable
41
+ # should be replaced with AC_PROG_MAKE_SET
14
42
AC_PROG_INSTALL
15
43
16
44
# Checks for libraries.
17
45
18
46
# 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.
19
50
AC_CHECK_HEADERS ( [ limits.h stdlib.h string.h] )
51
+
52
+ # config.h: set HAVE_STDBOOL_H
20
53
AC_HEADER_STDBOOL
21
54
22
55
# Checks for typedefs, structures, and compiler characteristics.
@@ -27,11 +60,17 @@ AC_FUNC_MALLOC
27
60
AC_FUNC_REALLOC
28
61
AC_CHECK_FUNCS ( [ strchr strcspn strstr] )
29
62
63
+ # copied to Makefile.am
30
64
# Enable gcc warning flags, but only if they seem to work
31
65
new_CFLAGS="-Wall -Wextra"
32
66
saved_CFLAGS="$CFLAGS"
33
67
CFLAGS="$CFLAGS $new_CFLAGS"
68
+
69
+ # configure displays this message
34
70
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
35
74
AC_LINK_IFELSE (
36
75
[ AC_LANG_PROGRAM ( [ [
37
76
#include <stdio.h>
@@ -43,6 +82,9 @@ int f() {
43
82
[ AC_MSG_RESULT ( [ no] )
44
83
AM_CFLAGS="$AM_CFLAGS $new_CFLAGS"] )
45
84
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.
46
88
# Try to optimize.
47
89
AC_MSG_CHECKING ( [ [ for optimization flags] ] )
48
90
new_CFLAGS="-O3 -funroll-loops -finline-functions -fomit-frame-pointer"
@@ -79,6 +121,8 @@ AC_COMPILE_IFELSE(
79
121
[ AC_MSG_RESULT ( [ no] ) ] )
80
122
CFLAGS="$saved_CFLAGS"
81
123
124
+ # replace all @AM_CFLAGS@ and @CFLAGS@ variables in Makefile.am
125
+ # with values found here
82
126
echo "CFLAGS=$CFLAGS"
83
127
AC_SUBST ( [ AM_CFLAGS] )
84
128
AC_SUBST ( [ CFLAGS] )
0 commit comments