Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I'd prefer xlC better than gcc on AIX
[simgrid.git] / configure.ac
1
2 ######################
3 ## Setup the autotools
4 ##
5
6 AC_PREREQ(2.59)
7 AC_INIT([simgrid],[2.93-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 AC_ARG_ENABLE(context,
57   [  --enable-context=[ucontext/pthread]   Use either (System V) swapcontext or pthread [[default=pthread]].],,
58   enable_context=pthread)
59 AC_MSG_CHECKING(on top of what can we build the contexts)
60 if test "x$enable_context" = "xucontext"; then
61   AC_CHECK_HEADERS([ucontext.h])
62   ac_header=ucontext.h
63   as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
64   if test `eval echo '${'$as_ac_Header'}'` = yes; then
65     AC_MSG_RESULT(found ucontext.h. Great!)
66   else
67     ac_header=windows.h
68     as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
69     if test `eval echo '${'$as_ac_Header'}'` = yes; then
70       AC_MSG_RESULT(you don't have ucontext.h but we provide an alternative for windows so you should be fine.")
71     else
72       AC_MSG_RESULT([[cannot find ucontext. I'm going to try as if you had set --enable-context=pthreads !]])
73       enable_context=pthreads
74     fi
75   fi
76 else if test "x$enable_context" = "xpthread"; then
77   AC_CHECK_HEADERS([pthread.h])
78 dnl A C_CHECK_LIB(pthread, pthread_mutex_lock, LIBS="$LIBS -lpthread")
79   AC_CHECK_LIB(pthread,pthread_create,,
80     [AC_MSG_ERROR([[Cannot find pthreads, no way (try --enable-context=ucontext if you haven't already tried).]])])
81   AC_DEFINE([USE_PTHREADS],1,[Define if we USE pthreads or not])
82   AC_MSG_RESULT(You have pthreads. Let's use them.)
83 else 
84   AC_MSG_ERROR("--enable-context must be either ucontext or pthread")
85 fi fi
86
87 #########################################
88 ## Check for libraries extra-dependencies
89 ##
90
91 SIMGRID_DEP=""
92 AC_SUBST([SIMGRID_DEP])
93
94 GRAS_DEP=""
95 AC_CHECK_LIB(nsl, gethostbyname, [GRAS_DEP="$GRAS_DEP -lnsl"])
96 AC_CHECK_LIB(socket, connect,    [GRAS_DEP="$GRAS_DEP -lsocket"])
97
98 AC_MSG_CHECKING(for extra dependencies of libgras)
99 case $host_os in
100   *mingw* ) GRAS_DEP="$GRAS_DEP -lws2_32" ; SIMGRID_DEP="$SIMGRID_DEP -lws2_32" ;;
101 esac
102            
103 if test "x$GRAS_DEP" = x; then 
104    AC_MSG_RESULT(none)
105 else
106    AC_MSG_RESULT($GRAS_DEP)
107 fi
108 AC_SUBST([GRAS_DEP])
109
110 ##############################################
111 ## Enhance maintainer mode and SUBST variables
112 ## (must be placed after any compilation tests since our overprotective flags
113 ##  let some tests fail)
114
115 AM_MAINTAINER_MODE
116 if test x$USE_MAINTAINER_MODE = xyes 
117 then
118    GNOME_COMPILE_WARNINGS(yes)
119 fi
120
121 AC_SUBST(CFLAGS)
122 AC_SUBST(CPPFLAGS)
123 AC_SUBST(LDFLAGS)
124
125 #####################
126 ## Check for programs
127 ##
128
129 AC_CHECK_PROG(BASH, bash, `which bash`, /bin/sh)
130 WARNING="This file is generated, do not edit"
131 AC_SUBST(WARNING)
132
133 # Can we rebuild the parsers?
134 # We really want flex and refuse other lex. So, the parser is portable and
135 # does not induce extra lib dependency
136 AC_PROG_FLEX(2.5.30)
137                 
138 # Can we rebuild the xml-lexers from the XML specification?
139 # if not, simply touch the flex source files (which are distributed in
140 #  tarballs even if generated by flexml) and hope for the best.
141 AC_CHECK_PROG(FLEXML,flexml,,NOTFOUND)
142 AM_CONDITIONAL(HAVE_FLEXML,test x$FLEXML != NOTFOUND)
143
144 ###################
145 ## Makes the output
146 ##
147
148
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;