configure.ac 15 KB

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