Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Wrap potentially NULL strings to protect solaris
[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 \
45                   sys/stat.h \
46                   windows.h winsock.h winsock2.h \
47                   sys/time.h \
48                   errno.h unistd.h ])
49 AC_CHECK_FUNCS([gettimeofday usleep \
50                 getdtablesize \
51                 sysconf])
52
53 AC_ARG_ENABLE(context,
54   [  --enable-context=[ucontext/pthread]   Use either (System V) swapcontext or pthread [[default=ucontext]].],,
55   enable_context=pthread)
56 AC_MSG_CHECKING(on top of what can we build the contexts)
57 if test "x$enable_context" = "xucontext"; then
58   AC_CHECK_HEADERS([ucontext.h])
59   ac_header=ucontext.h
60   as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
61   if test `eval echo '${'$as_ac_Header'}'` = yes; then
62     AC_MSG_RESULT(found ucontext.h. Great!)
63   else
64     ac_header=windows.h
65     as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
66     if test `eval echo '${'$as_ac_Header'}'` = yes; then
67       AC_MSG_RESULT(you don't have ucontext.h but we provide an alternative for windows so you should be fine.")
68     else
69       AC_MSG_RESULT([[cannot find ucontext. I'm going to try as if you had set --enable-context=pthreads !]])
70       enable_context=pthreads
71     fi
72   fi
73 else if test "x$enable_context" = "xpthread"; then
74   AC_CHECK_HEADERS([pthread.h])
75   AC_CHECK_LIB(pthread,pthread_create,,
76     [AC_MSG_ERROR([[Cannot find pthreads, no way (try --enable-context=ucontext if you haven't already tried).]])])
77   AC_DEFINE([USE_PTHREADS],1,[Define if we USE pthreads or not])
78   AC_MSG_RESULT(You have pthreads. Let's use them.)
79 else 
80   AC_MSG_ERROR("--enable-context must be either ucontext or pthread")
81 fi fi
82
83
84 # Checks for typedefs, structures, and compiler characteristics.
85 AC_C_CONST
86 AC_C_INLINE
87 AC_TYPE_SIZE_T
88
89 # Checks for library functions.
90 dnl A C_FUNC_MEMCMP
91 dnl A C_CHECK_FUNCS([memset strchr strerror usleep])
92
93 dnl ####[ Search libs ]#######################################################
94 dnl A CI_PACKAGE([S imGrid],[the SimGrid simulator],[SG_init],[-lsimgrid],[simgrid.h],,:)
95 dnl A M_CONDITIONAL(HAVE_SG,test x$HAVE_SimGrid = xyes)
96 dnl if test x$HAVE_SimGrid = xyes; then
97 dnl   SIMGRID_DEP="-lsimgrid"
98 dnl else
99   SIMGRID_DEP=""
100 dnl fi
101 AC_SUBST([SIMGRID_DEP])
102
103
104 dnl A C_CHECK_LIB(pthread, pthread_mutex_lock, LIBS="$LIBS -lpthread")
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 dnl ####[ maint mode ]#######################################################
122 AM_MAINTAINER_MODE
123 if test x$USE_MAINTAINER_MODE = xyes 
124 then
125 #   enable_iso_c=yes             # Let's go funky
126    GNOME_COMPILE_WARNINGS(yes)
127 fi
128
129 AC_SUBST(CFLAGS)
130 AC_SUBST(CPPFLAGS)
131 AC_SUBST(LDFLAGS)
132
133 dnl ####[ check for some programms ]###########################################
134 AC_CHECK_PROG(BASH, bash, `which bash`, /bin/sh)
135 WARNING="This file is generated, do not edit"
136 AC_SUBST(WARNING)
137
138 # Can we rebuild the parsers?
139 # We really want flex and refuse other lex. So, the parser is portable and
140 # does not induce extra lib dependency
141 AC_PROG_FLEX(2.5.30)
142                 
143 # Can we rebuild the xml-lexers from the XML specification?
144 # if not, simply touch the flex source files (which are distributed in
145 #  tarballs even if generated by flexml) and hope for the best.
146 AC_CHECK_PROG(FLEXML,flexml,,NOTFOUND)
147 AM_CONDITIONAL(HAVE_FLEXML,test x$FLEXML != NOTFOUND)
148
149 dnl ####[ Makes the output ]###################################################
150 #    examples/bandwidth/Makefile examples/bandwidth/test_sg
151 #    examples/pastry/Makefile    examples/pastry/test_sg
152
153 AC_CONFIG_FILES([
154   Makefile
155   include/Makefile
156   src/Makefile
157   src/amok/Makefile
158   examples/Makefile 
159     examples/msg/Makefile          examples/msg/run_msg_test
160     examples/gras/Makefile 
161       examples/gras/ping/Makefile  examples/gras/ping/test_sg  examples/gras/ping/test_rl
162       examples/gras/timer/Makefile examples/gras/timer/test_sg examples/gras/timer/test_rl
163       examples/gras/chrono/Makefile examples/gras/chrono/test_sg examples/gras/chrono/test_rl
164   doc/Makefile
165     doc/Doxyfile.main           doc/Doxyfile.API          doc/Doxyfile.Examples   
166   tools/compile-remote-worker tools/Makefile
167     tools/gras/Makefile
168   testsuite/Makefile
169   testsuite/run_tests    
170   testsuite/gras/trp_tcp_usage
171   testsuite/gras/trp_file_usage
172 ],[
173     for file in                                                 \
174      testsuite/run_tests                                        \
175      testsuite/gras/trp_tcp_usage testsuite/gras/trp_file_usage \
176      tools/compile-remote-worker                                \
177      examples/msg/run_msg_test                                  \
178      examples/gras/ping/test_sg   examples/gras/ping/test_rl    \
179      examples/gras/timer/test_sg  examples/gras/timer/test_rl   \
180      examples/gras/chrono/test_sg  examples/gras/chrono/test_rl \
181     ; do                                                        \
182       test -e $file && chmod +x $file;                          \
183     done
184     chmod +x $srcdir/tools/gras-check-arch;
185 ])
186
187 #    examples/gras/pastry/test_sg   
188 #    examples/gras/bandwidth/test_sg 
189
190
191
192 #    examples/gras/saturate/Makefile  examples/gras/saturate/test_sg
193 #    examples/gras/alnem/Makefile     examples/gras/alnem/test_sg
194
195
196
197 AC_OUTPUT
198
199 echo "
200
201 Configuration of package \`${PACKAGE}' on $gras_arch_name (=$gras_arch):
202
203         Compiler:       ${CC}
204
205         CFlags:         ${CFLAGS}
206         LDFlags:        ${LDFLAGS}
207 "
208
209 exit 0;