1 IZEOFdnl Process this file with autoconf to produce a configure script.
3 dnl Must reset CDPATH so that bash's cd does not print to stdout
7 AM_INIT_AUTOMAKE(ctsim,0.5.4-b3)
8 AM_CONFIG_HEADER(config.h)
10 dnl Checks for programs.
19 dnl AC_MSG_CHECKING([that the compiler works])
20 dnl AC_TRY_RUN([ main(int ac, char **av) { return 0; } ], AC_MSG_RESULT(yes), AC_MSG_RESULT(no) AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.), AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.))
22 dnl Check for C operation
26 AC_CHECK_SIZEOF(short, 2)
27 AC_CHECK_SIZEOF(int, 4)
28 AC_CHECK_SIZEOF(long, 4)
29 AC_CHECK_SIZEOF(float, 4)
30 AC_CHECK_SIZEOF(double, 8)
32 AC_MSG_CHECKING(endian)
35 i386* | i486* | i586* | i686* | vax*)
37 CFLAGS="$CFLAGS -DENDIAN_LOW=1 -DENDIAN_HIGH=0"
40 sparc* | mot* | ia64*)
42 CFLAGS="$CFLAGS -DENDIAN_LOW=0 -DENDIAN_HIGH=1"
46 AC_MSG_WARN([Unknown host cpu $host_cpu. Can't set endian])
50 dnl Checks for libraries.
57 AC_MSG_WARN([zlib missing. Will need zlib for PNG support])
60 AC_CHECK_LIB(curses, main, [curses=true], [curses=false])
61 AC_CHECK_LIB(ncurses, main, [ncurses=true], [ncurses=false])
62 AC_CHECK_LIB(g2, main, [g2=true], [g2=false])
64 dnl Checks for header files.
66 AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h sys/fcntl.h setjmp.h stdarg.h stddef.h sys/types.h sys/stat.h string.h ctype.h math.h stdio.h netinet/in.h inttypes.h sys/param.h stdint.h stdlib.h g2.h)
68 dnl Checks for typedefs, structures, and compiler characteristics.
74 dnl Checks for library functions.
76 AC_CHECK_FUNCS(strtod strtol snprintf htonl)
77 AC_CHECK_FUNC(basename)
79 if ${OSTYPE} == "cygwin" ; then
82 AC_CHECK_FUNC(getopt_long, [ getopt_long=true ], [ getopt_long=false ])
84 if test getopt_long == "false" ; then
85 my_includes="$myincludes -I../getopt"
86 AC_DEFINE(HAVE_GETOPT_LONG)
87 ctlibs_base="$ctlibs_base -lgetopt"
88 LDFLAGS="$LDFLAGS -L../getopt"
89 AM_CONDITIONAL(INCLUDED_GETOPT_LONG, test 1==1)
93 AC_ADD_GCC_CFLAGS([-Wall])
94 AC_MSG_CHECKING(whether to enable verbose warnings)
95 AC_ARG_ENABLE(verbose-warnings,
96 [ --enable-verbose-warnings
97 Enable verbose compiler warnings.],
98 [ case "$enableval" in
101 AC_ADD_GCC_CFLAGS([-W])
102 AC_ADD_GCC_CFLAGS([-Wshadow -Wpointer-arith -Wbad-function-cast])
103 AC_ADD_GCC_CFLAGS([-Wcast-align -Wwrite-strings -Waggregate-return])
104 AC_ADD_GCC_CFLAGS([-Wmissing-prototypes -Wstrict-prototypes])
105 AC_ADD_GCC_CFLAGS([-pedantic])
106 AC_ADD_GCC_CFLAGS([-Wredundant-decls])
112 esac ], AC_MSG_RESULT(no)
115 dnl Check for debug mode
117 [ --enable-debug Turn on debugging],
118 [case "${enableval}" in
125 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
128 AM_CONDITIONAL(DEBUG, test "$debug" = "true")
130 dnl Set PNG directory
131 AC_MSG_CHECKING([for PNG library installation])
133 [ --with-png[=PATH] Set path of lib PNG installation ],
135 if test "$withval" != "no" ; then
137 if test "$prefix" != "NONE" ; then
138 trypngdir="$trypngdir $prefix"
144 if test "$withval" != "no" -a "$zlib" = "true" ; then
145 for testpngdir in "." $trypngdir /usr/local /usr /opt ; do
146 if test -f "$testpngdir/lib/libpng.a" ; then
147 if test ! -f "$testpngdir/include/png.h" ; then
148 AC_MSG_ERROR([PNG library found, but png.h not found. Check PNG installation])
150 grep PNG_LIBPNG_VER_STRING "$testpngdir/include/png.h" | grep 9 > /dev/null
151 if test "$?" = "0" ; then
152 AC_MSG_ERROR([Your version of libpng in $testpngdir is too old -- please upgrade])
155 LDFLAGS="$LDFLAGS -L$testpngdir/lib"
156 CFLAGS="$CFLAGS -I$testpngdir/include"
160 elif test -f "$testpngdir/libpng.a" ; then
161 if test ! -f "$testpngdir/png.h" ; then
162 AC_MSG_ERROR([PNG library found, but png.h not found. Check PNG installation])
164 grep PNG_LIBPNG_VER_STRING "$testpngdir/png.h" | grep 9 > /dev/null
165 if test "$?" = "0" ; then
166 AC_MSG_ERROR([Your version of libpng in $testpngdir is too old -- please upgrade])
169 LDFLAGS="$LDFLAGS -L$testpngdir"
170 CFLAGS="$CFLAGS -I$testpngdir"
176 AC_MSG_RESULT($pngdir)
177 AM_CONDITIONAL(HAVE_PNG, test -n "$pngdir")
184 [ --with-lam[=PATH] Set path of LAM MPI ],
185 [ if test "$withval" != "no" ; then
190 if test "$withval" != "no" ; then
191 if test "$prefix" != "NONE" ; then
192 trylamdir="$trylamdir $prefix"
195 AC_MSG_CHECKING([for LAM MPI installation])
196 for testlamdir in "." $trylamdir /usr/local /usr/local/lam /usr /usr/lam /opt /opt/lam ; do
197 if test -x "$testlamdir/bin/hcc" ; then
198 LDFLAGS="$LDFLAGS -L$testlamdir/lib"
199 CFLAGS="$CFLAGS -I$testlamdir/include"
207 AC_MSG_RESULT($lamdir)
212 AC_MSG_CHECKING([for web access])
213 dnl Set cgi-bin directory
214 AC_ARG_WITH(cgibin-dir, [ --with-cgibin-dir=PATH Set path of CGI binaries directory ],
215 [ cgibindir=$withval ; AC_SUBST(cgibindir) ] )
217 AC_ARG_WITH(cgibin-url, [ --with-cgibin-url=PATH Set URL path of CGI binaries ],
218 [ cgibinurl=$withval ; AC_SUBST(cgibinurl) ] )
220 AC_ARG_WITH(webdata-dir, [ --with-webdata-dir=PATH Set path of webdata],
221 [ webdatadir=$withval ; AC_SUBST(webdatadir) ] )
223 AC_ARG_WITH(webdata-url, [ --with-webdata-url=PATH Set URL path of webdata],
224 [ webdataurl=$withval ; AC_SUBST(webdataurl) ] )
226 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Set directory of html files],
227 [ htmldir=$withval ; AC_SUBST(htmldir) ] )
229 if test -n "$cgibindir" -o -n "$cgibinurl" ; then
230 cgiprograms="ctsim.cgi ctsim.conf"
231 AC_SUBST(cgiprograms)
234 if test -n "$htmldir" ; then
235 htmldata=simulate.html
238 AM_CONDITIONAL(USE_HTML, test -n "$htmldir")
240 if test -n "$cgibindir" -o -n "$cgibinurl" -o -n "$webdatadir" -o -n "$webdataurl" -o -n "$htmldir" ; then
244 if test -z "$cgibindir" ; then
245 AC_MSG_ERROR([--with-cgibin-dir not set for web access])
246 elif test -z "$cgibinurl" ; then
247 AC_MSG_ERROR([--with-cgibin-url not set for web access])
248 elif test -z "$webdatadir" ; then
249 AC_MSG_ERROR([--with-webdata-dir not set for web access])
250 elif test -z "$webdataurl" ; then
251 AC_MSG_ERROR([--with-webdata-url not set for web access])
252 elif test -z "$htmldir" ; then
253 AC_MSG_ERROR([--with-html-dir not set for web access])
259 AM_CONDITIONAL(USE_LAM, test -n "$lamdir")
261 dnl Prepare to support X. If the user gave the command-line option
262 dnl --without-x, AC_PATH_XTRA will set no_x to "yes". Otherwise, it will
263 dnl add appropriate preprocessor flags to X_CFLAGS, and appropriate linker
264 dnl flags to X_LIBS. It also checks for system-specific X libraries, and
265 dnl adds them to X_PRE_LIBS or X_EXTRA_LIBS, as appropriate. (The former
266 dnl is where "-lSM -lICE" goes, in X11R6.) We define the X_TOOLKIT_LIBS
267 dnl and X_BASIC_LIBS argument vectors ourselves, and if X is to be
268 dnl supported, we'll concatenate the whole lot of these into a command line
269 dnl for libtool. See, e.g., the libplot_la_LIBADD line in
270 dnl libplot/Makefile.am.
274 dnl Following five are concatenated together into a linker specification.
276 AC_SUBST(X_TOOLKIT_LIBS)
278 AC_SUBST(X_BASIC_LIBS)
279 AC_SUBST(X_EXTRA_LIBS)
281 X_TOOLKIT_LIBS="-lXt"
282 X_BASIC_LIBS="-lXext -lX11"
284 dnl Check whether libXt has thread support. Some platforms may have
285 dnl pthread support in libc, but no thread support in libXt/libX11.
286 our_saved_LDFLAGS="$LDFLAGS"
287 LDFLAGS="$X_LIBS $LDFLAGS"
288 AC_CHECK_LIB(Xt, XtToolkitThreadInitialize, AC_DEFINE(X_THREAD_SUPPORT), , $X_PRE_LIBS $X_BASIC_LIBS $X_EXTRA_LIBS)
289 LDFLAGS="$our_saved_LDFLAGS"
291 dnl Check in -lXext for double buffering extensions to X11, and check
292 dnl whether appropriate header files are present. (Some systems have one
293 dnl but not the other.)
294 our_saved_LDFLAGS="$LDFLAGS"
295 LDFLAGS="$X_LIBS $LDFLAGS"
296 AC_CHECK_LIB(Xext, XdbeQueryExtension, AC_DEFINE(HAVE_DBE_SUPPORT), , -lX11 "$X_EXTRA_LIBS")
297 AC_CHECK_LIB(Xext, XmbufQueryExtension, AC_DEFINE(HAVE_MBX_SUPPORT), , -lX11 "$X_EXTRA_LIBS")
298 LDFLAGS="$our_saved_LDFLAGS"
299 our_saved_CPPFLAGS="$CPPFLAGS"
300 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
301 AC_CHECK_HEADERS(X11/extensions/Xdbe.h X11/extensions/multibuf.h)
302 CPPFLAGS="$our_saved_CPPFLAGS"
304 dnl Our Makefile.am files test the automake variable NO_X to determine
305 dnl whether X should be supported.
306 AM_CONDITIONAL(NO_X, test "x$no_x" = "xyes")
308 my_includes="$my_includes -I../include -I.."
309 AC_SUBST(my_includes)
311 AC_MSG_CHECKING([interactive graphics])
312 if test "x$no_x" != "xyes" ; then
315 AM_CONDITIONAL(HAVE_SGP, test 1==1)
316 LDFLAGS="$LDFLAGS -L../libezplot -L../libgraph -L/usr/X11R6/lib"
317 ctlibs_base="$ctlibs_base -lezplot -lgraph $X_BASIC_LIBS $X_TOOLKIT_LIBS"
323 dnl Setting projet libraries and includes
324 LDFLAGS="$LDFLAGS -L../libkmath -L../libk -L../libcio -L../libir"
325 ctlibs_base="$ctlibs_base -lkmath -lk -lcio"
326 if test -n "$pngdir" ; then
327 ctlibs_base="$ctlibs_base -lpng"
329 if test "$zlib" = "true" ; then
330 ctlibs_base="$ctlibs_base -lz"
332 if test "$g2" = "true" ; then
333 ctlibs_base="$ctlibs_base -lg2"
336 ctlibs="-lir $ctlibs_base"
340 if test -n "$lamdir" ; then
341 ctlamlibs="-lir_lam $ctlibs_base"
342 lamprograms="ctrec-lam phm2sdf-lam phm2rs-lam"
343 AC_SUBST(lamprograms)
347 AC_OUTPUT(Makefile libezplot/Makefile src/Makefile libgraph/Makefile libkmath/Makefile Makefile libk/Makefile libir/Makefile libcio/Makefile man/Makefile cgi-bin/ctsim.cgi cgi-bin/Makefile html/simulate.html html/Makefile include/Makefile getopt/Makefile src/sample-ctrec.sh cgi-bin/ctsim.conf)