Rev 13454 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7156 | georgesk | 1 | # Process this file with autoconf to produce a configure script. |
2 | |||
15781 | bpr | 3 | AC_INIT(WIMS, esyscmd(awk 'ORS=""; {print $0}' ../version), wimsdev@groupes.renater.fr) |
7156 | georgesk | 4 | AC_CONFIG_SRCDIR([wims.c]) |
5 | AC_CONFIG_HEADER([config.h:config.hin]) |
||
6 | |||
7 | AC_DEFUN([WIMS_NEED], [ |
||
8 | AC_PATH_PROG($1,$2) |
||
9 | if test -z "`eval echo '$'$1`"; then |
||
10 | echo ERROR: WIMS requires $3 |
||
11 | echo Please install this package then restart configure. |
||
12 | exit 1 |
||
13 | fi |
||
14 | ]) |
||
15 | AC_DEFUN([WIMS_FAIL], [ |
||
16 | if test "$2" = no; then |
||
17 | echo |
||
18 | echo ERROR! Your system does not have $1 |
||
19 | echo WIMS cannot be installed. Please report. |
||
20 | echo |
||
21 | exit 1 |
||
22 | fi |
||
23 | ]) |
||
24 | AC_DEFUN([WIMS_CHECK_FUNC], [ |
||
25 | AC_CHECK_FUNCS($1) |
||
26 | WIMS_FAIL($1, $ac_cv_func_$1) |
||
27 | ]) |
||
28 | |||
29 | # Checks for programs. |
||
30 | AC_PROG_LN_S |
||
31 | if test "$LN_S" != "ln -s"; then |
||
32 | WIMS_FAIL([symbolic links], no) |
||
33 | fi |
||
34 | AC_PROG_AWK |
||
35 | AC_PROG_YACC |
||
36 | AC_PROG_CC(gcc cc) |
||
37 | AC_PROG_CXX |
||
38 | AC_PROG_CPP |
||
39 | AC_PROG_LEX |
||
40 | AC_PROG_MAKE_SET |
||
41 | AC_PROG_RANLIB |
||
42 | AC_CHECK_PROG(STRIP,strip,strip,:) |
||
43 | |||
44 | #WIMS_NEED([TEX], [tex], [TeX]) |
||
45 | #WIMS_NEED([GP], [gp], [Pari/GP]) |
||
46 | #WIMS_NEED([CONVERT], [convert], [ImageMagick]) |
||
47 | |||
48 | # Checks for libraries. |
||
49 | SAVE=$LIBS |
||
50 | AC_CHECK_LIB([m], [cos]) |
||
51 | WIMS_FAIL([Math library libm], $ac_cv_lib_m_cos) |
||
52 | |||
53 | AC_CHECK_FUNCS([rint]) |
||
54 | WIMS_CHECK_FUNC(floor) |
||
55 | WIMS_CHECK_FUNC(pow) |
||
56 | WIMS_CHECK_FUNC(sqrt) |
||
57 | |||
58 | LIBS=$SAVE |
||
59 | AC_CHECK_LIB([gd], [gdFontCacheSetup]) |
||
60 | AC_CHECK_FUNCS([gdFontCacheSetup]) |
||
61 | GDLIB=$LIBS |
||
62 | |||
63 | LIBS=$SAVE |
||
64 | AC_CHECK_LIB([crypt], [crypt]) |
||
65 | AC_CHECK_FUNCS([crypt]) |
||
66 | CRYPTLIB=$LIBS |
||
67 | |||
68 | LIBS=$SAVE |
||
69 | AC_CHECK_LIB([fl], [main]) |
||
70 | FLEXLIB=$LIBS |
||
71 | |||
72 | LIBS=$SAVE |
||
73 | fun=gethostbyname |
||
74 | AC_CHECK_FUNCS($fun) |
||
75 | if test "$ac_cv_func_$fun" = no; then |
||
76 | AC_CHECK_LIB([nsl], $fun) |
||
77 | WIMS_FAIL($fun, $ac_cv_lib_$fun) |
||
78 | fi |
||
79 | |||
80 | WIMS_CHECK_FUNC(gethostname) |
||
81 | |||
82 | fun=socket |
||
83 | AC_CHECK_FUNCS($fun) |
||
7662 | bpr | 84 | if test "$ac_cv_func_$fun" = no; then |
7156 | georgesk | 85 | AC_CHECK_LIB([socket], [$fun]) |
7662 | bpr | 86 | if test "$ac_cv_lib_$fun" = no; then |
7156 | georgesk | 87 | AC_CHECK_LIB([socket], [$fun], [], [], [-lnsl]) |
88 | WIMS_FAIL($fun, $ac_cv_lib_$fun) |
||
89 | fi |
||
90 | fi |
||
91 | |||
92 | fun=inet_ntoa |
||
93 | AC_CHECK_FUNCS($fun) |
||
7662 | bpr | 94 | if test "$ac_cv_func_$fun" = no; then |
7156 | georgesk | 95 | AC_CHECK_LIB([socket], [$fun], [], [], [-lnsl]) |
96 | fi |
||
97 | fun=inet_aton |
||
98 | AC_CHECK_FUNCS($fun) |
||
7662 | bpr | 99 | if test "$ac_cv_func_$fun" = no; then |
7156 | georgesk | 100 | AC_CHECK_LIB([resolv], [$fun]) |
101 | fi |
||
102 | NETLIBS=$LIBS |
||
103 | |||
104 | LIBS=$SAVE |
||
105 | |||
106 | # Checks for header files. |
||
107 | AC_FUNC_ALLOCA |
||
108 | AC_HEADER_DIRENT |
||
109 | AC_HEADER_STDC |
||
110 | AC_HEADER_SYS_WAIT |
||
111 | AC_MEMORY_H |
||
112 | AC_CHECK_HEADERS([crypt.h arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h \ |
||
113 | stdlib.h string.h sys/socket.h sys/time.h unistd.h utime.h]) |
||
114 | WIMS_FAIL([ANSI C header files], $ac_cv_header_stdc) |
||
115 | WIMS_FAIL([Header file unistd.h], $ac_cv_header_unistd_h) |
||
116 | |||
117 | # Checks for typedefs, structures, and compiler characteristics. |
||
118 | AC_C_CONST |
||
119 | AC_C_INLINE |
||
120 | AC_TYPE_PID_T |
||
121 | AC_TYPE_SIZE_T |
||
122 | AC_HEADER_TIME |
||
123 | AC_STRUCT_TM |
||
124 | AC_CHECK_TYPES(socklen_t, [], [], [ |
||
125 | #include <sys/types.h> |
||
126 | #include <sys/socket.h>]) |
||
127 | |||
128 | # Runpath |
||
129 | RPATH= |
||
130 | case "$CC+$with_dynamic" in |
||
131 | gcc+yes) RPATH="-Xlinker -rpath -Xlinker ../lib:../../lib:../../../lib";; |
||
132 | esac |
||
133 | |||
134 | # Checks for library functions. |
||
135 | AC_FUNC_MALLOC |
||
136 | WIMS_FAIL(malloc, $ac_cv_func_malloc_0_nonnull) |
||
137 | AC_FUNC_REALLOC |
||
138 | WIMS_FAIL(realloc, $ac_cv_func_realloc_0_nonnull) |
||
139 | AC_FUNC_FORK |
||
140 | WIMS_FAIL([working fork], $ac_cv_func_fork_works) |
||
141 | |||
142 | AC_FUNC_ERROR_AT_LINE |
||
143 | AC_FUNC_LSTAT |
||
144 | AC_FUNC_MEMCMP |
||
145 | AC_TYPE_SIGNAL |
||
146 | AC_FUNC_STAT |
||
147 | AC_FUNC_STRTOD |
||
148 | AC_CHECK_FUNCS([dup2 regcomp putenv strcasecmp strchr strdup strerror utime]) |
||
149 | |||
150 | WIMS_CHECK_FUNC(alarm) |
||
151 | WIMS_CHECK_FUNC(getcwd) |
||
152 | WIMS_CHECK_FUNC(gettimeofday) |
||
153 | WIMS_CHECK_FUNC(memmove) |
||
154 | WIMS_CHECK_FUNC(memset) |
||
155 | WIMS_CHECK_FUNC(mkdir) |
||
156 | WIMS_CHECK_FUNC(rmdir) |
||
157 | WIMS_CHECK_FUNC(select) |
||
158 | WIMS_CHECK_FUNC(strncasecmp) |
||
159 | WIMS_CHECK_FUNC(strpbrk) |
||
160 | WIMS_CHECK_FUNC(strrchr) |
||
161 | WIMS_CHECK_FUNC(strstr) |
||
162 | WIMS_CHECK_FUNC(utime) |
||
163 | |||
164 | # setenv ? |
||
165 | AC_CHECK_FUNCS([setenv]) |
||
166 | if test "$ac_cv_func_setenv" = no; then |
||
167 | common=../Common |
||
168 | SETENV_OBJS=$common/setenv.o |
||
169 | # FIXME: there should not be various xmallocs with different semantics. Only |
||
170 | # SETENV_OBJS should be necessary. |
||
171 | ALLSETENV_OBJS="$SETENV_OBJS $common/xmalloc.o" |
||
172 | else |
||
173 | SETENV_OBJS= |
||
174 | ALLSETENV_OBJS= |
||
175 | fi |
||
176 | |||
177 | # Case insensitive file system? |
||
178 | AC_CHECK_FILE(WIMS.C, D_CASE_INSENSITIVE_FS="-DCASE_INSENSITIVE_FS=1", |
||
179 | D_CASE_INSENSITIVE_FS=) |
||
180 | # Static libm? |
||
181 | AC_CHECK_FILE(/usr/lib/libm.a,STATIC_LIB=-static,STATIC_LIB=) |
||
182 | |||
183 | # Configure options |
||
184 | AC_ARG_WITH(units, [ --without-units Don't compile units-filter (units recognition)],echo Compile units-filter: $with_units, with_units=yes; echo Compile units-filter: yes) |
||
185 | BUILD_UNITS= |
||
186 | if test "$with_units" = "yes"; then |
||
187 | case "$LEXLIB" in |
||
13317 | bpr | 188 | -lfl | -ll) BUILD_UNITS=units-filter;; |
7156 | georgesk | 189 | *) with_units=no; echo "Wait ... flex is not available, Compile units : no";; |
190 | esac |
||
191 | fi |
||
192 | |||
193 | AC_ARG_WITH(chemeq,[ --without-chemeq Don't compile chemeq (chemical equation analyzer)],echo Compile chemeq: $with_chemeq, with_chemeq=yes; echo Compile chemeq: yes) |
||
194 | BUILD_CHEMEQ= |
||
195 | if test "$with_chemeq" = "yes"; then |
||
196 | case "$LEXLIB" in |
||
13317 | bpr | 197 | -lfl | -ll) if test "$CXX" = "g++"; then |
7156 | georgesk | 198 | case `"$CXX" --version` in |
199 | [ 1*|2.[1-8]*|2.9[1-4]*|2.95.[1-2]) ] |
||
200 | with_chemeq=no |
||
201 | echo "Wait ... I need at least g++-2.95.3, Compile chemeq: no" ;; |
||
202 | *) BUILD_CHEMEQ=chemeq;; |
||
203 | esac |
||
204 | else |
||
205 | with_chemeq=no |
||
206 | echo "Wait ... g++ is not available, Compile chemeq: no" |
||
207 | fi;; |
||
208 | *) with_chemeq=no |
||
209 | echo "Wait ... flex is not available, Compile chemeq: no";; |
||
210 | esac |
||
211 | fi |
||
212 | |||
213 | AC_ARG_WITH(wimsd,[ --without-wimsd Don't compile wimsd (standalone http server)],echo Compile wimsd: $with_wimsd, with_wimsd=yes; echo Compile wimsd: yes) |
||
214 | if test "$with_wimsd" = "yes"; then |
||
215 | BUILD_WIMSD=wimsd |
||
216 | fi |
||
217 | |||
13454 | georgesk | 218 | if test -n "$SOURCE_DATE_EPOCH"; then |
219 | # When a debian package is built, SOURCE_DATE_EPOCH is defined, so |
||
220 | # the build date is taken from the head of the file debian/changelog. |
||
221 | # This provides reproducible builds, and more security in Debian. |
||
222 | date=`date --utc --date="@$SOURCE_DATE_EPOCH" +%Y-%m-%d` |
||
223 | else |
||
224 | date=`date +%Y-%m-%d` |
||
225 | fi |
||
226 | |||
7156 | georgesk | 227 | DEFINES="-DGNU_SOURCE -DVERSION_DATE=\\\"$date\\\"" |
228 | AC_SUBST(D_CASE_INSENSITIVE_FS) |
||
229 | AC_SUBST(STATIC_LIB) |
||
230 | AC_SUBST(DEFINES) |
||
231 | AC_SUBST(STRIP) |
||
232 | AC_SUBST(RPATH) |
||
233 | AC_SUBST(BUILD_UNITS) |
||
234 | AC_SUBST(BUILD_CHEMEQ) |
||
235 | AC_SUBST(BUILD_WIMSD) |
||
236 | AC_SUBST(SETENV_OBJS) |
||
237 | AC_SUBST(ALLSETENV_OBJS) |
||
238 | AC_SUBST(NETLIBS) |
||
239 | AC_SUBST(FLEXLIB) |
||
240 | AC_SUBST(GDLIB) |
||
241 | AC_SUBST(CRYPTLIB) |
||
242 | |||
7614 | schaersvoo | 243 | AC_CONFIG_FILES([Flydraw/Makefile |
7156 | georgesk | 244 | Interfaces/Makefile |
245 | Lib/Makefile |
||
246 | Makefile |
||
247 | Misc/Makefile |
||
248 | Misc/symtext/Makefile |
||
249 | Misc/mathexp/Makefile |
||
250 | Misc/chemeq/Makefile |
||
251 | Misc/chemeq/src/Makefile |
||
252 | Misc/units-filter/src/Makefile |
||
253 | Misc/voronoiW/Makefile |
||
254 | Misc/bioinfo/Makefile |
||
255 | Misc/checkmol/Makefile |
||
256 | Misc/crossword/Makefile |
||
257 | Misc/lceb/Makefile |
||
258 | Misc/moneyprint/Makefile |
||
259 | Misc/toascii/Makefile |
||
260 | Misc/scienceprint/Makefile |
||
261 | Misc/sigdigits/Makefile |
||
7614 | schaersvoo | 262 | Misc/canvasdraw/Makefile |
7156 | georgesk | 263 | Misc/whirlgif/Makefile |
264 | Misc/authors/jm.evers/applets/Makefile |
||
8182 | georgesk | 265 | Misc/applets/Makefile |
7156 | georgesk | 266 | Module/Makefile |
267 | Module/drawode/Makefile |
||
8148 | bpr | 268 | OefMsg2wims/Makefile |
7156 | georgesk | 269 | Wimsd/Makefile |
270 | Wimslogd/Makefile |
||
271 | Texgif/Makefile |
||
272 | Mathml/Makefile]) |
||
273 | AC_OUTPUT |