1 | dnl |
---|
2 | dnl Process this file with autoconf to produce a configure script. |
---|
3 | dnl |
---|
4 | |
---|
5 | dnl |
---|
6 | dnl Initialisation |
---|
7 | dnl |
---|
8 | AC_INIT(factor.h) |
---|
9 | |
---|
10 | dnl |
---|
11 | dnl Set up variables for Makefile.in |
---|
12 | dnl |
---|
13 | dnl Change libfac variables here: |
---|
14 | AC_SUBST(libfac_name) |
---|
15 | libfac_name="\"Factorization and characteristic sets library\"" |
---|
16 | AC_SUBST(libfac_version) |
---|
17 | libfac_version="3.0.2" |
---|
18 | AC_SUBST(libfac_date) |
---|
19 | libfac_date="\"May 2006\"" |
---|
20 | AC_SUBST(libfac_author) |
---|
21 | libfac_author="\"M. Messollen\"" |
---|
22 | |
---|
23 | AC_SUBST(libfac) |
---|
24 | libfac="libfac" |
---|
25 | AC_SUBST(libfac_g) |
---|
26 | libfac_g="libfac-g" |
---|
27 | AC_SUBST(libsingfac) |
---|
28 | libsingfac="libsingfac" |
---|
29 | AC_SUBST(libsingfac_g) |
---|
30 | libsingfac_g="libsingfac-g" |
---|
31 | AC_SUBST(factorH) |
---|
32 | factorH="factor.h" |
---|
33 | AC_SUBST(targetname) |
---|
34 | |
---|
35 | dnl |
---|
36 | dnl Parse options |
---|
37 | dnl |
---|
38 | |
---|
39 | AC_ARG_WITH( |
---|
40 | debug, |
---|
41 | [ --with-debug build with debugging options turned on]) |
---|
42 | |
---|
43 | AC_ARG_WITH( |
---|
44 | Singular, |
---|
45 | [ --with-Singular build for use with Singular]) |
---|
46 | |
---|
47 | if test "$with_Singular" = yes; then |
---|
48 | AC_DEFINE(SINGULAR) |
---|
49 | AC_DEFINE(NOSTREAMIO) |
---|
50 | if test "$with_debug" = yes; then |
---|
51 | targetname="libsingfac-g" |
---|
52 | else |
---|
53 | targetname="libsingfac" |
---|
54 | fi |
---|
55 | else |
---|
56 | if test "$with_debug" = yes; then |
---|
57 | targetname="libfac-g" |
---|
58 | else |
---|
59 | targetname="libfac" |
---|
60 | fi |
---|
61 | fi |
---|
62 | |
---|
63 | AC_ARG_WITH( |
---|
64 | Singularerror, |
---|
65 | [ --with-Singularerror use error reporting from Singular]) |
---|
66 | |
---|
67 | if test "$with_Singularerror" = yes; then |
---|
68 | AC_DEFINE(SINGULAR_ERROR) |
---|
69 | fi |
---|
70 | |
---|
71 | AC_ARG_WITH( |
---|
72 | NOSTREAMIO, |
---|
73 | [ --with-NOSTREAMIO : do not require iostream include nor library]) |
---|
74 | |
---|
75 | if test "$with_NOSTREAMIO" = yes; then |
---|
76 | AC_DEFINE(NOSTREAMIO) |
---|
77 | fi |
---|
78 | |
---|
79 | dnl |
---|
80 | dnl add to -I and -L, if necessary |
---|
81 | dnl |
---|
82 | if (test "x${prefix} != xNONE && test "${prefix} != "/usr/local") || \ |
---|
83 | test "${ac_default_prefix}" != "/usr/local" || \ |
---|
84 | test "${includedir}" != '${prefix}/include'; then |
---|
85 | CPPFLAGS="-I${includedir} ${CPPFLAGS}" |
---|
86 | fi |
---|
87 | CPPFLAGS="-I./factor ${CPPFLAGS}" |
---|
88 | |
---|
89 | if (test "x${prefix} != xNONE && test "${prefix} != "/usr/local") || \ |
---|
90 | test "${ac_default_prefix}" != "/usr/local" || \ |
---|
91 | test "${libdir}" != '${prefix}/lib'; then |
---|
92 | LDFLAGS="-L${libdir} ${LDFLAGS}" |
---|
93 | fi |
---|
94 | LDFLAGS="-L. ${LDFLAGS}" |
---|
95 | |
---|
96 | if test "${CXXFLAGS+set}" != set; then |
---|
97 | ac_cxxflags_set=no |
---|
98 | if test "$with_debug" = yes; then |
---|
99 | CXXFLAGS="-g" |
---|
100 | else |
---|
101 | CXXFLAGS="-O" |
---|
102 | AC_DEFINE(NDEBUG) |
---|
103 | fi |
---|
104 | fi |
---|
105 | |
---|
106 | dnl |
---|
107 | dnl Checks for programs. |
---|
108 | dnl |
---|
109 | AC_LANG_CPLUSPLUS |
---|
110 | AC_PROG_CXX |
---|
111 | AC_REQUIRE_CPP |
---|
112 | AC_PROG_MAKE_SET |
---|
113 | AC_PROG_RANLIB |
---|
114 | AC_CHECK_PROG(AR,ar,ar) |
---|
115 | if test -z "$AR"; then |
---|
116 | AC_MSG_ERROR(Need ar) |
---|
117 | fi |
---|
118 | |
---|
119 | dnl |
---|
120 | dnl programs for installation |
---|
121 | dnl |
---|
122 | dnl ac_save_path=${PATH} |
---|
123 | dnl PATH="$PATH:.." |
---|
124 | dnl AC_PROG_INSTALL |
---|
125 | dnl AC_PATH_PROG(MKINSTALLDIRS, mkinstalldirs, -mkdir -p) |
---|
126 | dnl PATH="$ac_save_path" |
---|
127 | |
---|
128 | dnl |
---|
129 | dnl Checks for header files. |
---|
130 | dnl |
---|
131 | AC_CHECK_HEADER(factory.h,,AC_MSG_WARN(factory.h not found! Install factory before building libfac!)) |
---|
132 | |
---|
133 | dnl |
---|
134 | dnl Checks for libraries. |
---|
135 | dnl |
---|
136 | |
---|
137 | dnl |
---|
138 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
139 | dnl |
---|
140 | |
---|
141 | dnl |
---|
142 | dnl Last, but not least, customize CFLAGS |
---|
143 | dnl |
---|
144 | if test x${GXX} = xyes; then |
---|
145 | |
---|
146 | if test "$ac_cxxflags_set" = no; then |
---|
147 | if test "$with_debug" = yes; then |
---|
148 | CXXFLAGS="-O -g" |
---|
149 | else |
---|
150 | CXXFLAGS="-O3 " |
---|
151 | fi |
---|
152 | # check whether CXX accepts -fno-rtti |
---|
153 | AC_LANG_SAVE |
---|
154 | AC_LANG_CPLUSPLUS |
---|
155 | AC_MSG_CHECKING(whether gcc accepts -fno-rtti) |
---|
156 | tmp_flags=${CXXFLAGS} |
---|
157 | CXXFLAGS="${CXXFLAGS} -fno-rtti" |
---|
158 | AC_CACHE_VAL(ac_cv_cxx_have_rtti, |
---|
159 | AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no) |
---|
160 | ) |
---|
161 | AC_MSG_RESULT(${ac_cv_cxx_have_rtti}) |
---|
162 | CXXFLAGS=$tmp_flags |
---|
163 | if test "${ac_cv_cxx_have_rtti}" = yes; then |
---|
164 | CXXFLAGS="$CXXFLAGS -fno-rtti" |
---|
165 | fi |
---|
166 | |
---|
167 | AC_MSG_CHECKING(whether gcc accepts -fno-exceptions) |
---|
168 | tmp_flags=${CXXFLAGS} |
---|
169 | CXXFLAGS="${CXXFLAGS} -fno-exceptions" |
---|
170 | AC_CACHE_VAL(ac_cv_cxx_have_exceptions, |
---|
171 | AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no) |
---|
172 | ) |
---|
173 | AC_MSG_RESULT(${ac_cv_cxx_have_exceptions}) |
---|
174 | CXXFLAGS=$tmp_flags |
---|
175 | if test "${ac_cv_cxx_have_exceptions}" = yes; then |
---|
176 | CXXFLAGS="$CXXFLAGS -fno-exceptions" |
---|
177 | fi |
---|
178 | |
---|
179 | |
---|
180 | AC_LANG_RESTORE |
---|
181 | |
---|
182 | fi |
---|
183 | CXXTEMPLFLAGS="-fno-implicit-templates" |
---|
184 | |
---|
185 | |
---|
186 | else |
---|
187 | CXXTEMPFLAGS="" |
---|
188 | fi |
---|
189 | AC_SUBST(CXXTEMPLFLAGS) |
---|
190 | |
---|
191 | AC_OUTPUT(Makefile) |
---|
192 | |
---|
193 | dnl |
---|
194 | dnl Plans: |
---|
195 | dnl 1) look for libraries (warn if not found) for building testprog |
---|
196 | dnl 1) search for perl |
---|