1dnl ##########################################################################
2dnl MALOC = < Minimal Abstraction Layer for Object-oriented C >
3dnl Copyright (C) 1994-- Michael Holst
4dnl
5dnl This library is free software; you can redistribute it and/or
6dnl modify it under the terms of the GNU Lesser General Public
7dnl License as published by the Free Software Foundation; either
8dnl version 2.1 of the License, or (at your option) any later version.
9dnl
10dnl This library is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13dnl Lesser General Public License for more details.
14dnl
15dnl You should have received a copy of the GNU Lesser General Public
16dnl License along with this library; if not, write to the Free Software
17dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18dnl ##########################################################################
19
20dnl ##########################################################################
21dnl File:    configure.ac
22dnl
23dnl Purpose: configure.ac script for MALOC (Minimal Abstraction Layer
24dnl          for Object-oriented C).
25dnl
26dnl Notes:   You process this file with autoconf to produce a "configure"
27dnl          shell script by using several tools in the autoconf suite in
28dnl          succession:
29dnl
30dnl             rm -rf config.cache autom4te.cache
31dnl             aclocal \
32dnl             && automake --gnu --add-missing --copy \
33dnl             && autoconf \
34dnl             && autoheader \
35dnl             && libtoolize --automake --copy --force
36dnl             rm -rf config.cache autom4te.cache
37dnl
38dnl          The above generates the script "configure", the package
39dnl          pre-header "config.h", and all required "Makefile.in"
40dnl          pre-makefiles.  To build the package you type the following:
41dnl
42dnl             rm -rf config.cache autom4te.cache
43dnl             ./configure
44dnl             make
45dnl             make install
46dnl
47dnl          Running the "configure" script generates the package header
48dnl          "config.h" from the pre-header "config.h.in", and generates
49dnl          all "Makefiles" from all pre-makefiles "Makefile.in".
50dnl
51dnl Details: Below are some diagrams twisted from the GNU autoconf info
52dnl          pages, with some automake paths thrown in, which show the
53dnl          relationships between the various autoconf utilities.  The
54dnl          names followed by "*" indicate the execution of a program
55dnl          or a script (possibly produced at an earlier stage).  The
56dnl          names in brackets "[ ]" represent optional steps, such as
57dnl          the use of automake and/or autoheader.
58dnl
59dnl
60dnl          Preparing a software package for distribution using autoconf:
61dnl
62dnl
63dnl             source files-->[autoscan*]-->[configure.scan]-->configure.ac
64dnl
65dnl             [Makefile.am] -+---------> [automake*] --------> Makefile.in
66dnl                            |
67dnl             configure.ac --.   .--------> autoconf* ---------> configure
68dnl                            +---+
69dnl             [aclocal.m4] --+   `---.
70dnl             [acsite.m4] ---'       |
71dnl                                    +--> [autoheader*] ---> [config.h.in]
72dnl                                    |
73dnl             - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
74dnl                                    |
75dnl             [acconfig.h] ----.     |  BELOW THIS LINE IS NOW DEPRECATED;
76dnl                              +-----'  AUTOCONF NOW SUPPORTS A COMPLETELY
77dnl             [config.h.top] --+        SELF-CONTAINED configure.ac FILE.
78dnl             [config.h.bot] --'
79dnl
80dnl
81dnl
82dnl          Building the resulting package using "configure" and "make":
83dnl
84dnl
85dnl                                   .------------> config.cache
86dnl             configure* -----------+------------> config.log
87dnl                                   |
88dnl             [config.h.in] -.      v           .-> [config.h] -.
89dnl                            +-->config.status*-+               +--> make*
90dnl             Makefile.in ---'                  `-> Makefile ---'
91dnl
92dnl Author:  Michael Holst
93dnl ##########################################################################
94
95dnl ##########################################################################
96dnl 0. autoconf initialization
97dnl ##########################################################################
98
99dnl # Autoconf init, autoheader output location, config and prefix directories
100AC_INIT(maloc, 1.0, mholst@math.ucsd.edu)
101AC_CONFIG_SRCDIR(src/aaa_inc/maloc/maloc.h)
102AC_CONFIG_HEADERS(src/aaa_inc/maloccf.h)
103AC_CONFIG_AUX_DIR(config)
104AC_PREFIX_DEFAULT(${HOME})
105
106dnl # Get information we need later for the CPU-VENDOR-OS triplet
107AC_CANONICAL_BUILD
108AC_CANONICAL_HOST
109AC_CANONICAL_TARGET
110
111dnl ##########################################################################
112dnl 1. automake initialization
113dnl ##########################################################################
114
115dnl -------------------------------------------
116dnl AM_INIT_AUTOMAKE does:    PACKAGE="fetk";
117dnl                           VERSION="1.0";
118dnl                           AC_SUBST(PACKAGE)
119dnl                           AC_SUBST(VERSION)
120dnl                           AC_ARG_PROGRAM
121dnl                           AC_PROG_MAKE_SET
122dnl                           AM_SANITY_CHECK
123dnl                           AC_PROG_INSTALL
124dnl                           AM_MISSING_PROG
125dnl So, we do this all in one shot
126dnl AM_INIT_AUTOMAKE(maloc, 1.0)
127dnl -------------------------------------------
128dnl The above is deprecated; now we only do:
129AM_INIT_AUTOMAKE([foreign])
130
131dnl We need a separate FETK_VERSION macro for use by libtool
132FETK_VERSION="1:0:0"
133AC_SUBST(FETK_VERSION)
134
135dnl Autoconf (or rather Automake) is not very smart about making sure that
136dnl even if the various autotools exist that they actually WORK.  A common
137dnl problem is that someone has installed autoconf and automake, but they
138dnl forgot to replace the native (broken) version of M4 with GNU M4.  This
139dnl makes everything break.  Moreover, automake always places targets in
140dnl the Makefile.in files that will try to run autoconf/automake/etc if
141dnl various dependencies seem to require it, as long as autoconf/automake
142dnl seem to exist (even with broken M4).  Therefore, we override
143dnl AM_INIT_AUTOMAKE and set the autotools to no-ops with the following
144dnl macro definitions.  (This just means that if you change a Makefile.am,
145dnl then you have to remember to re-run automake yourself.  This can be
146dnl done by running the config/bootstrap shell script.)
147dnl ACLOCAL=":";
148dnl AUTOCONF=":";
149dnl AUTOMAKE=":";
150dnl AUTOHEADER=":";
151dnl AC_SUBST(ACLOCAL)
152dnl AC_SUBST(AUTOCONF)
153dnl AC_SUBST(AUTOMAKE)
154dnl AC_SUBST(AUTOHEADER)
155AM_MAINTAINER_MODE
156
157dnl ##########################################################################
158dnl 2. checks for programs
159dnl ##########################################################################
160
161dnl # Basic compiler and related tools
162AC_LANG_C
163AC_PROG_CC
164AC_PROG_CPP
165dnl AM_PROG_LEX
166dnl AC_PROG_YACC
167
168dnl # Libtool stuff
169AC_DISABLE_STATIC
170AM_PROG_LIBTOOL
171dnl AM_PROG_LIBTOOL makes AC_PROG_RANLIB unnecessary
172dnl striplib="";
173dnl old_striplib="";
174dnl AC_SUBST(striplib)
175dnl AC_SUBST(old_striplib)
176
177dnl ##########################################################################
178dnl 3. checks for libraries
179dnl ##########################################################################
180
181dnl # Check for the math library.
182AC_CHECK_LIB(m,pow,[math_lib="-lm"],[math_lib=""])
183AC_SUBST(math_lib)
184
185dnl # Check for the Liberty library (useful for debugging on Linux).
186AC_CHECK_LIB(iberty,strerrno,[liberty_lib="-liberty"],[liberty_lib=""])
187AC_SUBST(liberty_lib)
188
189dnl # Check for "gethostbyname" and nsl library
190nsl_lib="";
191AC_CHECK_FUNC(gethostbyname,[try_nsl=""],[try_nsl="yes"])
192if test -n "${try_nsl}"; then
193    AC_CHECK_LIB(nsl,gethostbyname,[nsl_lib="-lnsl"],[nsl_lib=""])
194fi
195AC_SUBST(nsl_lib)
196
197dnl # Check for "connect" and socket library
198socket_lib="";
199AC_CHECK_FUNC(connect,[try_socket=""],[try_socket="yes"])
200if test -n "${try_socket}"; then
201    AC_CHECK_LIB(socket,connect,[socket_lib="-lsocket"],[socket_lib=""])
202fi
203AC_SUBST(socket_lib)
204
205dnl # Check for "thr_create" and thread library
206thread_lib="";
207AC_CHECK_FUNC(thr_create,[try_thread=""],[try_thread="yes"])
208if test -n "${try_thread}"; then
209    AC_CHECK_LIB(thread,thr_create,[thread_lib="-lthread"],[thread_lib=""])
210fi
211AC_SUBST(thread_lib)
212
213dnl ##########################################################################
214dnl 4. checks for header files
215dnl ##########################################################################
216
217dnl # Check for the 15 Standard C (ANSI-C/ISO-C) headers.
218AC_HEADER_STDC
219dnl AC_CHECK_HEADER(assert.h,, AC_MSG_ERROR([STDC <assert.h> not found.]))
220dnl AC_CHECK_HEADER(ctype.h,,  AC_MSG_ERROR([STDC <ctype.h> not found.]))
221dnl AC_CHECK_HEADER(errno.h,,  AC_MSG_ERROR([STDC <errno.h> not found.]))
222dnl AC_CHECK_HEADER(float.h,,  AC_MSG_ERROR([STDC <float.h> not found.]))
223dnl AC_CHECK_HEADER(limits.h,, AC_MSG_ERROR([STDC <limits.h> not found.]))
224dnl AC_CHECK_HEADER(locale.h,, AC_MSG_ERROR([STDC <locale.h> not found.]))
225dnl AC_CHECK_HEADER(math.h,,   AC_MSG_ERROR([STDC <math.h> not found.]))
226dnl AC_CHECK_HEADER(setjmp.h,, AC_MSG_ERROR([STDC <setjmp.h> not found.]))
227dnl AC_CHECK_HEADER(signal.h,, AC_MSG_ERROR([STDC <signal.h> not found.]))
228dnl AC_CHECK_HEADER(stdarg.h,, AC_MSG_ERROR([STDC <stdarg.h> not found.]))
229dnl AC_CHECK_HEADER(stddef.h,, AC_MSG_ERROR([STDC <stddef.h> not found.]))
230dnl AC_CHECK_HEADER(stdio.h,,  AC_MSG_ERROR([STDC <stdio.h> not found.]))
231dnl AC_CHECK_HEADER(stdlib.h,, AC_MSG_ERROR([STDC <stdlib.h> not found.]))
232dnl AC_CHECK_HEADER(string.h,, AC_MSG_ERROR([STDC <string.h> not found.]))
233dnl AC_CHECK_HEADER(time.h,,   AC_MSG_ERROR([STDC <time.h> not found.]))
234
235dnl # Check for some additional UNIX-like headers that we need.
236AC_HEADER_SYS_WAIT
237AC_CHECK_HEADERS( \
238    unistd.h \
239    sys/types.h \
240    sys/time.h \
241    sys/times.h \
242    sys/stat.h \
243    fcntl.h \
244    sys/socket.h \
245    sys/un.h \
246    netinet/in.h \
247    arpa/inet.h \
248    netdb.h \
249    rpc/rpc.h \
250)
251
252dnl ##########################################################################
253dnl 5. checks for typedefs
254dnl ##########################################################################
255
256AC_TYPE_MODE_T
257AC_TYPE_PID_T
258AC_TYPE_SIZE_T
259
260dnl ##########################################################################
261dnl 6. checks for structures
262dnl ##########################################################################
263
264dnl ##########################################################################
265dnl 7. checks for compiler characteristics
266dnl ##########################################################################
267
268dnl ##########################################################################
269dnl 8. checks for library functions
270dnl ##########################################################################
271
272AC_HEADER_STAT
273
274AC_MSG_CHECKING([for xdrmem_create in <rpc/rpc.h>])
275AC_HEADER_EGREP(xdrmem_create, rpc/rpc.h,
276    [xdrmem_create_ok=yes;AC_DEFINE(HAVE_XDR)],[xdrmem_create_ok=no;])
277AC_MSG_RESULT(${xdrmem_create_ok})
278
279AC_MSG_CHECKING([for getcwd in <unistd.h>])
280AC_HEADER_EGREP(getcwd, unistd.h,
281    [getcwd_ok=yes;AC_DEFINE(HAVE_GETCWD)],[getcwd_ok=no;])
282AC_MSG_RESULT(${getcwd_ok})
283
284AC_MSG_CHECKING([for O_NONBLOCK in <fcntl.h>])
285AC_TRY_COMPILE(
286    [#include <fcntl.h>],
287    [unsigned short a; a && O_NONBLOCK;],
288    [o_nonblock_ok=yes;AC_DEFINE(HAVE_O_NONBLOCK)],[o_nonblock_ok=no])
289AC_MSG_RESULT(${o_nonblock_ok})
290
291AC_MSG_CHECKING([whether accept() in <sys/socket.h> wants ulong, uint, or int])
292dnl AC_DEFINE(ACCEPT_USES_ULONG)
293dnl AC_DEFINE(ACCEPT_USES_UINT)
294AC_MSG_RESULT([unclear])
295
296dnl ##########################################################################
297dnl 9. checks for system services
298dnl ##########################################################################
299
300dnl ##########################################################################
301dnl 10. checks for anything else
302dnl ##########################################################################
303
304dnl # ------------------------------------------------
305dnl # CHECK WHETHER TO DISABLE CPU-VENDOR-HOST TRIPLET
306dnl # ------------------------------------------------
307fetk_cpu_vendor_os="";
308AC_MSG_CHECKING([whether you want to disable the CPU-VENDOR-OS install triplet])
309AC_ARG_ENABLE(triplet,
310    [  --disable-triplet       disable CPU-VENDOR-OS install triplet [[default=no]]],
311    [ triplet_kill="yes"],
312    [ triplet_kill="" ]
313)
314if test "${triplet_kill}" = yes; then
315    AC_MSG_RESULT([yes])
316    fetk_cpu_vendor_os="";
317else
318    AC_MSG_RESULT([no])
319    fetk_cpu_vendor_os="${host_cpu}-${host_vendor}-${host_os}";
320fi
321AC_SUBST(fetk_cpu_vendor_os)
322
323dnl # ---------------------------------------------------
324dnl # HANDLE VARIOUS ARCHITECTURE-SPECIFIC CONFIGURATIONS
325dnl # ---------------------------------------------------
326if test "${host_os}" = "cygwin"; then
327    AC_DEFINE(HAVE_CYGWIN)
328fi
329
330dnl # ---------------------------
331dnl # HANDLE THE READLINE LIBRARY
332dnl # ---------------------------
333rl_lib="";
334rl_inc="";
335
336dnl # READLINE header location ENV specification
337AC_MSG_CHECKING([whether your environment defines FETK_RL_INCLUDE])
338if test -n "${FETK_RL_INCLUDE}"; then
339    AC_MSG_RESULT([yes])
340    rl_inc_path="-I${FETK_RL_INCLUDE} ";
341else
342    AC_MSG_RESULT([no])
343    rl_inc_path="";
344fi
345
346dnl # READLINE library location ENV specification
347AC_MSG_CHECKING([whether your environment defines FETK_RL_LIBRARY])
348if test -n "${FETK_RL_LIBRARY}"; then
349    AC_MSG_RESULT([yes])
350    rl_lib_path="-L${FETK_RL_LIBRARY} ";
351else
352    AC_MSG_RESULT([no])
353    rl_lib_path="";
354fi
355
356dnl # Setup temp LDFLAGS and CPPFLAGS and look for READLINE library/header
357LDFLAGS_SAVE=${LDFLAGS};
358CPPFLAGS_SAVE=${CPPFLAGS};
359LDFLAGS=${rl_lib_path};
360CPPFLAGS=${rl_inc_path};
361AC_CHECK_HEADER(readline/readline.h,
362    [rl_use="yes";rl_inc="${rl_inc_path}"],
363    [rl_use="";rl_inc=""])
364if test -n "${rl_use}"; then
365    AC_CHECK_HEADER(readline/history.h,
366        [rl_use="yes";rl_inc="${rl_inc_path}"],
367        [rl_use="";rl_inc=""])
368    if test -n "${rl_use}"; then
369        AC_CHECK_LIB(ncurses,tgetnum,
370            [ncurses_lib="-lncurses"],
371            [ncurses_lib=""],
372            [${math_lib}])
373        AC_CHECK_LIB(readline,readline,
374            [rl_use="yes";rl_lib="${rl_lib_path}-lreadline ${ncurses_lib}"],
375            [rl_use="";rl_lib=""],
376            [${rl_lib_path} ${ncurses_lib} ${math_lib}])
377        if test -n "${rl_use}"; then
378            AC_CHECK_LIB(readline,add_history,
379                [rl_use="yes";rl_lib="${rl_lib_path}-lreadline ${ncurses_lib}"],
380                [rl_use="";rl_lib=""],
381                [${rl_lib_path} ${ncurses_lib} ${math_lib}])
382        fi
383        if test -n "${rl_use}"; then
384            AC_DEFINE(HAVE_READLINE_READLINE_H)
385            AC_DEFINE(HAVE_READLINE_HISTORY_H)
386        fi
387    fi
388fi
389
390dnl # Return LDFLAGS and CPPFLAGS to normal
391LDFLAGS=${LDFLAGS_SAVE};
392CPPFLAGS=${CPPFLAGS_SAVE};
393
394AC_SUBST(rl_lib)
395AC_SUBST(rl_inc)
396
397dnl # ----------------------
398dnl # HANDLE THE MPI LIBRARY
399dnl # ----------------------
400AC_MSG_CHECKING([whether you want MPI])
401AC_ARG_ENABLE(mpi,
402    [  --enable-mpi            enable MPI layer [[default=no]]],
403    [ mpi_use="yes" ],
404    [ mpi_use=""    ]
405)
406mpi_lib="";
407mpi_inc="";
408if test -z "${mpi_use}"; then
409    AC_MSG_RESULT([no])
410else
411    AC_MSG_RESULT([yes ...poking around])
412
413    dnl # MPI header location ENV specification
414    AC_MSG_CHECKING([whether your environment defines FETK_MPI_INCLUDE])
415    if test -n "${FETK_MPI_INCLUDE}"; then
416        AC_MSG_RESULT([yes])
417        mpi_inc_path="-I${FETK_MPI_INCLUDE} ";
418    else
419        AC_MSG_RESULT([no])
420        mpi_inc_path="";
421    fi
422
423    dnl # MPI library location ENV specification
424    AC_MSG_CHECKING([whether your environment defines FETK_MPI_LIBRARY])
425    if test -n "${FETK_MPI_LIBRARY}"; then
426        AC_MSG_RESULT([yes])
427        mpi_lib_path="-L${FETK_MPI_LIBRARY} ";
428    else
429        AC_MSG_RESULT([no])
430        mpi_lib_path="";
431    fi
432
433    dnl # Setup temp LDFLAGS and CPPFLAGS and look for MPI library/header
434    LDFLAGS_SAVE=${LDFLAGS};
435    CPPFLAGS_SAVE=${CPPFLAGS};
436    LDFLAGS=${mpi_lib_path};
437    CPPFLAGS=${mpi_inc_path};
438    mpi_use="";
439    AC_CHECK_HEADER(mpi.h,
440        [mpi_use="yes";mpi_inc="${mpi_inc_path}"],
441        [mpi_use="";mpi_inc=""])
442    if test -n "${mpi_use}"; then
443        AC_CHECK_LIB(mpi,main,
444            [mpi_use="yes";mpi_lib="${mpi_lib_path}-lmpi"],
445            [mpi_use="";mpi_lib=""],${mpi_lib_path})
446        if test -z "${mpi_use}"; then
447            AC_CHECK_LIB(mpich,main,
448                [mpi_use="yes";mpi_lib="${mpi_lib_path}-lmpich"],
449                [mpi_use="";mpi_lib=""],${mpi_lib_path})
450        fi
451        if test -n "${mpi_use}"; then
452            AC_DEFINE([HAVE_MPI_H], [], [We have and want to use MPI])
453        fi
454    fi
455
456    dnl # Return LDFLAGS and CPPFLAGS to normal
457    LDFLAGS=${LDFLAGS_SAVE};
458    CPPFLAGS=${CPPFLAGS_SAVE};
459fi
460AC_SUBST(mpi_lib)
461AC_SUBST(mpi_inc)
462
463dnl # -----------------------
464dnl # HANDLE SYMBOL EMBEDDING
465dnl # -----------------------
466AC_MSG_CHECKING([whether EMBED macro can be used without compilation errors])
467AC_TRY_COMPILE(,
468    [#define EMBED(rctag) \
469     static const char* rctag; \
470     static void* use_rcsid=(0 ? &use_rcsid : (void*)&rcsid);
471     EMBED(rcsid)],
472    [embed_ok=yes;AC_DEFINE(HAVE_EMBED)],[embed_ok=no])
473AC_MSG_RESULT(${embed_ok})
474
475AC_MSG_RESULT([----------- begin processing MALOC configure options ---------])
476
477dnl # ------------------------
478dnl # HANDLE DEBUG COMPILATION
479dnl # ------------------------
480AC_MSG_CHECKING([whether you want debug compilation])
481AC_ARG_ENABLE(vdebug,
482    [  --enable-vdebug         enable debug compilation [[default=no]]],
483    [ vdebug_use="yes" ],
484    [ vdebug_use=""    ]
485)
486if test -z "${vdebug_use}"; then
487    AC_MSG_RESULT([no])
488else
489    AC_MSG_RESULT([yes])
490    AC_DEFINE(HAVE_DEBUG)
491fi
492
493dnl # --------------------------------
494dnl # HANDLE ANSI/PEDANTIC COMPILATION
495dnl # --------------------------------
496AC_MSG_CHECKING([whether you want pedantic ANSI compilation])
497AC_ARG_ENABLE(pansi,
498    [  --enable-pansi          enable pedantic ANSI compilation [[default=no]]],
499    [ pansi_use="yes" ],
500    [ pansi_use=""    ]
501)
502if test -z "${pansi_use}"; then
503    AC_MSG_RESULT([no])
504    wall=""
505    wall_pedantic=""
506    wall_pedantic_ansi=""
507    pedantic_ansi=""
508else
509    AC_MSG_RESULT([yes])
510    wall="-Wall"
511    wall_pedantic="-Wall -pedantic"
512    wall_pedantic_ansi="-Wall -pedantic -ansi"
513    pedantic_ansi="-pedantic -ansi"
514fi
515AC_SUBST(wall)
516AC_SUBST(wall_pedantic)
517AC_SUBST(wall_pedantic_ansi)
518AC_SUBST(pedantic_ansi)
519
520dnl # ----------------
521dnl # HANDLE PROFILING
522dnl # ----------------
523AC_MSG_CHECKING([whether you want profiling])
524AC_ARG_ENABLE(gprof,
525    [  --enable-gprof          enable gprof profiling [[default=no]]],
526    [ gprof_use="yes" ],
527    [ gprof_use=""    ]
528)
529if test -z "${gprof_use}"; then
530    AC_MSG_RESULT([no])
531    profile=""
532    profile_lib=""
533else
534    AC_MSG_RESULT([yes])
535    profile="-pg"
536    profile_lib="-pg"
537fi
538AC_SUBST(profile)
539AC_SUBST(profile_lib)
540
541dnl # ---------------------------------
542dnl # HANDLE THE ELECTRIC FENCE LIBRARY
543dnl # ---------------------------------
544AC_MSG_CHECKING([whether you want to build ElectricFence])
545AC_ARG_ENABLE(efence,
546    [  --enable-efence         build ElectricFence ourself [[default=no]]],
547    [ efence_build="yes" ],
548    [ efence_build="" ]
549)
550if test -n "${efence_build}"; then
551    AC_MSG_RESULT([yes])
552    efence="efence"
553else
554    AC_MSG_RESULT([no])
555    efence=""
556fi
557AC_SUBST(efence)
558AM_CONDITIONAL(BUILD_EFENCE, test x$efence = xefence)
559
560AC_MSG_RESULT([------------ end processing MALOC configure options ----------])
561
562dnl ##########################################################################
563dnl 11. templates
564dnl ##########################################################################
565
566AH_TEMPLATE([HAVE_XDR],
567            [Do I have the XDR datastructure in the RPC package?])
568
569AH_TEMPLATE([HAVE_O_NONBLOCK],
570            [Do I have the O_NONBLOCK macro?])
571
572AH_TEMPLATE([ACCEPT_USES_ULONG],
573            [Does accept() use unsigned long?])
574
575AH_TEMPLATE([ACCEPT_USES_UINT],
576            [Does accept() use unsigned int?])
577
578AH_TEMPLATE([HAVE_GETCWD],
579            [Do I have the getcwd routine?])
580
581AH_TEMPLATE([HAVE_CYGWIN],
582            [Am I running in a Cygwin/Win32 environment?])
583
584AH_TEMPLATE([HAVE_EMBED],
585            [Does EMBED macro for embedding rcsid symbols into binaries work?])
586
587AH_TEMPLATE([HAVE_DEBUG],
588            [Do I compile as a debug version?])
589
590AH_TEMPLATE([HAVE_MPI_H],
591            [Do I have MPI header?])
592
593AH_TEMPLATE([HAVE_READLINE_READLINE_H],
594            [Do I have readline.h header?])
595
596AH_TEMPLATE([HAVE_READLINE_HISTORY_H],
597            [Do I have history.h header?])
598
599AH_TOP([
600/*
601 * ***************************************************************************
602 * MALOC = < Minimal Abstraction Layer for Object-oriented C >
603 * Copyright (C) 1994-- Michael Holst
604 *
605 * This library is free software; you can redistribute it and/or
606 * modify it under the terms of the GNU Lesser General Public
607 * License as published by the Free Software Foundation; either
608 * version 2.1 of the License, or (at your option) any later version.
609 *
610 * This library is distributed in the hope that it will be useful,
611 * but WITHOUT ANY WARRANTY; without even the implied warranty of
612 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
613 * Lesser General Public License for more details.
614 *
615 * You should have received a copy of the GNU Lesser General Public
616 * License along with this library; if not, write to the Free Software
617 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
618 *
619 * rcsid="INTENTIONALLY LEFT BLANK"
620 * ***************************************************************************
621 */
622
623/*
624 * ***************************************************************************
625 * File:     acconfig.h
626 *
627 * Purpose:  Generates the main configuration header "maloccf.h" for MALOC.
628 *
629 * Notes:    See the comments at the top of the file "configure.ac" for
630 *           an outline of the sequence of steps that turns acconfig.h
631 *           into <src/aaa_inc/maloccf.h.in> and then eventually into
632 *           <src/aaa_inc/maloccf.h> when you are using GNU autoconf.
633 *
634 *           This file can also form the basis for a manually-produced
635 *           maloccf.h file.  In fact, a correct Win32 maloccf.h file can be
636 *           generated simply by removing the two lines containing the
637 *           GNU autoconf tags "TOP" and "BOTTOM".
638 *
639 *           The final autoconf (or manually) generated "maloccf.h" attempts
640 *           to produce a correct header file layout for various UNIX-like
641 *           and Win32 machines, giving access to several things beyond ISO
642 *           C/C++, including BSD Signals, UNIX Domain sockets, INET TCP/IP
643 *           sockets, and the WINSOCK implementation of INET TCP/IP sockets.
644 *
645 *           The MALOC library then provides a portable abstract interface
646 *           to UNIX domain sockets, INET sockets, pipes, signals, and other
647 *           system-dependent things that one usually wants to get to in a
648 *           fairly standard C or C++ scientific software package.  Once
649 *           MALOC is built, "maloccf.h" is no longer needed (it is not
650 *           included in the set of API headers that are copied into the
651 *           specified header install directory.  In other words, none of
652 *           the MALOC headers forming the API include the config file
653 *           "maloccf.h"; it is only included by the source files.
654 *
655 * Author:   Michael Holst
656 * ***************************************************************************
657 */
658
659#ifndef _MALOCCF_H_
660#define _MALOCCF_H_
661])
662
663AH_BOTTOM([
664/*
665 * ***************************************************************************
666 * Handle some additional things manually (Win32, NeXT, etc)
667 * ***************************************************************************
668 */
669
670/* Win32 configuration (non-CygWin) */
671#if !defined(HAVE_CYGWIN)
672#   if defined(WIN32) || defined(_WIN32) || defined(__WATCOMC__)
673
674        /* Set the main key for specifying WIN32 code */
675#       define HAVE_WIN32
676
677        /* Deal with some basic problems with UNIX/WIN32 compatibility */
678#       define HAVE_O_NONBLOCK 1
679#       define HAVE_MODE_T 1
680#       define HAVE_GETCWD 1
681
682        /* WATCOM does STAT macros right; Microsoft does not */
683#       if !defined(__WATCOMC__)
684#           define STAT_MACROS_BROKEN 1
685#       endif
686
687        /* Required headers that exist in both UNIX and WIN32 */
688#       define HAVE_SYS_TYPES_H 1
689#       define HAVE_SYS_STAT_H 1
690#       define HAVE_FCNTL_H 1
691#       define HAVE_RPC_H 1
692
693        /* Required headers that exist only in WIN32 (non-CygWin) */
694#       define HAVE_DIRECT_H 1
695#       define HAVE_PROCESS_H 1
696#       define HAVE_WINSOCK_H 1
697#       define HAVE_IO_H 1
698
699#   endif
700#endif
701
702#if defined(NeXT) || defined(__NeXT__)
703#   define HAVE_NEXT
704#endif
705
706/*
707 * ***************************************************************************
708 * Deal with macros we need that are sometimes missing
709 * ***************************************************************************
710 */
711
712/* Deal with broken stat macros on some platforms */
713#if !defined(STAT_MACROS_BROKEN)
714#   define VS_ISREG(a) (((a) & S_IFMT) == S_IFREG)
715#else
716#   define VS_ISREG(a) (0)
717#endif
718
719/* Deal a missing macro on some unix platforms (NeXT, etc) */
720#if !defined(HAVE_O_NONBLOCK)
721#   define VO_NONBLOCK 00004
722#else
723#   define VO_NONBLOCK O_NONBLOCK
724#endif
725
726/*
727 * ***************************************************************************
728 * Define some RCS tag embedding and debug I/O macros
729 * ***************************************************************************
730 */
731
732/* Embedded RCS tags ("ident filename" prints module versions in filename) */
733#if defined(HAVE_EMBED)
734#    define VEMBED(rctag) \
735         VPRIVATE const char* rctag; \
736         static void* use_rcsid=(0 ? &use_rcsid : (void*)&rcsid);
737#else
738#    define VEMBED(rctag)
739#endif
740
741/* Produce additional debugging I/O */
742#if defined(HAVE_DEBUG)
743#    define VDEBUGIO(str) fprintf(stderr,str)
744#else
745#    define VDEBUGIO(str)
746#endif
747
748#endif /* _MALOCCF_H_ */
749])
750
751dnl ##########################################################################
752dnl 12. Test for doxygen and graphviz
753dnl ##########################################################################
754
755cwd=`pwd`
756cd ${srcdir}
757TOPDIR=`pwd`
758cd ${cwd}
759
760AC_ARG_WITH(doxygen, [AC_HELP_STRING([--with-doxygen],[Doxygen path])],
761                     with_doxygen=$withval, with_doxygen=no)
762
763if test "$with_doxygen" = "no"; then
764  AC_PATH_PROG(doxygen_path, doxygen)
765  if test -z "${doxygen_path}"; then
766    AC_MSG_WARN([Unable to find doxygen!])
767  fi
768else
769  doxygen_path=$with_doxygen
770fi
771
772AC_ARG_WITH(dot, [AC_HELP_STRING([--with-dot],[Dot path])],
773                  with_dot=$withval, with_dot=no)
774
775if test "$with_dot" = "no"; then
776  AC_PATH_PROG(dot_path, dot)
777  if test -z "${dot_path}"; then
778    AC_MSG_WARN([Unable to find dot!])
779  fi
780else
781  dot_path=$with_dot
782fi
783
784if test "$dot_path" = ""; then
785  sed -e 's%@have_dot@%'NO'%' $TOPDIR/doc/doxygen/maloc.dox.in > $TOPDIR/doc/doxygen/maloc.dox.in.temp
786  sed -e 's%@dot_path@%''%' $TOPDIR/doc/doxygen/maloc.dox.in.temp > $TOPDIR/doc/doxygen/maloc.dox.in.temp.2
787else
788  sed -e 's%@have_dot@%'YES'%' $TOPDIR/doc/doxygen/maloc.dox.in > $TOPDIR/doc/doxygen/maloc.dox.in.temp
789  sed -e 's%@dot_path@%'${dot_path}'%' $TOPDIR/doc/doxygen/maloc.dox.in.temp > $TOPDIR/doc/doxygen/maloc.dox.in.temp.2
790fi
791
792sed -e 's%@topdir@%'${TOPDIR}'%' $TOPDIR/doc/doxygen/maloc.dox.in.temp.2 > $TOPDIR/doc/doxygen/maloc.dox
793rm -f $TOPDIR/doc/doxygen/maloc.dox.in.temp*
794
795AM_CONDITIONAL(MAKE_DOC, test "$doxygen_path" != "")
796AC_SUBST(MAKE_DOC)
797AC_SUBST(doxygen_path)
798
799dnl ##########################################################################
800dnl 13. generate the makefiles
801dnl ##########################################################################
802
803
804AC_OUTPUT([
805    Makefile
806    src/Makefile
807
808    src/base/Makefile
809
810    src/efence/Makefile
811
812    src/vsys/Makefile
813    src/vsh/Makefile
814    src/psh/Makefile
815
816    src/aaa_inc/Makefile
817    src/aaa_inc/maloc/Makefile
818
819    src/aaa_lib/Makefile
820
821    doc/Makefile
822    doc/doxygen/Makefile
823])
824