Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
In RL, count the time from the begining of the application, not from the 1 jan 1970...
[simgrid.git] / configure.ac
1
2 ######################
3 ## Setup the autotools
4 ##
5
6 AC_PREREQ(2.59)
7 AC_INIT([simgrid],[2.95-cvs],[simgrid-devel@lists.gforge.inria.fr])
8 AC_CONFIG_SRCDIR([include/gras.h])
9 AC_CONFIG_HEADERS([src/gras_config.h])
10 # A CI_PREREQ(2003.01.16) # We need a recent ACI when having sub-modules
11
12 AC_REVISION($Revision$)
13 AC_CANONICAL_TARGET
14 AC_LANG([C])
15
16 AM_INIT_AUTOMAKE(gnu)
17 AC_CONFIG_MACRO_DIR(acmacro) 
18 ACLOCAL="$ACLOCAL -I acmacro"
19 AC_PROG_LIBTOOL
20
21 ###############
22 ## System checks
23 ##
24 SG_CONFIGURE_PART(System checks...)
25 AC_PROG_CC(xlC gcc cc)
26 AM_SANITY_CHECK
27 AC_PROG_MAKE_SET
28 AC_CHECK_PRINTF_NULL
29
30 # Checks for header files.
31 AC_HEADER_STDC
32 AC_HEADER_TIME
33 AC_CHECK_HEADERS([sys/socket.h \
34                   sys/stat.h \
35                   windows.h winsock.h winsock2.h \
36                   sys/time.h \
37                   errno.h unistd.h ])
38 AC_CHECK_FUNCS([gettimeofday usleep \
39                 getdtablesize \
40                 sysconf])
41
42 # Checks for typedefs, structures, and compiler characteristics.
43 AC_C_CONST
44 AC_C_INLINE
45 AC_TYPE_SIZE_T
46
47 ###################################
48 ## SimGrid and GRAS specific checks
49 ##
50
51 SG_CONFIGURE_PART(Checking GRAS architecture signature...)
52 # Check architecture signature begin
53 GRAS_ARCH
54 # Check architecture signature end
55 GRAS_CHECK_STRUCT_COMPACTION
56
57
58 SG_CONFIGURE_PART([Checking for threads, contexts or assimilated...])
59 AC_CHECK_UCONTEXT
60 AC_MSG_CHECKING(on top of what can we build the contexts)
61 AC_ARG_WITH(context,
62   [  --with-context=[ucontext/pthread]   Use either (System V) swapcontext or pthread [[default=auto]].],,
63   with_context=auto)
64
65 case $with_context in
66  ucontext) ;;
67  pthread) ;;
68  auto) with_context=ucontext;;
69  *) AC_MSG_ERROR("--with-context must be either ucontext or pthread") ;;
70 esac
71
72 if test "x$with_context" = "xucontext" ; then
73   if test "x$ac_check_ucontext" = "xyes"; then
74     AC_MSG_RESULT(found ucontext.h. Great!)
75     AC_DEFINE([USE_UCONTEXT],1,[Define if we use ucontext or not])
76   else
77     ac_header=windows.h
78     as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
79     if test `eval echo '${'$as_ac_Header'}'` = yes; then
80       AC_MSG_RESULT(there is no ucontext on windows, and none is needed.")
81     else
82       AC_MSG_RESULT([[no working ucontext found. Falling back to pthreads]])
83       with_context=pthread
84     fi
85   fi
86 fi
87
88 if test "x$with_context" = "xpthread"; then
89   AC_CHECK_HEADERS([pthread.h])
90 dnl A C_CHECK_LIB(pthread, pthread_mutex_lock, LIBS="$LIBS -lpthread")
91   AC_CHECK_LIB(pthread,pthread_create,,
92     [AC_MSG_ERROR([[Cannot find pthreads, no way (try --with-context=ucontext if you haven't already tried).]])])
93   AC_DEFINE([USE_PTHREADS],1,[Define if we use pthreads or not])
94   AC_MSG_RESULT(You have pthreads. Let's use them.)
95 fi
96
97 #########################################
98 ## Check for libraries extra-dependencies
99 ##
100
101 SG_CONFIGURE_PART(Checking extra libraries dependencies...)
102 SIMGRID_DEP=""
103 AC_SUBST([SIMGRID_DEP])
104
105 GRAS_DEP=""
106 AC_CHECK_LIB(nsl, gethostbyname, [GRAS_DEP="$GRAS_DEP -lnsl"])
107 AC_CHECK_LIB(socket, connect,    [GRAS_DEP="$GRAS_DEP -lsocket"])
108
109 AC_MSG_CHECKING(for extra dependencies of libgras)
110 case $host_os in
111   *mingw* ) GRAS_DEP="$GRAS_DEP -lws2_32" ; SIMGRID_DEP="$SIMGRID_DEP -lws2_32" ;;
112 esac
113            
114 if test "x$GRAS_DEP" = x; then 
115    AC_MSG_RESULT(none)
116 else
117    AC_MSG_RESULT($GRAS_DEP)
118 fi
119 AC_SUBST([GRAS_DEP])
120
121 ##############################################
122 ## Enhance maintainer mode and SUBST variables
123 ## (must be placed after any compilation tests since our overprotective flags
124 ##  let some tests fail)
125
126 AM_MAINTAINER_MODE
127 if test x$USE_MAINTAINER_MODE = xyes 
128 then
129    # Maintainers have no choice ! I'm a BOFH, and I plainly assume. [Mt]
130    enable_compile_warnings=yes
131 fi
132 SG_COMPILE_FLAGS
133
134 AC_SUBST(CFLAGS)
135 AC_SUBST(CPPFLAGS)
136 AC_SUBST(LDFLAGS)
137
138 #####################
139 ## Check for programs
140 ##
141
142 SG_CONFIGURE_PART(Check for programs...)
143 AC_CHECK_PROG(BASH, bash, `which bash`, /bin/sh)
144 WARNING="This file is generated, do not edit"
145 AC_SUBST(WARNING)
146
147 # Can we rebuild the parsers?
148 # We really want flex and refuse other lex. So, the parser is portable and
149 # does not induce extra lib dependency
150 AC_PROG_FLEX(2.5.30)
151                 
152 # Can we rebuild the xml-lexers from the XML specification?
153 # if not, simply touch the flex source files (which are distributed in
154 #  tarballs even if generated by flexml) and hope for the best.
155 AC_CHECK_PROG(FLEXML,flexml,`which flexml`,NOTFOUND)
156 AM_CONDITIONAL(HAVE_FLEXML,test x$FLEXML != xNOTFOUND)
157
158 ###################
159 ## Makes the output
160 ##
161
162
163 #    examples/pastry/Makefile    examples/pastry/test_sg
164 #      examples/gras/token/Makefile examples/gras/token/test_sg examples/gras/token/test_rl
165 #      examples/gras/chord/Makefile  examples/gras/chord/test_sg examples/gras/chord/test_rl
166
167 SG_CONFIGURE_PART(Generating files...)
168 AC_CONFIG_FILES([
169   Makefile
170   include/Makefile
171   src/Makefile
172   src/amok/Makefile
173   examples/Makefile 
174     examples/msg/Makefile           examples/msg/run_msg_test
175     examples/gras/Makefile 
176       examples/gras/ping/Makefile   examples/gras/ping/test_sg  examples/gras/ping/test_rl
177       examples/gras/timer/Makefile  examples/gras/timer/test_sg examples/gras/timer/test_rl
178       examples/gras/chrono/Makefile examples/gras/chrono/test_sg examples/gras/chrono/test_rl
179     examples/amok/Makefile       
180       examples/amok/bandwidth/Makefile examples/amok/bandwidth/test_sg
181   doc/Makefile
182     doc/Doxyfile
183   tools/graspe-slave            tools/Makefile
184     tools/gras/Makefile
185   testsuite/Makefile
186   testsuite/run_tests    
187   testsuite/gras/trp_tcp_usage  testsuite/gras/trp_file_usage
188 ],[
189     for file in                                                 \
190      testsuite/run_tests                                        \
191      testsuite/gras/trp_tcp_usage testsuite/gras/trp_file_usage \
192      tools/graspe-slave           tools/graspe-master           \
193      \
194      examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \
195      \
196      examples/gras/ping/test_sg   examples/gras/ping/test_rl    \
197      examples/gras/timer/test_sg  examples/gras/timer/test_rl   \
198      examples/gras/chrono/test_sg examples/gras/chrono/test_rl  \
199      \
200      examples/msg/run_msg_test                                  \
201     ; do                                                        \
202       test -e $file && chmod +x $file;                          \
203     done
204 ])
205
206 #     examples/gras/token/test_sg  examples/gras/token/test_rl   \
207 #     examples/gras/chord/test_sg  examples/gras/chord/test_rl   \
208 #    examples/gras/pastry/test_sg   
209
210
211
212 #    examples/gras/saturate/Makefile  examples/gras/saturate/test_sg
213 #    examples/gras/alnem/Makefile     examples/gras/alnem/test_sg
214
215
216
217 AC_OUTPUT
218
219 echo "
220
221 Configuration of package \`${PACKAGE}' (version ${VERSION}) on $gras_arch_name (=$gras_arch):
222
223         Compiler:       ${CC}
224
225         CFlags:         ${CFLAGS}
226         LDFlags:        ${LDFLAGS}
227 "
228
229 exit 0;