1# Configure template for the GNU plotutils package. 2# Copyright (C) 1989-2009 Free Software Foundation, Inc. 3# Process this file with autoconf to produce a configure script. 4 5AC_INIT([GNU plotutils],[2.6],[bug-plotutils@gnu.org]) 6AC_PREREQ(2.59) 7AC_CONFIG_SRCDIR(graph/graph.c) 8AM_INIT_AUTOMAKE([plotutils],[2.6]) 9AM_CONFIG_HEADER(config.h:config.hin) 10 11# The following will be defined in config.h, if appropriate. 12 13# Miscellaneous. 14AH_TEMPLATE([HAVE_NULL_FLUSH], 15 [Define to 1 if in your libc, fflush(NULL) flushes all outstreams.]) 16AH_TEMPLATE([_HPUX_SOURCE], 17 [Define to 1 under HP/UX to get matherr-related things from math.h.]) 18 19# Threading-related. 20AH_TEMPLATE([PTHREAD_SUPPORT], 21 [Define to 1 if your libc includes support for pthreads.]) 22 23# X11-related. 24AH_TEMPLATE([USE_MOTIF], 25 [Define to request that Motif should be used, if X11 is used.]) 26AH_TEMPLATE([X_THREAD_SUPPORT], 27 [Define to signal support in libXt/libX11 for multithreading.]) 28AH_TEMPLATE([HAVE_DBE_SUPPORT], 29 [Define if -lXext has support for the DBE X11 protocol extension.]) 30AH_TEMPLATE([HAVE_MBX_SUPPORT], 31 [Define if -lXext has support for the MBX X11 protocol extension.]) 32 33# PNG-related. 34AH_TEMPLATE([HAVE_LIBPNG], 35 [Define if libpng is available.]) 36AH_TEMPLATE([INCLUDE_PNG_SUPPORT], 37 [Define to request PNG support (requires HAVE_LIBPNG, HAVE_PNG_H).]) 38 39# Fonts supported by Plotters of various types. 40AH_TEMPLATE([USE_LJ_FONTS_IN_X], 41 [Define to enable support for the 45 LaserJet fonts in X output.]) 42AH_TEMPLATE([USE_LJ_FONTS_IN_PS], 43 [Define to enable support for the 45 LaserJet fonts in PS output.]) 44AH_TEMPLATE([USE_PS_FONTS_IN_PCL], 45 [Define to enable support for the 35 PS fonts in PCL output.]) 46 47# Did installer set the CFLAGS and CXXFLAGS environ variables before 48# running configure? Our default CFLAGS and CXXFLAGS differ from 49# autoconf's, but we won't override installer-specified values. 50if test "x$CFLAGS" = "x"; then 51 CFLAGS_NOT_SET_BY_INSTALLER="yes" 52else 53 CFLAGS_NOT_SET_BY_INSTALLER="no" 54fi 55if test "x$CXXFLAGS" = "x"; then 56 CXXFLAGS_NOT_SET_BY_INSTALLER="yes" 57else 58 CXXFLAGS_NOT_SET_BY_INSTALLER="no" 59fi 60 61# We now use libtool to make and installed a shared library. This should 62# invoke the tests AC_PROG_CC, AC_OBJEXT, AC_PROG_INSTALL, and 63# AC_PROG_MAKE_SET, or equivalents, so we don't perform them explicitly. 64# Note: this can apparently alter CFLAGS, on a few platforms, e.g., on 65# SCO OpenServer 5 (i.e. *-*-sco3.2v5*), "-belf" is added. 66AC_PROG_LIBTOOL 67 68# Determine extension (e.g. ".exe") on executables, if any. 69AC_EXEEXT 70 71# Compiler characteristics and typedefs. 72AC_C_CONST 73AC_TYPE_SIZE_T 74AC_TYPE_PID_T 75AC_TYPE_SIGNAL 76 77# Check whether fflush(NULL) works 78AC_MSG_CHECKING(whether flushing a null FILE pointer works) 79AC_RUN_IFELSE([AC_LANG_SOURCE([[ 80#include <stdio.h> 81int main() 82{ 83 FILE *fpw, *fpr; 84 char test_array[7]; 85 86 if ((fpw = fopen ("conftest0", "w")) == (FILE *)0 87 || fwrite ("FOOBAR", 1, 7, fpw) != 7 88 || fflush ((FILE *)0) < 0 89 || (fpr = fopen ("conftest0", "r")) == (FILE *)0 90 || fread (test_array, 1, 7, fpr) != 7) 91 exit (1); 92 else 93 exit(0); }]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NULL_FLUSH)],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)]) 94 95# Checks for header files: ANSI C, POSIX, and nonstandard Unix headers. 96AC_HEADER_STDC 97AC_CHECK_HEADERS(string.h limits.h float.h) 98AC_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) 99AC_HEADER_TIME 100 101# HP/UX needs a cpp definition for math.h to define matherr-related things 102AC_EGREP_HEADER(_HPUX_SOURCE, math.h, [AC_EGREP_HEADER(matherr, math.h, [AC_DEFINE(_HPUX_SOURCE)])]) 103 104# Sui generis. 105AC_FUNC_ALLOCA 106 107# Checks for programs. Automake needs AM_PROG_LEX, not AC_PROG_LEX; 108# ignore the bogus warning about AC_PROG_LEX being invoked twice. 109AC_PROG_YACC 110AM_PROG_LEX 111 112# Should libplot/libplotter support multithreading via pthread mutexes? 113# Check to see whether libc includes dummy ("weak") pthread functions, so 114# that executables may be linked with a library that uses mutexes without 115# also linking with -lpthread. (This is the case with glibc under 116# Linux.) 117AC_CHECK_LIB(c, pthread_mutex_init, [AC_DEFINE(PTHREAD_SUPPORT)]) 118 119# Do we have the thread-safe library functions ctime_r(), localtime_r()? 120AC_CHECK_FUNCS(ctime_r localtime_r) 121 122# Do we have the POSIX waitpid() function? 123AC_CHECK_FUNCS(waitpid) 124 125# Other non-X library functions and auxiliary libraries. 126# 127# SGI's have matherr in libmx.a, not libm.a 128AC_CHECK_LIB(mx, matherr, LIBS="$LIBS -lmx", LIBS="$LIBS -lm") 129AC_CHECK_FUNCS(memcpy memmove strchr strcasecmp strerror matherr j0 erf) 130# lgamma() and gamma() both compute the log of the gamma function. There 131# are old systems out there which do not have lgamma (the name was 132# introduced after BSD 4.2), but which do have gamma. Also some systems, 133# new and old, have lgamma but not gamma. 134AC_CHECK_FUNCS(lgamma gamma) 135 136# Prepare to support X. If the user gave the command-line option 137# --without-x, AC_PATH_XTRA will set no_x to "yes". Otherwise, it will 138# add appropriate preprocessor flags to X_CFLAGS, and appropriate linker 139# flags to X_LIBS. It also checks for system-specific X libraries, and 140# adds them to X_PRE_LIBS or X_EXTRA_LIBS, as appropriate. (The former 141# is where "-lSM -lICE" goes, in X11R6.) We define the X_TOOLKIT_LIBS 142# and X_BASIC_LIBS argument vectors ourselves, and if X is to be 143# supported, we'll concatenate the whole lot of these into a command line 144# for libtool. See, e.g., the libplot_la_LIBADD line in 145# libplot/Makefile.am. 146 147AC_PATH_XTRA 148AC_SUBST(X_CFLAGS) 149# Following five are concatenated together into a linker specification. 150AC_SUBST(X_LIBS) 151AC_SUBST(X_TOOLKIT_LIBS) 152AC_SUBST(X_PRE_LIBS) 153AC_SUBST(X_BASIC_LIBS) 154AC_SUBST(X_EXTRA_LIBS) 155 156X_TOOLKIT_LIBS="-lXt" 157X_BASIC_LIBS="-lXext -lX11" 158 159# Check whether libXt has thread support. Some platforms may have 160# pthread support in libc, but no thread support in libXt/libX11. 161our_saved_LDFLAGS="$LDFLAGS" 162LDFLAGS="$X_LIBS $LDFLAGS" 163AC_CHECK_LIB(Xt, XtToolkitThreadInitialize, [AC_DEFINE(X_THREAD_SUPPORT)],[],$X_PRE_LIBS $X_BASIC_LIBS $X_EXTRA_LIBS) 164LDFLAGS="$our_saved_LDFLAGS" 165 166# Check in -lXext for double buffering extensions to X11, and check 167# also whether appropriate header files are present. (Some systems have one 168# but not the other.) 169our_saved_LDFLAGS="$LDFLAGS" 170LDFLAGS="$X_LIBS $LDFLAGS" 171AC_CHECK_LIB(Xext, XdbeQueryExtension, [AC_DEFINE(HAVE_DBE_SUPPORT)], [], -lX11 "$X_EXTRA_LIBS") 172AC_CHECK_LIB(Xext, XmbufQueryExtension, [AC_DEFINE(HAVE_MBX_SUPPORT)], [], -lX11 "$X_EXTRA_LIBS") 173LDFLAGS="$our_saved_LDFLAGS" 174 175our_saved_CPPFLAGS="$CPPFLAGS" 176CPPFLAGS="$X_CFLAGS $CPPFLAGS" 177 178AC_CHECK_HEADERS([X11/Xlib.h]) 179AC_CHECK_HEADERS([X11/extensions/Xdbe.h], [], [], 180[#if HAVE_X11_XLIB_H 181# include <X11/Xlib.h> 182# endif 183]) 184AC_CHECK_HEADERS([X11/extensions/multibuf.h], [], [], 185[#if HAVE_X11_XLIB_H 186# include <X11/Xlib.h> 187# endif 188]) 189 190CPPFLAGS="$our_saved_CPPFLAGS" 191 192# Allow installer to specify location of Athena widgets (i.e. location of 193# libraries lib/libXaw.so and lib/libXmu.so, and header files). If the 194# argument of --with-athena is a directory DIR, we'll add an `-L DIR/lib' 195# option to the head of X_LIBS and an `-I DIR/include' option to the head 196# of X_CFLAGS. 197 198AC_ARG_WITH(athena, [ --with-athena[=DIR] use Athena widgets: includes and libraries in DIR]) 199 200# If --with-motif is specified, then `-lXm' will be added to the head of 201# X_TOOLKIT_LIBS, instead of `-lXaw -lXmu', and --with-athena will be 202# ignored. We allow the installer to specify DIR, the location of Motif. 203# If the argument of --with-motif is a directory, an `-L DIR/lib' option 204# will be added to the head of X_LIBS and an `-I DIR/include' option to 205# the head of C_FLAGS. 206 207AC_ARG_WITH(motif, [ --with-motif[=DIR] use Motif widgets: includes and libraries in DIR]) 208 209# If --with-motif is specified, we always check for the Xpm image 210# library, and if we find it, then we place it at the beginning of 211# X_BASIC_LIBS, since Motif 2.x requires it (it may be included in -lXm 212# already, though). We also allow the installer to specify a location 213# for Xpm. If DIR is specified as an argument to --with-xpm, DIR/include 214# should contain xpm.h, and DIR/lib should contain the library libxpm. 215 216AC_ARG_WITH(xpm, [ --with-xpm[=DIR] use Xpm with Motif: include and library in DIR]) 217 218# NOTE: Motif 2.x also seems to require the extension library -lXp for 219# printing, so if --with-motif is specified we always check for libXp. 220# If we find it, we'll place `-lXp' before `-lXext -lX11' in 221# X_BASIC_LIBS. Also, Motif on Sys-V derived systems requires `-lPW'. 222# If we find libPW, we'll add `-lPW' to LIBS, but precede it by -lc 223# because some of its definitions may conflict with the standard library. 224# Similarly we always check for libgen, which some versions of Motif on 225# Solaris need. 226 227# NOTE: For each `with' option, there are four possible values for the 228# associated shell variable, all of which we must handle: 229# 230# 1. "" (if neither `--with-foo' nor `--without-foo' was specified) 231# 2. "no" (obtained if `--without-foo' was specified) 232# 3. "yes" (obtained if `--with-foo' was specified, without an argument) 233# 4. DIR (obtained if `--with-foo DIR' was specified) 234 235case "x$with_motif" in 236xno|x) 237 case "x$with_athena" in 238 xyes|x) 239 X_TOOLKIT_LIBS="-lXaw -lXmu $X_TOOLKIT_LIBS" 240 ;; 241 xno) ;; 242 *) 243 X_TOOLKIT_LIBS="-lXaw -lXmu $X_TOOLKIT_LIBS" 244 X_CFLAGS="$X_CFLAGS -I$with_athena/include" 245 X_LIBS="$X_LIBS -L$with_athena/lib" 246 ;; 247 esac 248 ;; 249*) 250 if test "x$with_motif" != "xyes"; then 251 X_CFLAGS="$X_CFLAGS -I$with_motif/include" 252 X_LIBS="$X_LIBS -L$with_motif/lib" 253 fi 254 255 X_TOOLKIT_LIBS="-lXm $X_TOOLKIT_LIBS" 256 257 our_saved_LDFLAGS="$LDFLAGS" 258 LDFLAGS="$LDFLAGS $X_LIBS" 259 case "x$with_xpm" in 260 xno|x) 261 AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, X_BASIC_LIBS="-lXpm $X_BASIC_LIBS", , -lXext -lX11) 262 ;; 263 xyes) 264 AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, X_BASIC_LIBS="-lXpm $X_BASIC_LIBS", , -lXext -lX11) 265 ;; 266 *) 267 LDFLAGS="$LDFLAGS -L$with_xpm/lib" 268 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) 269 ;; 270 esac 271 LDFLAGS="$our_saved_LDFLAGS" 272 273 our_saved_LDFLAGS="$LDFLAGS" 274 LDFLAGS="$LDFLAGS $X_LIBS" 275 AC_CHECK_LIB(Xp, XpQueryExtension, X_BASIC_LIBS="-lXp $X_BASIC_LIBS", , -lXext -lX11) 276 AC_CHECK_LIB(gen, regex, LIBS="$LIBS -lc -lgen", LIBS="$LIBS") 277 AC_CHECK_LIB(PW, regex, LIBS="$LIBS -lc -lPW", LIBS="$LIBS") 278 LDFLAGS="$our_saved_LDFLAGS" 279 280 AC_DEFINE(USE_MOTIF) 281 ;; 282esac 283 284# The libplot/libplotter Makefile.am files test the automake variable 285# NO_X to determine whether X should be supported. 286AM_CONDITIONAL(NO_X, test "x$no_x" = "xyes") 287 288# Check for libpng and png.h, and if both are available, define the 289# config.h variable INCLUDE_PNG_SUPPORT; otherwise define the automake 290# variable NO_PNG. The latter is used in libplot/Makefile.am and 291# libplotter/Makefile.am. 292 293# NOTE: the test for libpng checks for the function png_set_tRNS(), 294# because it was added to libpng in version 0.95, which is the minimum 295# version that we can use. 296 297# ALSO NOTE: the test for libpng automatically checks for zlib, since it 298# supplies the `-lz' argument to the linker. 299 300AC_CHECK_HEADERS(png.h, png_support="yes", png_support="no") 301AC_CHECK_LIB(png, png_set_tRNS, [AC_DEFINE(HAVE_LIBPNG)], png_support="no", -lz -lm) 302AC_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) 303if test "x${png_support}" = "xyes"; then AC_DEFINE(INCLUDE_PNG_SUPPORT) fi 304AM_CONDITIONAL(NO_PNG, test "x${png_support}" = "xno") 305 306# Font options. The ps_fonts_in_pcl variable is used by test/plot2hpgl.test. 307AC_ARG_ENABLE(ps-fonts-in-pcl, 308[ --enable-ps-fonts-in-pcl enable use of PS fonts in PCL and HP-GL/2 output], 309[if test "x$enableval" = "xyes"; then 310 echo enabling support for the 35 PS fonts in PCL 5 and HP-GL/2 output 311 ps_fonts_in_pcl=1 312 AC_DEFINE(USE_PS_FONTS_IN_PCL) 313else 314 ps_fonts_in_pcl=0 315fi], 316ps_fonts_in_pcl=0) 317AC_SUBST(ps_fonts_in_pcl) 318 319AC_ARG_ENABLE(lj-fonts-in-ps, 320[ --enable-lj-fonts-in-ps enable use of LaserJet fonts in PS output], 321[if test "x$enableval" = "xyes"; then 322 echo enabling support for the 45 LaserJet fonts in PS output 323 AC_DEFINE(USE_LJ_FONTS_IN_PS) 324fi]) 325 326AC_ARG_ENABLE(lj-fonts-in-x, 327[ --enable-lj-fonts-in-x enable use of LaserJet fonts on X displays], 328[if test "x$enableval" = "xyes"; then 329 echo enabling support for the 45 LaserJet fonts on X displays 330 AC_DEFINE(USE_LJ_FONTS_IN_X) 331fi]) 332 333# Do we build libplotter, the C++ library, and other C++ software? 334AC_ARG_ENABLE(libplotter, [ --enable-libplotter build the C++ Plotter class library and C++ software], echo enabling construction of the C++ class library; no_libplotter="no", no_libplotter="yes"; extralib="") 335AM_CONDITIONAL(NO_LIBPLOTTER, test "x$no_libplotter" = "xyes") 336 337# Do we build and install a standalone version of the libxmi 338# scan-conversion library? (Not done by default because it's separately 339# distributed.) 340AC_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") 341AM_CONDITIONAL(NO_LIBXMI, test "x$no_libxmi" = "xyes") 342 343# Override default autoconf value "-g -O2" or "-g" for CFLAGS and 344# CXXFLAGS, set by AC_PROG_CC and AC_PROG_CXX. Provided, that is, 345# installer didn't set CFLAGS via an environment variable before running 346# configure. We don't use "-g" when compiling libplot or libplotter, 347# since debugging versions of those libraries would be huge. Perhaps we 348# should use it when compiling the executables, though? 349 350# Note: on a very few platforms where libtool adds a command-line option 351# to CFLAGS (see above; this includes SCO OpenServer 5, where "-belf" is 352# added), this way of doing things will not work, i.e., the installer 353# will need to add by hand the option that libtool would have added. 354# E.g., on SCO OpenServer5 the installer may need to set the environment 355# variable CFLAGS to "-O -belf" or "-O2 -belf". 356 357if test "x$CFLAGS_NOT_SET_BY_INSTALLER" = "xyes"; then 358if test "x$GCC" = "xyes"; then 359 CFLAGS="-O2" 360else 361 CFLAGS="-O" 362fi 363fi 364 365if test "x$CXXFLAGS_NOT_SET_BY_INSTALLER" = "xyes"; then 366if test "x$GXX" = "xyes"; then 367 CXXFLAGS="-O2" 368else 369 CXXFLAGS="-O" 370fi 371fi 372 373# Check for gcc strength-reduce bug (taken from WINE config). Could do 374# the same for g++, but we'll assume anyone doing any C++ compiling has 375# installed a modern compiler. 376if test "x${GCC}" = "xyes"; then 377 AC_CACHE_CHECK(for gcc strength-reduce bug, ac_cv_c_gcc_strength_bug, 378 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 379int main() 380{ 381 static int Array[[3]]; 382 unsigned int B = 3; 383 int i; 384 for (i=0; i < B; i++) 385 Array[[i]] = i - 3; 386 exit (Array[[1]] != -2); 387}]])], 388[ac_cv_c_gcc_strength_bug="no"],[ac_cv_c_gcc_strength_bug="yes"],[ac_cv_c_gcc_strength_bug="yes"]) ) 389 if test "$ac_cv_c_gcc_strength_bug" = "yes" 390 then 391 CFLAGS="$CFLAGS -fno-strength-reduce" 392 fi 393fi 394 395AC_CONFIG_FILES([Makefile double/Makefile graph/Makefile hersheydemo/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]) 396AC_OUTPUT 397