bringing SDL 1.2.14 from vendor into the main branch
[AROS-Contrib.git] / regina / configure.in
blobb8ce1045bac9549d32f2b6fbe5ea3e75c5bdf17b
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(rexxsaa.h)
3 AC_PREFIX_DEFAULT(/usr)
5 VERSION=3.0
6 VERSION_NODOT=30
8 dnl ---------------------- check for C compiler -----------------
9 dnl Checks for one of the C compilers below - change if yours not there.
10 CC_LIST="gcc cc c89 acc"
11 MH_PROG_CC
13 AC_CONFIG_HEADER(config.h)
14 AC_ISC_POSIX
16 dnl Checks for system first
17 AC_CANONICAL_SYSTEM
19 mymakefile="Makefile"
20 on_qnx=no
21 on_beos=no
22 case "$target" in
23         *hp-hpux*)
24                 SYS_DEFS="-D_HPUX_SOURCE"
25                 ;;
26         *ibm-aix*)
27                 SYS_DEFS="-D_ALL_SOURCE"
28                 mymakefile="Makefile.aix"
29                 ;;
30         *dec-osf*)
31                 ;;
32         *sequent-dynix*)
33                 ;;
34         *solaris*)
35                 ;;
36         sparc*sunos*)
37                 ;;
38         *linux*)
39                 ;;
40         *nto-qnx*)
41                 ;;
42         *qnx*)
43                 on_qnx=yes
44                 SYS_DEFS="-Q"
45                 ;;
46         *beos*)
47                 on_beos=yes
48                 ;;
49 esac
50 AC_SUBST(SYS_DEFS)
52 dnl Check for dynamic shared library support libraries
53 MH_EXTRA_LIBS=""
54 MH_CHECK_LIB(dld dl)
55 SHLIBS="${MH_EXTRA_LIBS}"
57 dnl Check for extra required libraries - don't include libfl or libl
58 MH_EXTRA_LIBS=""
59 MH_CHECK_LIB(m nsl nsl_s socket)
60 dnl -- check for crypt library and function
61 MH_CHECK_CRYPT
62 AC_PROG_LEX
63 BOTHLIBS="${LEXLIB} ${MH_EXTRA_LIBS}"
65 MH_HAVE_PROTO
66 if test "$mh_have_proto" = "no"; then
67         AC_MSG_ERROR(Regina requires an ANSI compiler; cannot continue)
70 AC_PROG_GCC_TRADITIONAL
71 AC_PROG_RANLIB
73 dnl --------------------- Check for other programs. ---------------
74 AC_PROG_LN_S
75 AC_PROG_MAKE_SET
77 dnl -------------------- Checks for header files. -----------------
78 AC_HEADER_STDC
79 AC_CHECK_HEADERS( \
80         stdio.h \
81         stdlib.h \
82         setjmp.h \
83         unistd.h \
84         ctype.h \
85         pwd.h \
86         grp.h \
87         math.h \
88         poll.h \
89         time.h \
90         sys/time.h \
91         sys/wait.h \
92         sys/stat.h \
93         assert.h \
94         errno.h \
95         stdarg.h \
96         string.h \
97         termios.h \
98         signal.h \
99         limits.h \
100         fcntl.h \
101         malloc.h \
102         dl.h \
103         sys/select.h \
104         arpa/inet.h  \
105         sys/socket.h \
106         sys/resource.h \
107         netinet/in.h \
108         netdb.h
109         )
111 AC_CHECK_FUNCS(sysconf putenv usleep random ftruncate memcpy memmove strerror strerror_r gettimeofday ftime _fullpath vsprintf _splitpath2 _splitpath sigaction mkstemp)
113 dnl Checks for typedefs, structures, and compiler characteristics.
114 AC_C_CONST
115 AC_TYPE_SIZE_T
116 AC_HEADER_TIME
117 AC_STRUCT_TM
118 MH_CHECK_CC_O
119 MH_CHECK__SIGHANDLER_T
120 MH_STRUCT_RANDOM_DATA
122 dnl Checks for library functions.
123 AC_FUNC_MEMCMP
124 AC_FUNC_ALLOCA
125 if test $ac_cv_func_alloca_works = yes; then
126         ALLOCA_SHO=""
127 else
128         ALLOCA_SHO="alloca.sho"
130 AC_SUBST(ALLOCA_SHO)
132 dnl --------------- allow --enable-debug to compile in debug mode --------
133 AC_ARG_ENABLE(debug,
134         [  --enable-debug          turn on debugging],
135         [with_debug=$enableval],
136         [with_debug=no],
138 cflags_g="`echo $CFLAGS | grep -c '\-g'`"
139 cflags_O="`echo $CFLAGS | grep -c '\-O'`"
141 if test "$with_debug" = yes; then
142         DEBUG="-DDEBUG"
143         AC_SUBST(DEBUG)
144         if test "$cflags_g" = "0"; then
145                 CFLAGS="${CFLAGS} -g"
146         fi
147         if test "$cflags_O" != "0"; then
148                 CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`"
149         fi
150 else
151         DEBUG="-DNDEBUG"
152         AC_SUBST(DEBUG)
153         if test "$cflags_O" = "0"; then
154                 CFLAGS="${CFLAGS} -O"
155         fi
156         if test "$cflags_g" != "0"; then
157                 CFLAGS="`echo ${CFLAGS} | sed -e s/-g//`"
158         fi
160 if test "$ac_cv_prog_CC" = "gcc"; then
161         if test "$with_debug" = yes; then
162                 CFLAGS="${CFLAGS} -Wall"
163         else
164                 CFLAGS="-O3 -Wall -fomit-frame-pointer"
165         fi
167 if test "$on_qnx" = yes; then
168         if test "$with_debug" = yes; then
169                 CFLAGS="-g"
170         else
171                 CFLAGS="-Otax"
172         fi
174 if test "$on_beos" = yes; then
175         if test "$with_debug" = yes; then
176                 CFLAGS="${CFLAGS} -Wall"
177         else
178                 CFLAGS="-O2 -Wall"
179         fi
180         sharedir="/boot/home/config/add-ons/rexx"
181 else
182         if test "x$prefix" != xNONE; then
183            sharedir="$prefix/share/regina"
184         else
185            sharedir="$ac_default_prefix/share/regina"
186         fi
188 AC_SUBST(sharedir)
190 dnl --------------- allow --enable-purify to enable linking with Purify
191 AC_ARG_ENABLE(purify,
192         [  --enable-purify         link with Purify (TM)],
193         [with_purify=$enableval],
194         [with_purify=no],
196 if test "$with_purify" = yes; then
197         PURIFY="purify"
198 else
199         PURIFY=""
201 AC_SUBST(PURIFY)
203 dnl --------------- allow --enable-posix-threads to enable multi-threading
204 AC_ARG_ENABLE(posix-threads,
205         [  --enable-posix-threads  enable POSIX-style multi-threading],
206         [enable_posix_threads=$enableval],
207         [enable_posix_threads=no],
209 MH_CHECK_POSIX_THREADS
210 if test "$mh_has_pthreads" = yes; then
211         save_cflags="$CFLAGS"
212         CFLAGS="$CFLAGS $THREADING_COMPILE"
214 # Where we know the format of getgrgid_r() function
215 # only test for that case
217         case "$target" in
218                 *solaris*)
219                         MH_GETGRGID_R_STRUCT_RETURN
220                         ;;
221                 *linux*)
222                         MH_GETGRGID_R_INT_RETURN_5_PARMS
223                         ;;
224                 *dec-osf*)
225                         MH_GETGRGID_R_INT_RETURN_5_PARMS
226                         ;;
227                 *)
228                         MH_GETGRGID_R_INT_RETURN_5_PARMS
229                         if test "$mh_cv_getgrgid_r_int5" = "no"; then
230                                 MH_GETGRGID_R_INT_RETURN_4_PARMS
231                                 if test "$mh_cv_getgrgid_r_int4" = "no"; then
232                                         MH_GETGRGID_R_STRUCT_RETURN
233                                 fi
234                         fi
235         esac
236         MH_GETPWUID_R_INT_RETURN
237         if test "$mh_cv_getpwuid_r_int" = "no"; then
238                 MH_GETPWUID_R_STRUCT_RETURN
239         fi
240         CFLAGS="$save_CFLAGS"
241         REGINAMULTITHREAD="yes"
242 else
243         REGINAMULTITHREAD="no"
245 AC_SUBST(REGINAMULTITHREAD)
247 dnl --------------- allow --enable-tracemem to enable internal memory tracing
248 AC_ARG_ENABLE(tracemem,
249         [  --enable-tracemem       enable memory tracing in debug mode],
250         [with_tracemem=$enableval],
251         [with_tracemem=no],
253 if test "$with_tracemem" = yes; then
254         TRACEMEM="-DTRACEMEM"
255 else
256         TRACEMEM=""
258 AC_SUBST(TRACEMEM)
260 dnl --------------- allow --disable-flists to disable memory functions
261 AC_ARG_ENABLE(flists,
262         [  --disable-flists        disable memory management functions],
263         [with_flists=$enableval],
264         [with_flists=yes],
266 if test "$with_flists" = no; then
267         FLISTS="-DNOFLISTS"
268 else
269         FLISTS=""
271 AC_SUBST(FLISTS)
273 dnl --------------- allow --with-socket to specify socket for rxstack
274 AC_ARG_WITH(socket,
275         [  --with-socket=9999      socket to use for external queues (default 5757)],
276         [with_socket=$withval],
277         [with_socket=no],
279 if test "$with_socket" = no; then
280         REXXSOCKET=""
281 else
282         REXXSOCKET="-DRXSOCKET=$with_socket"
284 AC_SUBST(REXXSOCKET)
286 dnl --------------- allow --with-dlfcnincdir to enable compiling with dlfcn.h on platforms that don't provide dl*() functions natively
287 AC_ARG_WITH(dlfcnincdir,
288         [  --with-dlfcnincdir      location of dlfcn.h],
289         [with_dlfcnincdir=$withval],
290         [with_dlfcnincdir=no],
292 if test "$with_dlfcnincdir" = no; then
293         DLFCNINCDIR=""
294         AC_CHECK_HEADERS( dlfcn.h )
295 else
296         if test -f "$with_dlfcnincdir/dlfcn.h"; then
297            DLFCNINCDIR="-I$with_dlfcnincdir"
298            HAVE_DLFCN_H="1"
299            AC_DEFINE(HAVE_DLFCN_H)
300         else
301            AC_MSG_ERROR(dlfcn.h not found in \"$with_dlfcnincdir\" as specified in --with-dlfcnincdir switch; cannot continue)
302         fi
304 AC_SUBST(DLFCNINCDIR)
306 dnl --------------- allow --with-dlfcnlibdir to enable compiling with dlfcn.h on platforms that don't provide dl*() functions natively
307 AC_REQUIRE([MH_SHLPST])
308 AC_ARG_WITH(dlfcnlibdir,
309         [  --with-dlfcnlibdir      location of libdl.a(AIX) libdl.dylib(MacOSX)],
310         [with_dlfcnlibdir=$withval],
311         [with_dlfcnlibdir=no],
313 if test "$with_dlfcnlibdir" = no; then
314         DLFCNLIBDIR=""
315 else
316         if test -f "$with_dlfcnlibdir/libdl$SHLPST"; then
317            DLFCNLIBDIR="-L$with_dlfcnlibdir -ldl"
318         else
319            AC_MSG_ERROR(libdl$SHLPST not found in \"$with_dlfcnlibdir\" as specified in --with-dlfcnlibdir switch; cannot continue)
320         fi
322 AC_SUBST(DLFCNLIBDIR)
324 dnl --------------- Check how to make shared libraries -------------------
325 dnl MH_SHARED_LIBRARY must be called after determining if POSIX threads is specified
326 MH_SHARED_LIBRARY
328 dnl --------------- Check if underscore is needed in loadable modules ----
329 dnl MH_CHECK_LEADING_USCORE must be called after processing --with-dlfcn[inc,lib]dir switches
330 MH_CHECK_LEADING_USCORE
332 dnl --------------- Force definition of pre-compiler macro UNIX ----------
333 AC_DEFINE(UNIX)
335 dnl --------------- where to install startup/shutdown scripts ------------
336 STARTUPDIR="/etc"
337 if test -d /etc/rc.d/init.d; then
338         STARTUPDIR="/etc/rc.d/init.d"
339 else
340         if test -d /etc/init.d; then
341                 STARTUPDIR="/etc/init.d"
342         fi
344 AC_SUBST(STARTUPDIR)
345 AC_SUBST(VERSION)
346 AC_SUBST(VERSION_NODOT)
348 dnl AC_OUTPUT(Makefile)
350 AC_OUTPUT($mymakefile regina-config rxstack.init.d)
351 chmod 755 regina-config
353 case "$target" in
354         *ibm-aix*)
355                 mv Makefile.aix Makefile
356                 AC_MSG_RESULT(renaming Makefile.aix to Makefile)
357                 ;;
358         *)
359                 ;;
360 esac