1
dnl Configure template for the GNU plotutils package.
2
dnl Copyright (C) 1989-2000 Free Software Foundation, Inc.
3
dnl Process this file with autoconf to produce a configure script.
6
AM_INIT_AUTOMAKE(plotutils, 2.4.1)
7
AM_CONFIG_HEADER(config.h)
9
dnl Did installer set the CFLAGS and CXXFLAGS environ variables before
10
dnl running configure? Our default CFLAGS and CXXFLAGS differ from
11
dnl autoconf's, but we won't override installer-specified values.
12
if test "x$CFLAGS" = "x"; then
13
CFLAGS_NOT_SET_BY_INSTALLER="yes"
15
CFLAGS_NOT_SET_BY_INSTALLER="no"
17
if test "x$CXXFLAGS" = "x"; then
18
CXXFLAGS_NOT_SET_BY_INSTALLER="yes"
20
CXXFLAGS_NOT_SET_BY_INSTALLER="no"
23
dnl We now use libtool to make and installed a shared library. This should
24
dnl invoke the tests AC_PROG_CC, AC_OBJEXT, AC_PROG_INSTALL, and
25
dnl AC_PROG_MAKE_SET, or equivalents, so we don't perform them explicitly.
26
dnl Note: this can apparently alter CFLAGS, on a few platforms, e.g., on
27
dnl SCO OpenServer 5 (i.e. *-*-sco3.2v5*), "-belf" is added.
30
dnl Determine extension (e.g. ".exe") on executables, if any.
33
dnl Compiler characteristics and typedefs.
34
AC_MSG_CHECKING(for void)
35
AC_TRY_COMPILE(, [void *foo = 0;], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_VOID)], [AC_MSG_RESULT(no)])
41
dnl Check whether fflush(NULL) works
42
AC_MSG_CHECKING(whether flushing a null FILE pointer works)
50
if ((fpw = fopen ("conftest0", "w")) == (FILE *)0
51
|| fwrite ("FOOBAR", 1, 7, fpw) != 7
52
|| fflush ((FILE *)0) < 0
53
|| (fpr = fopen ("conftest0", "r")) == (FILE *)0
54
|| fread (test_array, 1, 7, fpr) != 7)
58
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NULL_FLUSH)], [AC_MSG_RESULT(no); AC_DEFINE(DONT_HAVE_NULL_FLUSH)], [AC_MSG_RESULT(no); AC_DEFINE(DONT_HAVE_NULL_FLUSH)])
60
dnl Checks for header files: ANSI C, POSIX, and nonstandard Unix headers.
62
AC_CHECK_HEADERS(string.h limits.h float.h)
63
AC_CHECK_HEADERS(malloc.h pthread.h strings.h unistd.h values.h sys/select.h sys/stdtypes.h sys/time.h sys/types.h sys/wait.h)
66
dnl HP/UX needs a cpp definition for math.h to define matherr-related things
67
AC_EGREP_HEADER(_HPUX_SOURCE, math.h, AC_EGREP_HEADER(matherr, math.h, AC_DEFINE(_HPUX_SOURCE)))
72
dnl Necessitated by lack of support in autoconf for libtool.
73
LTALLOCA=`echo "$ALLOCA" | sed 's/\.o/.lo/g'`
76
dnl Checks for programs
80
dnl Should libplot/libplotter support multithreading via pthread mutexes?
81
dnl Check to see whether libc includes dummy ("weak") pthread functions, so
82
dnl that executables may be linked with a library that uses mutexes without
83
dnl also linking with -lpthread. (This is the case with glibc under
85
AC_CHECK_LIB(c, pthread_mutex_init, AC_DEFINE(PTHREAD_SUPPORT))
87
dnl Do we have the thread-safe library functions ctime_r(), localtime_r()?
88
AC_CHECK_FUNCS(ctime_r localtime_r)
90
dnl Do we have the POSIX waitpid() function?
91
AC_CHECK_FUNCS(waitpid)
93
dnl Other non-X library functions and auxiliary libraries.
95
dnl SGI's have matherr in libmx.a, not libm.a
96
AC_CHECK_LIB(mx, matherr, LIBS="$LIBS -lmx", LIBS="$LIBS -lm")
97
AC_CHECK_FUNCS(memcpy memmove strchr strcasecmp strerror matherr j0 erf)
98
dnl lgamma() and gamma() both compute the log of the gamma function. There
99
dnl are old systems out there which do not have lgamma (the name was
100
dnl introduced after BSD 4.2), but which do have gamma. Also some systems,
101
dnl new and old, have lgamma but not gamma.
102
AC_CHECK_FUNCS(lgamma gamma)
104
dnl Prepare to support X. If the user gave the command-line option
105
dnl --without-x, AC_PATH_XTRA will set no_x to "yes". Otherwise, it will
106
dnl add appropriate preprocessor flags to X_CFLAGS, and appropriate linker
107
dnl flags to X_LIBS. It also checks for system-specific X libraries, and
108
dnl adds them to X_PRE_LIBS or X_EXTRA_LIBS, as appropriate. (The former
109
dnl is where "-lSM -lICE" goes, in X11R6.) We define the X_TOOLKIT_LIBS
110
dnl and X_BASIC_LIBS argument vectors ourselves, and if X is to be
111
dnl supported, we'll concatenate the whole lot of these into a command line
112
dnl for libtool. See, e.g., the libplot_la_LIBADD line in
113
dnl libplot/Makefile.am.
117
dnl Following five are concatenated together into a linker specification.
119
AC_SUBST(X_TOOLKIT_LIBS)
121
AC_SUBST(X_BASIC_LIBS)
122
AC_SUBST(X_EXTRA_LIBS)
124
X_TOOLKIT_LIBS="-lXt"
125
X_BASIC_LIBS="-lXext -lX11"
127
dnl Check whether libXt has thread support. Some platforms may have
128
dnl pthread support in libc, but no thread support in libXt/libX11.
129
our_saved_LDFLAGS="$LDFLAGS"
130
LDFLAGS="$X_LIBS $LDFLAGS"
131
AC_CHECK_LIB(Xt, XtToolkitThreadInitialize, AC_DEFINE(X_THREAD_SUPPORT), , $X_PRE_LIBS $X_BASIC_LIBS $X_EXTRA_LIBS)
132
LDFLAGS="$our_saved_LDFLAGS"
134
dnl Check in -lXext for double buffering extensions to X11, and check
135
dnl whether appropriate header files are present. (Some systems have one
136
dnl but not the other.)
137
our_saved_LDFLAGS="$LDFLAGS"
138
LDFLAGS="$X_LIBS $LDFLAGS"
139
AC_CHECK_LIB(Xext, XdbeQueryExtension, AC_DEFINE(HAVE_DBE_SUPPORT), , -lX11 "$X_EXTRA_LIBS")
140
AC_CHECK_LIB(Xext, XmbufQueryExtension, AC_DEFINE(HAVE_MBX_SUPPORT), , -lX11 "$X_EXTRA_LIBS")
141
LDFLAGS="$our_saved_LDFLAGS"
143
our_saved_CPPFLAGS="$CPPFLAGS"
144
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
145
AC_CHECK_HEADERS(X11/extensions/Xdbe.h X11/extensions/multibuf.h)
146
CPPFLAGS="$our_saved_CPPFLAGS"
148
dnl Allow installer to specify location of Athena widgets (i.e. location of
149
dnl libraries lib/libXaw.so and lib/libXmu.so, and header files). If the
150
dnl argument of --with-athena is a directory DIR, we'll add an `-L DIR/lib'
151
dnl option to the head of X_LIBS and an `-I DIR/include' option to the head
154
AC_ARG_WITH(athena, [ --with-athena[=DIR] use Athena widgets: includes and libraries in DIR])
156
dnl If --with-motif is specified, then `-lXm' will be added to the head of
157
dnl X_TOOLKIT_LIBS, instead of `-lXaw -lXmu', and --with-athena will be
158
dnl ignored. We allow the installer to specify DIR, the location of Motif.
159
dnl If the argument of --with-motif is a directory, an `-L DIR/lib' option
160
dnl will be added to the head of X_LIBS and an `-I DIR/include' option to
161
dnl the head of C_FLAGS.
163
AC_ARG_WITH(motif, [ --with-motif[=DIR] use Motif widgets: includes and libraries in DIR])
165
dnl If --with-motif is specified, we always check for the Xpm image
166
dnl library, and if we find it, then we place it at the beginning of
167
dnl X_BASIC_LIBS, since Motif 2.x requires it (it may be included in -lXm
168
dnl already, though). We also allow the installer to specify a location
169
dnl for Xpm. If DIR is specified as an argument to --with-xpm, DIR/include
170
dnl should contain xpm.h, and DIR/lib should contain the library libxpm.
172
AC_ARG_WITH(xpm, [ --with-xpm[=DIR] use Xpm with Motif: include and library in DIR])
174
dnl NOTE: Motif 2.x also seems to require the extension library -lXp for
175
dnl printing, so if --with-motif is specified we always check for libXp.
176
dnl If we find it, we'll place `-lXp' before `-lXext -lX11' in
177
dnl X_BASIC_LIBS. Also, Motif on Sys-V derived systems requires `-lPW'.
178
dnl If we find libPW, we'll add `-lPW' to LIBS, but precede it by -lc
179
dnl because some of its definitions may conflict with the standard library.
180
dnl Similarly we always check for libgen, which some versions of Motif on
183
dnl NOTE: For each `with' option, there are four possible values for the
184
dnl associated shell variable, all of which we must handle:
186
dnl 1. "" (if neither `--with-foo' nor `--without-foo' was specified)
187
dnl 2. "no" (obtained if `--without-foo' was specified)
188
dnl 3. "yes" (obtained if `--with-foo' was specified, without an argument)
189
dnl 4. DIR (obtained if `--with-foo DIR' was specified)
191
case "x$with_motif" in
193
case "x$with_athena" in
195
X_TOOLKIT_LIBS="-lXaw -lXmu $X_TOOLKIT_LIBS"
199
X_TOOLKIT_LIBS="-lXaw -lXmu $X_TOOLKIT_LIBS"
200
X_CFLAGS="$X_CFLAGS -I$with_athena/include"
201
X_LIBS="$X_LIBS -L$with_athena/lib"
206
if test "x$with_motif" != "xyes"; then
207
X_CFLAGS="$X_CFLAGS -I$with_motif/include"
208
X_LIBS="$X_LIBS -L$with_motif/lib"
211
X_TOOLKIT_LIBS="-lXm $X_TOOLKIT_LIBS"
213
our_saved_LDFLAGS="$LDFLAGS"
214
LDFLAGS="$LDFLAGS $X_LIBS"
217
AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, X_BASIC_LIBS="-lXpm $X_BASIC_LIBS", , -lXext -lX11)
220
AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, X_BASIC_LIBS="-lXpm $X_BASIC_LIBS", , -lXext -lX11)
223
LDFLAGS="$LDFLAGS -L$with_xpm/lib"
224
AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, X_CFLAGS="$X_CFLAGS -I$with_xpm/include"; X_LIBS="$X_LIBS -L$with_xpm/lib"; X_BASIC_LIBS="-lXpm $X_BASIC_LIBS", , -lXext -lX11)
227
LDFLAGS="$our_saved_LDFLAGS"
229
our_saved_LDFLAGS="$LDFLAGS"
230
LDFLAGS="$LDFLAGS $X_LIBS"
231
AC_CHECK_LIB(Xp, XpQueryExtension, X_BASIC_LIBS="-lXp $X_BASIC_LIBS", , -lXext -lX11)
232
AC_CHECK_LIB(gen, regex, LIBS="$LIBS -lc -lgen", LIBS="$LIBS")
233
AC_CHECK_LIB(PW, regex, LIBS="$LIBS -lc -lPW", LIBS="$LIBS")
234
LDFLAGS="$our_saved_LDFLAGS"
240
dnl The libplot/libplotter Makefile.am files test the automake variable
241
dnl NO_X to determine whether X should be supported.
242
AM_CONDITIONAL(NO_X, test "x$no_x" = "xyes")
244
dnl Check for libpng and png.h, and if both are available, define the
245
dnl config.h variable INCLUDE_PNG_SUPPORT; otherwise define the automake
246
dnl variable NO_PNG. The latter is used in libplot/Makefile.am and
247
dnl libplotter/Makefile.am.
249
dnl NOTE: the test for libpng checks for the function png_set_tRNS(),
250
dnl because it was added to libpng in version 0.95, which is the minimum
251
dnl version that we can use.
253
dnl ALSO NOTE: the test for libpng automatically checks for zlib, since it
254
dnl supplies the `-lz' argument to the linker.
256
AC_CHECK_HEADERS(png.h, png_support="yes", png_support="no")
257
AC_CHECK_LIB(png, png_set_tRNS, AC_DEFINE(HAVE_LIBPNG), png_support="no", -lz -lm)
258
AC_ARG_WITH(libpng, [ --without-libpng omit PNG support even if libpng and zlib are present], if test "x${with_libpng}" = "xno"; then png_support="no"; fi)
259
if test "x${png_support}" = "xyes"; then AC_DEFINE(INCLUDE_PNG_SUPPORT) fi
260
AM_CONDITIONAL(NO_PNG, test "x${png_support}" = "xno")
262
dnl Font options. The ps_fonts_in_pcl variable is used by test/plot2hpgl.test.
263
AC_ARG_ENABLE(ps-fonts-in-pcl,
264
[ --enable-ps-fonts-in-pcl enable use of PS fonts in PCL and HP-GL/2 output],
265
[if test "x$enableval" = "xyes"; then
266
echo enabling support for the 35 PS fonts in PCL 5 and HP-GL/2 output
268
AC_DEFINE(USE_PS_FONTS_IN_PCL)
273
AC_SUBST(ps_fonts_in_pcl)
275
AC_ARG_ENABLE(lj-fonts-in-ps,
276
[ --enable-lj-fonts-in-ps enable use of LaserJet fonts in PS output],
277
[if test "x$enableval" = "xyes"; then
278
echo enabling support for the 45 LaserJet fonts in PS output
279
AC_DEFINE(USE_LJ_FONTS_IN_PS)
282
AC_ARG_ENABLE(lj-fonts-in-x,
283
[ --enable-lj-fonts-in-x enable use of LaserJet fonts on X displays],
284
[if test "x$enableval" = "xyes"; then
285
echo enabling support for the 45 LaserJet fonts on X displays
286
AC_DEFINE(USE_LJ_FONTS_IN_X)
289
dnl Do we build libplotter, the C++ library, and other C++ software?
291
AC_ARG_ENABLE(libplotter, [ --enable-libplotter build the C++ Plotter class library and C++ software], echo enabling construction of the C++ class library; [AC_PROG_CXX] no_libplotter="no"; AC_MSG_CHECKING(whether ${CXX-g++} supports bool); [AC_LANG_CPLUSPLUS] AC_TRY_COMPILE(, [bool foo = true;], AC_MSG_RESULT(yes); AC_DEFINE(HAVE_BOOL), AC_MSG_RESULT(no)), no_libplotter="yes"; extralib="")
293
AM_CONDITIONAL(NO_LIBPLOTTER, test "x$no_libplotter" = "xyes")
295
dnl Do we build and install a standalone version of the libxmi
296
dnl scan-conversion library? (Not done by default because it's separately
298
AC_ARG_ENABLE(libxmi, [ --enable-libxmi build the libxmi scan-conversion library], echo enabling construction of the libxmi scan-conversion library; no_libxmi="no", no_libxmi="yes")
299
AM_CONDITIONAL(NO_LIBXMI, test "x$no_libxmi" = "xyes")
301
dnl Override default autoconf value "-g -O2" or "-g" for CFLAGS and
302
dnl CXXFLAGS, set by AC_PROG_CC and AC_PROG_CXX. Provided, that is,
303
dnl installer didn't set CFLAGS via an environment variable before running
304
dnl configure. We don't use "-g" when compiling libplot or libplotter,
305
dnl since debugging versions of those libraries would be huge. Perhaps we
306
dnl should use it when compiling the executables, though?
308
dnl Note: on a very few platforms where libtool adds a command-line option
309
dnl to CFLAGS (see above; this includes SCO OpenServer 5, where "-belf" is
310
dnl added), this way of doing things will not work, i.e., the installer
311
dnl will need to add by hand the option that libtool would have added.
312
dnl E.g., on SCO OpenServer5 the installer may need to set the environment
313
dnl variable CFLAGS to "-O -belf" or "-O2 -belf".
315
if test "x$CFLAGS_NOT_SET_BY_INSTALLER" = "xyes"; then
316
if test "x$GCC" = "xyes"; then
323
if test "x$CXXFLAGS_NOT_SET_BY_INSTALLER" = "xyes"; then
324
if test "x$GXX" = "xyes"; then
331
dnl Check for gcc strength-reduce bug (taken from WINE config). Could do
332
dnl the same for g++, but we'll assume anyone doing any C++ compiling has
333
dnl installed a modern compiler.
334
if test "x${GCC}" = "xyes"; then
335
AC_CACHE_CHECK("for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
339
static int Array[[3]];
342
for (i=0; i < B; i++)
344
exit (Array[[1]] != -2);
346
ac_cv_c_gcc_strength_bug="no",
347
ac_cv_c_gcc_strength_bug="yes",
348
ac_cv_c_gcc_strength_bug="yes") )
349
if test "$ac_cv_c_gcc_strength_bug" = "yes"
351
CFLAGS="$CFLAGS -fno-strength-reduce"
355
AC_OUTPUT(Makefile double/Makefile graph/Makefile pic2plot/Makefile pic2plot/doc/Makefile pic2plot/libgroff/Makefile pic2plot/include/Makefile info/Makefile lib/Makefile libplot/Makefile libplotter/Makefile libxmi/Makefile libxmi/info/Makefile plot/Makefile tek2plot/Makefile tek2plot/teksamples/Makefile plotfont/Makefile spline/Makefile ode/Makefile ode-examples/Makefile include/Makefile doc/Makefile fonts/Makefile fonts/bdf/Makefile fonts/pcf/Makefile fonts/pfb/Makefile test/Makefile)