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.0)
8 AM_CONFIG_HEADER(config.h)
10 dnl Checks for programs.
17 dnl Checks for libraries.
24 AC_MSG_WARN([zlib missing. Will need zlib for PNG support])
28 dnl Checks for header files.
30 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)
32 dnl Checks for typedefs, structures, and compiler characteristics.
38 dnl Checks for library functions.
40 AC_CHECK_FUNCS(strtod strtol)
41 AC_CHECK_FUNC(basename)
43 AC_CHECK_FUNC(getopt_long,
49 my_includes="$myincludes -I../getopt"
50 AC_DEFINE(HAVE_GETOPT_LONG)
51 ctlibs_base="$ctlibs_base -lgetopt"
52 LDFLAGS="$LDFLAGS -L../getopt"
53 AM_CONDITIONAL(INCLUDED_GETOPT_LONG, test 1==1)
57 AC_ADD_GCC_CFLAGS([-Wall])
58 AC_MSG_CHECKING(whether to enable verbose warnings)
59 AC_ARG_ENABLE(verbose-warnings,
60 [ --enable-verbose-warnings
61 Enable verbose compiler warnings.],
62 [ case "$enableval" in
65 AC_ADD_GCC_CFLAGS([-W])
66 AC_ADD_GCC_CFLAGS([-Wshadow -Wpointer-arith -Wbad-function-cast])
67 AC_ADD_GCC_CFLAGS([-Wcast-align -Wwrite-strings -Waggregate-return])
68 AC_ADD_GCC_CFLAGS([-Wmissing-prototypes -Wstrict-prototypes])
69 AC_ADD_GCC_CFLAGS([-pedantic])
70 AC_ADD_GCC_CFLAGS([-Wredundant-decls])
76 esac ], AC_MSG_RESULT(no)
79 dnl Check for debug mode
81 [ --enable-debug Turn on debugging],
82 [case "${enableval}" in
85 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
87 AM_CONDITIONAL(DEBUG, test "$debug" = "true")
90 AC_MSG_CHECKING([for PNG library installation])
92 [ --with-png[=PATH] Set path of lib PNG installation ],
94 if test "$withval" != "no" ; then
96 if test "$prefix" != "NONE" ; then
97 trypngdir="$trypngdir $prefix"
103 if test "$withval" != "no" -a "$zlib" = "true" ; then
104 for testpngdir in "." $trypngdir /usr/local /usr /opt ; do
105 if test -f "$testpngdir/lib/libpng.a" ; then
106 if test ! -f "$testpngdir/include/png.h" ; then
107 AC_MSG_ERROR([PNG library found, but png.h not found. Check PNG installation])
109 grep PNG_LIBPNG_VER_STRING "$testpngdir/include/png.h" | grep 9 > /dev/null
110 if test "$?" = "0" ; then
111 AC_MSG_ERROR([Your version of libpng in $testpngdir is too old -- please upgrade])
114 LDFLAGS="$LDFLAGS -L$testpngdir/lib"
115 CFLAGS="$CFLAGS -I$testpngdir/include"
119 elif test -f "$testpngdir/libpng.a" ; then
120 if test ! -f "$testpngdir/png.h" ; then
121 AC_MSG_ERROR([PNG library found, but png.h not found. Check PNG installation])
123 grep PNG_LIBPNG_VER_STRING "$testpngdir/png.h" | grep 9 > /dev/null
124 if test "$?" = "0" ; then
125 AC_MSG_ERROR([Your version of libpng in $testpngdir is too old -- please upgrade])
128 LDFLAGS="$LDFLAGS -L$testpngdir"
129 CFLAGS="$CFLAGS -I$testpngdir"
135 AC_MSG_RESULT($pngdir)
136 AM_CONDITIONAL(HAVE_PNG, test -n "$pngdir")
143 [ --with-lam[=PATH] Set path of LAM MPI ],
144 [ if test "$withval" != "no" ; then
149 if test "$withval" != "no" ; then
150 if test "$prefix" != "NONE" ; then
151 trylamdir="$trylamdir $prefix"
154 AC_MSG_CHECKING([for LAM MPI installation])
155 for testlamdir in "." $trylamdir /usr/local /usr/local/lam /usr /usr/lam /opt /opt/lam ; do
156 if test -x "$testlamdir/bin/hcc" ; then
157 LDFLAGS="$LDFLAGS -L$testlamdir/lib"
158 CFLAGS="$CFLAGS -I$testlamdir/include"
164 AC_MSG_RESULT($lamdir)
167 AC_MSG_CHECKING([for web access])
168 dnl Set cgi-bin directory
169 AC_ARG_WITH(cgibin-dir, [ --with-cgibin-dir=PATH Set path of CGI binaries directory ],
170 [ cgibindir=$withval ; AC_SUBST(cgibindir) ] )
172 AC_ARG_WITH(cgibin-url, [ --with-cgibin-url=PATH Set URL path of CGI binaries ],
173 [ cgibinurl=$withval ; AC_SUBST(cgibinurl) ] )
175 AC_ARG_WITH(webdata-dir, [ --with-webdata-dir=PATH Set path of webdata],
176 [ webdatadir=$withval ; AC_SUBST(webdatadir) ] )
178 AC_ARG_WITH(webdata-url, [ --with-webdata-url=PATH Set URL path of webdata],
179 [ webdataurl=$withval ; AC_SUBST(webdataurl) ] )
181 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Set directory of html files],
182 [ htmldir=$withval ; AC_SUBST(htmldir) ] )
184 if test -n "$cgibindir" -o -n "$cgibinurl" ; then
185 cgiprograms=ctsim.cgi
186 AC_SUBST(cgiprograms)
189 if test -n "$htmldir" ; then
193 AM_CONDITIONAL(USE_HTML, test -n "$htmldir")
195 if test -n "$cgibindir" -o -n "$cgibinurl" -o -n "$webdatadir" -o -n "$webdataurl" -o -n "$htmldir" ; then
199 if test -z "$cgibindir" ; then
200 AC_MSG_ERROR([--with-cgibin-dir not set for web access])
201 elif test -z "$cgibinurl" ; then
202 AC_MSG_ERROR([--with-cgibin-url not set for web access])
203 elif test -z "$webdatadir" ; then
204 AC_MSG_ERROR([--with-webdata-dir not set for web access])
205 elif test -z "$webdataurl" ; then
206 AC_MSG_ERROR([--with-webdata-url not set for web access])
207 elif test -z "$htmldir" ; then
208 AC_MSG_ERROR([--with-html-dir not set for web access])
214 dnl Setting projet libraries and includes
215 LDFLAGS="$LDFLAGS -L../libezplot -L../libgraph -L../libkmath -L../libk -L../libcio -L../libir"
216 ctlibs_base="$ctlibs_base -lezplot -lgraph -lkmath -lk -lcio"
217 if test -n "$pngdir" ; then
218 ctlibs_base="$ctlibs_base -lpng"
220 if test "$zlib" = "true" ; then
221 ctlibs_base="$ctlibs_base -lz"
223 ctlibs="-lir $ctlibs_base"
227 if test -n "$lamdir" ; then
228 ctlamlibs="-lir_lam $ctlibs_base"
229 lamprograms="ctrec-lam phm2sdf-lam phm2rs-lam"
230 AC_SUBST(lamprograms)
234 AM_CONDITIONAL(USE_LAM, test -n "$lamdir")
236 dnl Prepare to support X. If the user gave the command-line option
237 dnl --without-x, AC_PATH_XTRA will set no_x to "yes". Otherwise, it will
238 dnl add appropriate preprocessor flags to X_CFLAGS, and appropriate linker
239 dnl flags to X_LIBS. It also checks for system-specific X libraries, and
240 dnl adds them to X_PRE_LIBS or X_EXTRA_LIBS, as appropriate. (The former
241 dnl is where "-lSM -lICE" goes, in X11R6.) We define the X_TOOLKIT_LIBS
242 dnl and X_BASIC_LIBS argument vectors ourselves, and if X is to be
243 dnl supported, we'll concatenate the whole lot of these into a command line
244 dnl for libtool. See, e.g., the libplot_la_LIBADD line in
245 dnl libplot/Makefile.am.
249 dnl Following five are concatenated together into a linker specification.
251 AC_SUBST(X_TOOLKIT_LIBS)
253 AC_SUBST(X_BASIC_LIBS)
254 AC_SUBST(X_EXTRA_LIBS)
256 X_TOOLKIT_LIBS="-lXt"
257 X_BASIC_LIBS="-lXext -lX11"
259 dnl Check whether libXt has thread support. Some platforms may have
260 dnl pthread support in libc, but no thread support in libXt/libX11.
261 our_saved_LDFLAGS="$LDFLAGS"
262 LDFLAGS="$X_LIBS $LDFLAGS"
263 AC_CHECK_LIB(Xt, XtToolkitThreadInitialize, AC_DEFINE(X_THREAD_SUPPORT), , $X_PRE_LIBS $X_BASIC_LIBS $X_EXTRA_LIBS)
264 LDFLAGS="$our_saved_LDFLAGS"
266 dnl Check in -lXext for double buffering extensions to X11, and check
267 dnl whether appropriate header files are present. (Some systems have one
268 dnl but not the other.)
269 our_saved_LDFLAGS="$LDFLAGS"
270 LDFLAGS="$X_LIBS $LDFLAGS"
271 AC_CHECK_LIB(Xext, XdbeQueryExtension, AC_DEFINE(HAVE_DBE_SUPPORT), , -lX11 "$X_EXTRA_LIBS")
272 AC_CHECK_LIB(Xext, XmbufQueryExtension, AC_DEFINE(HAVE_MBX_SUPPORT), , -lX11 "$X_EXTRA_LIBS")
273 LDFLAGS="$our_saved_LDFLAGS"
274 our_saved_CPPFLAGS="$CPPFLAGS"
275 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
276 AC_CHECK_HEADERS(X11/extensions/Xdbe.h X11/extensions/multibuf.h)
277 CPPFLAGS="$our_saved_CPPFLAGS"
279 dnl Our Makefile.am files test the automake variable NO_X to determine
280 dnl whether X should be supported.
281 AM_CONDITIONAL(NO_X, test "x$no_x" = "xyes")
283 my_includes="$my_includes -I../include -I.."
284 AC_SUBST(my_includes)
286 AM_CONDITIONAL(HAVE_INTERACTIVE_GRAPHICS, test 1==0)
288 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/ctsim.html html/Makefile include/Makefile getopt/Makefile src/sample-ctrec.sh)