Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
msg now has its own module file ; New doxygenification of the example
[simgrid.git] / configure.ac
1
2 ######################
3 ## Setup the autotools
4 ##
5
6 AC_PREREQ(2.59)
7 AC_INIT([simgrid],[2.94-cvs],[simgrid2-users@listes.ens-lyon.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 ## Basic checks
23 ##
24
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 # Check architecture signature begin
52 GRAS_ARCH
53 # Check architecture signature end
54 GRAS_CHECK_STRUCT_COMPACTION
55
56
57 AC_CHECK_UCONTEXT
58 AC_MSG_CHECKING(on top of what can we build the contexts)
59 AC_ARG_WITH(context,
60   [  --with-context=[ucontext/pthread]   Use either (System V) swapcontext or pthread [[default=auto]].],,
61   with_context=auto)
62
63 case $with_context in
64  ucontext) ;;
65  pthread) ;;
66  auto) with_context=ucontext;;
67  *) AC_MSG_ERROR("--with-context must be either ucontext or pthread") ;;
68 esac
69
70 if test "x$with_context" = "xucontext" ; then
71   if test "x$ac_check_ucontext" = "xyes"; then
72     AC_MSG_RESULT(found ucontext.h. Great!)
73     AC_DEFINE([USE_UCONTEXT],1,[Define if we use ucontext or not])
74   else
75     ac_header=windows.h
76     as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
77     if test `eval echo '${'$as_ac_Header'}'` = yes; then
78       AC_MSG_RESULT(there is no ucontext on windows, and none is needed.")
79     else
80       AC_MSG_RESULT([[no working ucontext found. Falling back to pthreads]])
81       with_context=pthread
82     fi
83   fi
84 fi
85
86 if test "x$with_context" = "xpthread"; then
87   AC_CHECK_HEADERS([pthread.h])
88 dnl A C_CHECK_LIB(pthread, pthread_mutex_lock, LIBS="$LIBS -lpthread")
89   AC_CHECK_LIB(pthread,pthread_create,,
90     [AC_MSG_ERROR([[Cannot find pthreads, no way (try --with-context=ucontext if you haven't already tried).]])])
91   AC_DEFINE([USE_PTHREADS],1,[Define if we use pthreads or not])
92   AC_MSG_RESULT(You have pthreads. Let's use them.)
93 fi
94
95 #########################################
96 ## Check for libraries extra-dependencies
97 ##
98
99 SIMGRID_DEP=""
100 AC_SUBST([SIMGRID_DEP])
101
102 GRAS_DEP=""
103 AC_CHECK_LIB(nsl, gethostbyname, [GRAS_DEP="$GRAS_DEP -lnsl"])
104 AC_CHECK_LIB(socket, connect,    [GRAS_DEP="$GRAS_DEP -lsocket"])
105
106 AC_MSG_CHECKING(for extra dependencies of libgras)
107 case $host_os in
108   *mingw* ) GRAS_DEP="$GRAS_DEP -lws2_32" ; SIMGRID_DEP="$SIMGRID_DEP -lws2_32" ;;
109 esac
110            
111 if test "x$GRAS_DEP" = x; then 
112    AC_MSG_RESULT(none)
113 else
114    AC_MSG_RESULT($GRAS_DEP)
115 fi
116 AC_SUBST([GRAS_DEP])
117
118 ##############################################
119 ## Enhance maintainer mode and SUBST variables
120 ## (must be placed after any compilation tests since our overprotective flags
121 ##  let some tests fail)
122
123 AM_MAINTAINER_MODE
124 if test x$USE_MAINTAINER_MODE = xyes 
125 then
126    # Maintainers have no choice ! I'm a BOFH, and I plainly assume. [Mt]
127    enable_compile_warnings=yes
128 fi
129 SG_COMPILE_FLAGS
130
131 AC_SUBST(CFLAGS)
132 AC_SUBST(CPPFLAGS)
133 AC_SUBST(LDFLAGS)
134
135 #####################
136 ## Check for programs
137 ##
138
139 AC_CHECK_PROG(BASH, bash, `which bash`, /bin/sh)
140 WARNING="This file is generated, do not edit"
141 AC_SUBST(WARNING)
142
143 # Can we rebuild the parsers?
144 # We really want flex and refuse other lex. So, the parser is portable and
145 # does not induce extra lib dependency
146 AC_PROG_FLEX(2.5.30)
147                 
148 # Can we rebuild the xml-lexers from the XML specification?
149 # if not, simply touch the flex source files (which are distributed in
150 #  tarballs even if generated by flexml) and hope for the best.
151 AC_CHECK_PROG(FLEXML,flexml,`which flexml`,NOTFOUND)
152 AM_CONDITIONAL(HAVE_FLEXML,test x$FLEXML != xNOTFOUND)
153
154 ###################
155 ## Makes the output
156 ##
157
158
159 #    examples/bandwidth/Makefile examples/bandwidth/test_sg
160 #    examples/pastry/Makefile    examples/pastry/test_sg
161
162 AC_CONFIG_FILES([
163   Makefile
164   include/Makefile
165   src/Makefile
166   src/amok/Makefile
167   examples/Makefile 
168     examples/msg/Makefile          examples/msg/run_msg_test
169     examples/gras/Makefile 
170       examples/gras/ping/Makefile  examples/gras/ping/test_sg  examples/gras/ping/test_rl
171       examples/gras/timer/Makefile examples/gras/timer/test_sg examples/gras/timer/test_rl
172       examples/gras/chrono/Makefile examples/gras/chrono/test_sg examples/gras/chrono/test_rl
173   doc/Makefile
174     doc/Doxyfile.main           doc/Doxyfile.API          doc/Doxyfile.Examples   
175   tools/graspe-slave            tools/Makefile
176     tools/gras/Makefile
177   testsuite/Makefile
178   testsuite/run_tests    
179   testsuite/gras/trp_tcp_usage
180   testsuite/gras/trp_file_usage
181 ],[
182     for file in                                                 \
183      testsuite/run_tests                                        \
184      testsuite/gras/trp_tcp_usage testsuite/gras/trp_file_usage \
185      tools/graspe-slave           tools/graspe-master           \
186      examples/msg/run_msg_test                                  \
187      examples/gras/ping/test_sg   examples/gras/ping/test_rl    \
188      examples/gras/timer/test_sg  examples/gras/timer/test_rl   \
189      examples/gras/chrono/test_sg examples/gras/chrono/test_rl  \
190     ; do                                                        \
191       test -e $file && chmod +x $file;                          \
192     done
193     chmod +x $srcdir/tools/gras-check-arch;
194 ])
195
196 #    examples/gras/pastry/test_sg   
197 #    examples/gras/bandwidth/test_sg 
198
199
200
201 #    examples/gras/saturate/Makefile  examples/gras/saturate/test_sg
202 #    examples/gras/alnem/Makefile     examples/gras/alnem/test_sg
203
204
205
206 AC_OUTPUT
207
208 echo "
209
210 Configuration of package \`${PACKAGE}' (version ${VERSION}) on $gras_arch_name (=$gras_arch):
211
212         Compiler:       ${CC}
213
214         CFlags:         ${CFLAGS}
215         LDFlags:        ${LDFLAGS}
216 "
217
218 exit 0;