Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a dist-files target to all makefiles. It outputs all files which must be placed...
[simgrid.git] / configure.ac
1 AC_PREREQ(2.59)
2
3 # We need a recent ACI
4 # A CI_PREREQ(2003.01.16)
5
6 AC_INIT([simgrid],[2.93-cvs],[simgrid2-users@listes.ens-lyon.fr])
7 AC_CONFIG_SRCDIR([include/gras.h])
8 AC_CONFIG_HEADERS([src/gras_config.h])
9
10 AC_REVISION($Revision$)
11 AC_CANONICAL_TARGET
12 AC_LANG([C])
13
14 AM_INIT_AUTOMAKE(gnu)
15 # MACRO_DIR should tell aclocal to search for my macro. That's the autoconf
16 # maintainer plan, but automake does not implement this yet (as in 1.8)
17 AC_CONFIG_MACRO_DIR(acmacro) 
18 # It seems to be called ACLOCAL_INCLUDE...
19 # A M_ACLOCAL_INCLUDE(acmacro)
20
21 AC_PROG_LIBTOOL
22
23 # declare the modules (no optional module)
24
25 dnl
26 dnl Load anything under acmacro/*.m4
27 dnl
28 dnl test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
29 ACLOCAL="$ACLOCAL -I acmacro"
30
31
32 AC_PROG_CC
33 AM_SANITY_CHECK
34 AC_PROG_MAKE_SET
35
36 # Check architecture signature begin
37 GRAS_ARCH
38 # Check architecture signature end
39 GRAS_CHECK_STRUCT_COMPACTION
40
41 # Checks for header files.
42 AC_HEADER_STDC
43 AC_HEADER_TIME
44 AC_CHECK_HEADERS([sys/socket.h winsock.h winsock2.h \
45                   sys/stat.h \
46                   ucontext.h \
47                   pthread.h \
48                   windows.h \
49                   sys/time.h \
50                   errno.h unistd.h ])
51 AC_CHECK_FUNCS([gettimeofday usleep \
52                 getdtablesize \
53                 sysconf])
54
55 AC_ARG_ENABLE(context,
56   [  --enable-context=[ucontext/pthreads]   Use either (System V) swapcontext or pthread [[default=ucontext]].],,
57   enable_context=ucontext)
58 AC_MSG_CHECKING(on top of what can we build the contexts)
59 if test "x$enable_context" = "xucontext"; then
60   ac_header=ucontext.h
61   as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
62   if test `eval echo '${'$as_ac_Header'}'` = yes; then
63     AC_MSG_RESULT(found ucontext.h. Great!)
64   else
65     ac_header=windows.h
66     as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
67     if test `eval echo '${'$as_ac_Header'}'` = yes; then
68       AC_MSG_RESULT(you don't have ucontext.h but we provide an alternative for windows so you should be fine.")
69     else
70       AC_MSG_RESULT([[cannot find ucontext. I'm going to try as if you had set --enable-context=pthreads !]])
71       enable_context=pthreads
72     fi
73   fi
74 fi
75 if test "x$enable_context" = "xpthreads"; then
76   AC_CHECK_LIB(pthread,pthread_create,,
77     [AC_MSG_ERROR([[Cannot find pthreads, no way (try --enable-context=ucontext if you haven't already tried).]])])
78   AC_DEFINE([USE_PTHREADS],1,[Define if we USE pthreads or not])
79   AC_MSG_RESULT(You have pthreads. Let's use them.)
80 fi
81
82
83 # Checks for typedefs, structures, and compiler characteristics.
84 AC_C_CONST
85 AC_C_INLINE
86 AC_TYPE_SIZE_T
87
88 # Checks for library functions.
89 dnl A C_FUNC_MEMCMP
90 dnl A C_CHECK_FUNCS([memset strchr strerror usleep])
91
92 dnl ####[ Search libs ]#######################################################
93 dnl A CI_PACKAGE([S imGrid],[the SimGrid simulator],[SG_init],[-lsimgrid],[simgrid.h],,:)
94 dnl A M_CONDITIONAL(HAVE_SG,test x$HAVE_SimGrid = xyes)
95 dnl if test x$HAVE_SimGrid = xyes; then
96 dnl   SIMGRID_DEP="-lsimgrid"
97 dnl else
98   SIMGRID_DEP=""
99 dnl fi
100 AC_SUBST([SIMGRID_DEP])
101
102
103 dnl A C_CHECK_LIB(pthread, pthread_mutex_lock, LIBS="$LIBS -lpthread")
104 GRAS_DEP=""
105 AC_CHECK_LIB(nsl, gethostbyname, [GRAS_DEP="$GRAS_DEP -lnsl"])
106 AC_CHECK_LIB(socket, connect,    [GRAS_DEP="$GRAS_DEP -lsocket"])
107
108 AC_MSG_CHECKING(for extra dependencies of libgras)
109 case $host_os in
110   *mingw* ) GRAS_DEP=-lws2_32;;
111 esac
112            
113 if test "x$GRAS_DEP" = x; then 
114    AC_MSG_RESULT(none)
115 else
116    AC_MSG_RESULT($GRAS_DEP)
117 fi
118 AC_SUBST([GRAS_DEP])
119
120 dnl ####[ maint mode ]#######################################################
121 AM_MAINTAINER_MODE
122 if test x$USE_MAINTAINER_MODE = xyes 
123 then
124 #   enable_iso_c=yes             # Let's go funky
125    GNOME_COMPILE_WARNINGS(yes)
126 fi
127
128 AC_SUBST(CFLAGS)
129 AC_SUBST(CPPFLAGS)
130 AC_SUBST(LDFLAGS)
131
132 dnl ####[ check for some programms ]###########################################
133 AC_CHECK_PROG(BASH, bash, `which bash`, /bin/sh)
134 WARNING="This file is generated, do not edit"
135 AC_SUBST(WARNING)
136
137 # Can we rebuild the parsers?
138 # We really want flex and refuse other lex. So, the parser is portable and
139 # does not induce extra lib dependency
140 AC_PROG_FLEX(2.5.30)
141                 
142 # Can we rebuild the xml-lexers from the XML specification?
143 # if not, simply touch the flex source files (which are distributed in
144 #  tarballs even if generated by flexml) and hope for the best.
145 AC_CHECK_PROG(FLEXML,flexml,,NOTFOUND)
146 AM_CONDITIONAL(HAVE_FLEXML,test x$FLEXML != NOTFOUND)
147
148 dnl ####[ Makes the output ]###################################################
149 #    examples/bandwidth/Makefile examples/bandwidth/test_sg
150 #    examples/pastry/Makefile    examples/pastry/test_sg
151
152 AC_CONFIG_FILES([
153   Makefile
154   include/Makefile
155   src/Makefile
156   src/amok/Makefile
157   examples/Makefile 
158     examples/msg/Makefile          examples/msg/run_msg_test
159     examples/gras/Makefile 
160       examples/gras/ping/Makefile  examples/gras/ping/test_sg  examples/gras/ping/test_rl
161       examples/gras/timer/Makefile examples/gras/timer/test_sg examples/gras/timer/test_rl
162       examples/gras/chrono/Makefile examples/gras/chrono/test_sg examples/gras/chrono/test_rl
163   doc/Makefile
164     doc/Doxyfile.main           doc/Doxyfile.API          doc/Doxyfile.Examples   
165   tools/compile-remote-worker tools/Makefile
166     tools/gras/Makefile
167   testsuite/Makefile
168   testsuite/run_tests    
169   testsuite/gras/trp_tcp_usage
170   testsuite/gras/trp_file_usage
171 ],[
172     for file in                                                 \
173      testsuite/run_tests                                        \
174      testsuite/gras/trp_tcp_usage testsuite/gras/trp_file_usage \
175      tools/compile-remote-worker                                \
176      examples/msg/run_msg_test                                  \
177      examples/gras/ping/test_sg   examples/gras/ping/test_rl    \
178      examples/gras/timer/test_sg  examples/gras/timer/test_rl   \
179      examples/gras/chrono/test_sg  examples/gras/chrono/test_rl \
180     ; do                                                        \
181       test -e $file && chmod +x $file;                          \
182     done
183     chmod +x $srcdir/tools/gras-check-arch;
184 ])
185
186 #    examples/gras/pastry/test_sg   
187 #    examples/gras/bandwidth/test_sg 
188
189
190
191 #    examples/gras/saturate/Makefile  examples/gras/saturate/test_sg
192 #    examples/gras/alnem/Makefile     examples/gras/alnem/test_sg
193
194
195
196 AC_OUTPUT
197
198 echo "
199
200 Configuration of package \`${PACKAGE}' on $gras_arch_name (=$gras_arch):
201
202         Compiler:       ${CC}
203
204         CFlags:         ${CFLAGS}
205         LDFlags:        ${LDFLAGS}
206 "
207
208 exit 0;