1 dnl 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-b2)
8 AM_CONFIG_HEADER(config.h)
10 dnl Checks for programs.
18 dnl Check for C operation
22 dnl AC_CHECK_SIZEOF(int)
23 dnl AC_CHECK_SIZEOF(long int)
24 dnl AC_CHECK_SIZEOF(float)
25 dnl AC_CHECK_SIZEOF(double)
27 AC_MSG_CHECKING(endian)
30 i386* | i486* | i586* | i686* | vax*)
32 CFLAGS="$CFLAGS -DENDIAN_LOW=1 -DENDIAN_HIGH=0"
37 CFLAGS="$CFLAGS -DENDIAN_LOW=0 -DENDIAN_HIGH=1"
41 AC_MSG_ERROR([Unknown host cpu $host_cpu
46 dnl Checks for libraries.
53 AC_MSG_WARN([zlib missing. Will need zlib for PNG support])
56 AC_CHECK_LIB(curses, main, [curses=true], [curses=false])
57 AC_CHECK_LIB(ncurses, main, [ncurses=true], [ncurses=false])
58 AC_CHECK_LIB(g2, main, [g2=true], [g2=false])
60 dnl Checks for header files.
62 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)
64 dnl Checks for typedefs, structures, and compiler characteristics.
70 dnl Checks for library functions.
72 AC_CHECK_FUNCS(strtod strtol snprintf htonl)
73 AC_CHECK_FUNC(basename)
75 AC_CHECK_FUNC(getopt_long,
81 my_includes="$myincludes -I../getopt"
82 AC_DEFINE(HAVE_GETOPT_LONG)
83 ctlibs_base="$ctlibs_base -lgetopt"
84 LDFLAGS="$LDFLAGS -L../getopt"
85 AM_CONDITIONAL(INCLUDED_GETOPT_LONG, test 1==1)
89 AC_ADD_GCC_CFLAGS([-Wall])
90 AC_MSG_CHECKING(whether to enable verbose warnings)
91 AC_ARG_ENABLE(verbose-warnings,
92 [ --enable-verbose-warnings
93 Enable verbose compiler warnings.],
94 [ case "$enableval" in
97 AC_ADD_GCC_CFLAGS([-W])
98 AC_ADD_GCC_CFLAGS([-Wshadow -Wpointer-arith -Wbad-function-cast])
99 AC_ADD_GCC_CFLAGS([-Wcast-align -Wwrite-strings -Waggregate-return])
100 AC_ADD_GCC_CFLAGS([-Wmissing-prototypes -Wstrict-prototypes])
101 AC_ADD_GCC_CFLAGS([-pedantic])
102 AC_ADD_GCC_CFLAGS([-Wredundant-decls])
108 esac ], AC_MSG_RESULT(no)
111 dnl Check for debug mode
113 [ --enable-debug Turn on debugging],
114 [case "${enableval}" in
121 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
124 AM_CONDITIONAL(DEBUG, test "$debug" = "true")
126 dnl Set PNG directory
127 AC_MSG_CHECKING([for PNG library installation])
129 [ --with-png[=PATH] Set path of lib PNG installation ],
131 if test "$withval" != "no" ; then
133 if test "$prefix" != "NONE" ; then
134 trypngdir="$trypngdir $prefix"
140 if test "$withval" != "no" -a "$zlib" = "true" ; then
141 for testpngdir in "." $trypngdir /usr/local /usr /opt ; do
142 if test -f "$testpngdir/lib/libpng.a" ; then
143 if test ! -f "$testpngdir/include/png.h" ; then
144 AC_MSG_ERROR([PNG library found, but png.h not found. Check PNG installation])
146 grep PNG_LIBPNG_VER_STRING "$testpngdir/include/png.h" | grep 9 > /dev/null
147 if test "$?" = "0" ; then
148 AC_MSG_ERROR([Your version of libpng in $testpngdir is too old -- please upgrade])
151 LDFLAGS="$LDFLAGS -L$testpngdir/lib"
152 CFLAGS="$CFLAGS -I$testpngdir/include"
156 elif test -f "$testpngdir/libpng.a" ; then
157 if test ! -f "$testpngdir/png.h" ; then
158 AC_MSG_ERROR([PNG library found, but png.h not found. Check PNG installation])
160 grep PNG_LIBPNG_VER_STRING "$testpngdir/png.h" | grep 9 > /dev/null
161 if test "$?" = "0" ; then
162 AC_MSG_ERROR([Your version of libpng in $testpngdir is too old -- please upgrade])
165 LDFLAGS="$LDFLAGS -L$testpngdir"
166 CFLAGS="$CFLAGS -I$testpngdir"
172 AC_MSG_RESULT($pngdir)
173 AM_CONDITIONAL(HAVE_PNG, test -n "$pngdir")
180 [ --with-lam[=PATH] Set path of LAM MPI ],
181 [ if test "$withval" != "no" ; then
186 if test "$withval" != "no" ; then
187 if test "$prefix" != "NONE" ; then
188 trylamdir="$trylamdir $prefix"
191 AC_MSG_CHECKING([for LAM MPI installation])
192 for testlamdir in "." $trylamdir /usr/local /usr/local/lam /usr /usr/lam /opt /opt/lam ; do
193 if test -x "$testlamdir/bin/hcc" ; then
194 LDFLAGS="$LDFLAGS -L$testlamdir/lib"
195 CFLAGS="$CFLAGS -I$testlamdir/include"
203 AC_MSG_RESULT($lamdir)
206 AC_MSG_CHECKING([for web access])
207 dnl Set cgi-bin directory
208 AC_ARG_WITH(cgibin-dir, [ --with-cgibin-dir=PATH Set path of CGI binaries directory ],
209 [ cgibindir=$withval ; AC_SUBST(cgibindir) ] )
211 AC_ARG_WITH(cgibin-url, [ --with-cgibin-url=PATH Set URL path of CGI binaries ],
212 [ cgibinurl=$withval ; AC_SUBST(cgibinurl) ] )
214 AC_ARG_WITH(webdata-dir, [ --with-webdata-dir=PATH Set path of webdata],
215 [ webdatadir=$withval ; AC_SUBST(webdatadir) ] )
217 AC_ARG_WITH(webdata-url, [ --with-webdata-url=PATH Set URL path of webdata],
218 [ webdataurl=$withval ; AC_SUBST(webdataurl) ] )
220 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Set directory of html files],
221 [ htmldir=$withval ; AC_SUBST(htmldir) ] )
223 if test -n "$cgibindir" -o -n "$cgibinurl" ; then
224 cgiprograms="ctsim.cgi ctsim.conf"
225 AC_SUBST(cgiprograms)
228 if test -n "$htmldir" ; then
229 htmldata=simulate.html
232 AM_CONDITIONAL(USE_HTML, test -n "$htmldir")
234 if test -n "$cgibindir" -o -n "$cgibinurl" -o -n "$webdatadir" -o -n "$webdataurl" -o -n "$htmldir" ; then
238 if test -z "$cgibindir" ; then
239 AC_MSG_ERROR([--with-cgibin-dir not set for web access])
240 elif test -z "$cgibinurl" ; then
241 AC_MSG_ERROR([--with-cgibin-url not set for web access])
242 elif test -z "$webdatadir" ; then
243 AC_MSG_ERROR([--with-webdata-dir not set for web access])
244 elif test -z "$webdataurl" ; then
245 AC_MSG_ERROR([--with-webdata-url not set for web access])
246 elif test -z "$htmldir" ; then
247 AC_MSG_ERROR([--with-html-dir not set for web access])
253 AM_CONDITIONAL(USE_LAM, test -n "$lamdir")
255 dnl Prepare to support X. If the user gave the command-line option
256 dnl --without-x, AC_PATH_XTRA will set no_x to "yes". Otherwise, it will
257 dnl add appropriate preprocessor flags to X_CFLAGS, and appropriate linker
258 dnl flags to X_LIBS. It also checks for system-specific X libraries, and
259 dnl adds them to X_PRE_LIBS or X_EXTRA_LIBS, as appropriate. (The former
260 dnl is where "-lSM -lICE" goes, in X11R6.) We define the X_TOOLKIT_LIBS
261 dnl and X_BASIC_LIBS argument vectors ourselves, and if X is to be
262 dnl supported, we'll concatenate the whole lot of these into a command line
263 dnl for libtool. See, e.g., the libplot_la_LIBADD line in
264 dnl libplot/Makefile.am.
268 dnl Following five are concatenated together into a linker specification.
270 AC_SUBST(X_TOOLKIT_LIBS)
272 AC_SUBST(X_BASIC_LIBS)
273 AC_SUBST(X_EXTRA_LIBS)
275 X_TOOLKIT_LIBS="-lXt"
276 X_BASIC_LIBS="-lXext -lX11"
278 dnl Check whether libXt has thread support. Some platforms may have
279 dnl pthread support in libc, but no thread support in libXt/libX11.
280 our_saved_LDFLAGS="$LDFLAGS"
281 LDFLAGS="$X_LIBS $LDFLAGS"
282 AC_CHECK_LIB(Xt, XtToolkitThreadInitialize, AC_DEFINE(X_THREAD_SUPPORT), , $X_PRE_LIBS $X_BASIC_LIBS $X_EXTRA_LIBS)
283 LDFLAGS="$our_saved_LDFLAGS"
285 dnl Check in -lXext for double buffering extensions to X11, and check
286 dnl whether appropriate header files are present. (Some systems have one
287 dnl but not the other.)
288 our_saved_LDFLAGS="$LDFLAGS"
289 LDFLAGS="$X_LIBS $LDFLAGS"
290 AC_CHECK_LIB(Xext, XdbeQueryExtension, AC_DEFINE(HAVE_DBE_SUPPORT), , -lX11 "$X_EXTRA_LIBS")
291 AC_CHECK_LIB(Xext, XmbufQueryExtension, AC_DEFINE(HAVE_MBX_SUPPORT), , -lX11 "$X_EXTRA_LIBS")
292 LDFLAGS="$our_saved_LDFLAGS"
293 our_saved_CPPFLAGS="$CPPFLAGS"
294 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
295 AC_CHECK_HEADERS(X11/extensions/Xdbe.h X11/extensions/multibuf.h)
296 CPPFLAGS="$our_saved_CPPFLAGS"
298 dnl Our Makefile.am files test the automake variable NO_X to determine
299 dnl whether X should be supported.
300 AM_CONDITIONAL(NO_X, test "x$no_x" = "xyes")
302 my_includes="$my_includes -I../include -I.."
303 AC_SUBST(my_includes)
305 AC_MSG_CHECKING([interactive graphics])
306 if test "x$no_x" != "xyes" ; then
309 AM_CONDITIONAL(HAVE_SGP, test 1==1)
310 LDFLAGS="$LDFLAGS -L../libezplot -L../libgraph -L/usr/X11R6/lib"
311 ctlibs_base="$ctlibs_base -lezplot -lgraph $X_BASIC_LIBS $X_TOOLKIT_LIBS"
317 dnl Setting projet libraries and includes
318 LDFLAGS="$LDFLAGS -L../libkmath -L../libk -L../libcio -L../libir"
319 ctlibs_base="$ctlibs_base -lkmath -lk -lcio"
320 if test -n "$pngdir" ; then
321 ctlibs_base="$ctlibs_base -lpng"
323 if test "$zlib" = "true" ; then
324 ctlibs_base="$ctlibs_base -lz"
326 if test "$g2" = "true" ; then
327 ctlibs_base="$ctlibs_base -lg2"
330 ctlibs="-lir $ctlibs_base"
334 if test -n "$lamdir" ; then
335 ctlamlibs="-lir_lam $ctlibs_base"
336 lamprograms="ctrec-lam phm2sdf-lam phm2rs-lam"
337 AC_SUBST(lamprograms)
341 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)