4 dnl MH_CHECK__SIGHANDLER_T
5 dnl MH_STRUCT_RANDOM_DATA
6 dnl MH_GETGRGID_R_INT_RETURN_5_PARAMS
7 dnl MH_GETGRGID_R_INT_RETURN_4_PARAMS
8 dnl MH_GETGRGID_R_STRUCT_RETURN
9 dnl MH_GETPWUID_R_INT_RETURN
10 dnl MH_GETPWUID_R_STRUCT_RETURN
11 dnl MH_GETHOSTBYNAME_R_INT_RETURN_6_PARAMS
12 dnl MH_GETHOSTBYNAME_R_STRUCT_RETURN_5_PARAMS
13 dnl MH_CHECK_POSIX_THREADS
14 dnl MH_CHECK_LEADING_USCORE
16 dnl MH_HOWTO_SHARED_LIBRARY
23 dnl MH_CHECK_UNSIGNED_CHAR_COMPILER_SWITCH
26 dnl MH_CHECK_TYPE_SOCKLEN_T
27 dnl MH_CHECK_F_MNTFROMNAME
29 dnl ---------------------------------------------------------------------------
30 dnl Determine if C compiler handles ANSI prototypes
31 dnl ---------------------------------------------------------------------------
32 AC_DEFUN([MH_HAVE_PROTO],
34 AC_MSG_CHECKING(if compiler supports ANSI prototypes)
36 dnl override existing value of $ac_compile so we use the correct compiler
37 dnl SHOULD NOT NEED THIS
39 ac_compile='$ac_cv_prog_CC conftest.$ac_ext $CFLAGS $CPPFLAGS -c 1>&5 2>&5'
40 AC_TRY_COMPILE([#include <stdio.h>],
41 [extern int xxx(int, char *);],
42 mh_have_proto=yes; AC_DEFINE(HAVE_PROTO), mh_have_proto=no )
43 AC_MSG_RESULT($mh_have_proto)
45 dnl ---------------------------------------------------------------------------
46 dnl Determine the best C compiler to use given a list
47 dnl ---------------------------------------------------------------------------
48 AC_DEFUN([MH_PROG_CC],
54 AC_MSG_CHECKING(for one of the following C compilers: $all_words)
55 AC_CACHE_VAL(ac_cv_prog_CC,[
56 if test -n "$CC"; then
57 ac_cv_prog_CC="$CC" # Let the user override the test.
59 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
60 for mh_cc in $all_words; do
61 for ac_dir in $PATH; do
62 test -z "$ac_dir" && ac_dir=.
63 if test -f $ac_dir/$mh_cc; then
64 ac_cv_prog_CC="$mh_cc"
65 if test "$ac_dir" = "/usr/5bin"; then
66 mh_sysv_incdir="/usr/5include"
67 mh_sysv_libdir="/usr/5lib"
74 test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
79 if test "$ac_dir" = ""; then
80 AC_MSG_RESULT(using $ac_cv_prog_CC specified in CC env variable)
82 AC_MSG_RESULT(using $ac_dir/$ac_cv_prog_CC)
85 dnl ---------------------------------------------------------------------------
86 dnl Check if C compiler supports -c -o file.ooo
87 dnl ---------------------------------------------------------------------------
88 AC_DEFUN([MH_CHECK_CC_O],
90 AC_MSG_CHECKING(whether $CC understands -c and -o together)
91 set dummy $CC; ac_cc="`echo [$]2 |
93 sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
95 AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
96 [echo 'int foo(){}' > conftest.c
97 # We do the test twice because some compilers refuse to overwrite an
98 # existing .o file with -o, though they will create one.
99 eval ac_cv_prog_cc_${ac_cc}_c_o=no
100 ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&AC_FD_CC'
101 if AC_TRY_EVAL(ac_try) && test -f conftest.ooo && AC_TRY_EVAL(ac_try);
103 ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&AC_FD_CC'
104 if AC_TRY_EVAL(ac_try) && test -f conftest.ooo && AC_TRY_EVAL(ac_try);
106 eval ac_cv_prog_cc_${ac_cc}_c_o=yes
111 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
121 O2SHO="-mv \`basename "$'@'" .so.o\`.o "$'@'
122 O2SAVE="-mv \`basename "$'@'" .so.o\`.o \`basename "$'@'" .so.o\`.o.save"
123 SAVE2O="-mv \`basename "$'@'" .so.o\`.o.save \`basename "$'@'" .so.o\`.o"
124 O2TSO="-mv \`basename "$'@'" .tso\`.o "$'@'
125 O2TSAVE="-mv \`basename "$'@'" .tso\`.o \`basename "$'@'" .tso\`.tso.save"
126 TSAVE2O="-mv \`basename "$'@'" .tso\`.tso.save \`basename "$'@'" .tso\`.o"
131 dnl ---------------------------------------------------------------------------
132 dnl Check if gcc compiler supports -fno-strict-aliasing
133 dnl ---------------------------------------------------------------------------
134 AC_DEFUN([MH_CHECK_GCC_STRICT_ALIASING],
136 AC_MSG_CHECKING(whether gcc understands -fno-strict-aliasing)
138 [mh_strict_aliasing],
141 LIBS="-fno-strict-aliasing"
143 [AC_LANG_PROGRAM([#include <stdio.h>],
145 [mh_strict_aliasing=yes],
146 [mh_strict_aliasing=no]
149 if test "$mh_strict_aliasing" = yes; then
150 MH_STRICT_ALIASING="-fno-strict-aliasing"
152 MH_STRICT_ALIASING=""
154 AC_SUBST(MH_STRICT_ALIASING)
156 AC_MSG_RESULT($mh_strict_aliasing)
158 dnl ---------------------------------------------------------------------------
159 dnl Check if compiler supports __builtin_return_address
160 dnl ---------------------------------------------------------------------------
161 AC_DEFUN([MH_CHECK_BUILTIN_RETURN_ADDRESS],
163 AC_MSG_CHECKING(whether compiler supports __builtin_return_address inline function)
165 [mh_cv_builtin_return_address],
168 [#include <stdio.h>],
169 [__builtin_return_address(0)],
170 [mh_cv_builtin_return_address=yes],
171 [mh_cv_builtin_return_address=no]
174 AC_MSG_RESULT($mh_cv_builtin_return_address)
175 if test "$mh_cv_builtin_return_address" = yes; then
176 AC_DEFINE(HAVE_BUILTIN_RETURN_ADDRESS)
180 dnl ---------------------------------------------------------------------------
181 dnl Determine compiler's "unsigned char" is default switch
182 dnl ---------------------------------------------------------------------------
183 AC_DEFUN([MH_CHECK_UNSIGNED_CHAR_COMPILER_SWITCH],
186 AC_MSG_CHECKING(compiler switch for unsigned char)
188 # QNX4 Watcom compiler is unsigned char by default
190 if test "$on_qnx4" = yes -a "$ac_cv_prog_CC" = "cc" ; then
191 qnx4_char_unsigned="yes"
194 if test "$ac_cv_c_char_unsigned" = yes -o "$qnx4_char_unsigned" = yes; then
195 MH_UNSIGNED_CHAR_SWITCH=""
196 msg="not needed - char is unsigned by default"
198 case "$ac_cv_prog_CC" in
200 MH_UNSIGNED_CHAR_SWITCH="-funsigned-char"
201 msg="$MH_UNSIGNED_CHAR_SWITCH"
204 MH_UNSIGNED_CHAR_SWITCH="-qchars=unsigned"
205 msg="$MH_UNSIGNED_CHAR_SWITCH"
208 save_cflags="$CFLAGS"
209 mh_have_unsigned_char_switch=no
210 mh_unsigned_flags="-funsigned-char -xchar=unsigned"
211 for mh_flag in $mh_unsigned_flags; do
212 CFLAGS="$CFLAGS $mh_flag"
213 AC_TRY_COMPILE([#include <stdio.h>],
215 MH_UNSIGNED_CHAR_SWITCH="$mh_flag"; msg="$MH_UNSIGNED_CHAR_SWITCH"; mh_have_unsigned_char_switch=yes )
216 CFLAGS="$save_cflags"
217 if test "$mh_have_unsigned_char_switch" = yes; then
221 if test "$mh_have_unsigned_char_switch" = no; then
222 msg="unknown - assuming unsigned by default but running execiser will confirm"
227 AC_MSG_RESULT("$msg")
228 AC_SUBST(MH_UNSIGNED_CHAR_SWITCH)
230 dnl ---------------------------------------------------------------------------
231 dnl Check if gcc compiler supports --version-script
232 dnl ---------------------------------------------------------------------------
233 AC_DEFUN([MH_CHECK_GCC_VERSION_SCRIPT],
235 AC_MSG_CHECKING(whether gcc understands --version-script)
237 [mh_cv_version_script],
239 echo "TEST {" > conftest.def
240 echo "global:" >> conftest.def
241 echo "Test;" >> conftest.def
242 echo "};" >> conftest.def
243 mh_save_libs="$LDFLAGS"
244 LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.def"
246 [AC_LANG_PROGRAM([#include <stdio.h>],
248 [mh_cv_version_script=yes],
249 [mh_cv_version_script=no]
251 LDFLAGS="$mh_save_libs"
254 if test "$mh_cv_version_script" = yes; then
255 SHL_SCRIPT="-Wl,--version-script=${srcdir}/regina_elf.def"
260 AC_MSG_RESULT($mh_cv_version_script)
263 dnl ---------------------------------------------------------------------------
264 dnl Check if __sighandler_t is defined
265 dnl ---------------------------------------------------------------------------
266 AC_DEFUN([MH_CHECK__SIGHANDLER_T],
268 AC_MSG_CHECKING(whether __sighandler_t is defined)
271 [mh_cv__sighandler_t],
274 [#include <sys/types.h>]
275 [#include <signal.h>],
276 [__sighandler_t fred],
277 [mh_cv__sighandler_t=yes],
278 [mh_cv__sighandler_t=no]
281 AC_MSG_RESULT($mh_cv__sighandler_t)
282 if test "$mh_cv__sighandler_t" = yes ; then
283 AC_DEFINE(HAVE__SIGHANDLER_T)
288 dnl ---------------------------------------------------------------------------
289 dnl Work out if struct random_data is defined
290 dnl ---------------------------------------------------------------------------
291 AC_DEFUN(MH_STRUCT_RANDOM_DATA,
292 [AC_CACHE_CHECK([for struct random_data], mh_cv_struct_random_data,
293 [AC_TRY_COMPILE([#include <stdlib.h>
295 [struct random_data s;],
296 mh_cv_struct_random_data=yes, mh_cv_struct_random_data=no)])
297 if test $mh_cv_struct_random_data = yes; then
298 AC_DEFINE(HAVE_RANDOM_DATA)
302 dnl ---------------------------------------------------------------------------
303 dnl Work out if getgrgid_r returns an int and has 5 parameters
304 dnl ---------------------------------------------------------------------------
305 AC_DEFUN(MH_GETGRGID_R_INT_RETURN_5_PARAMS,
306 [AC_CACHE_CHECK([if getgrgid_r has 5 args and returns an int], mh_cv_getgrgid_r_int5,
307 [AC_TRY_COMPILE([#include <sys/types.h>
311 struct group *ptr,result;
315 rc = getgrgid_r(gid,&result,buf,sizeof(buf),&ptr);
317 mh_cv_getgrgid_r_int5=yes, mh_cv_getgrgid_r_int5=no)])
318 if test $mh_cv_getgrgid_r_int5 = yes; then
319 AC_DEFINE(HAVE_GETGRGID_R_RETURNS_INT_5_PARAMS)
323 dnl ---------------------------------------------------------------------------
324 dnl Work out if getgrgid_r returns an int and has 4 parameters
325 dnl ---------------------------------------------------------------------------
326 AC_DEFUN(MH_GETGRGID_R_INT_RETURN_4_PARAMS,
327 [AC_CACHE_CHECK([if getgrgid_r has 4 args and returns an int], mh_cv_getgrgid_r_int4,
328 [AC_TRY_COMPILE([#include <sys/types.h>
332 struct group *ptr,result;
336 rc = getgrgid_r(gid,&result,buf,sizeof(buf));
338 mh_cv_getgrgid_r_int4=yes, mh_cv_getgrgid_r_int4=no)])
339 if test $mh_cv_getgrgid_r_int4 = yes; then
340 AC_DEFINE(HAVE_GETGRGID_R_RETURNS_INT_4_PARAMS)
344 dnl ---------------------------------------------------------------------------
345 dnl Work out if getgrgid_r returns a struct group *
346 dnl ---------------------------------------------------------------------------
347 AC_DEFUN(MH_GETGRGID_R_STRUCT_RETURN,
348 [AC_CACHE_CHECK([if getgrgid_r returns a struct group *], mh_cv_getgrgid_r_struct,
349 [AC_TRY_COMPILE([#include <sys/types.h>
353 struct group *ptr,result;
357 ptr = getgrgid_r(gid,&result,buf,sizeof(buf));
359 mh_cv_getgrgid_r_struct=yes, mh_cv_getgrgid_r_struct=no)])
360 if test $mh_cv_getgrgid_r_struct = yes; then
361 AC_DEFINE(HAVE_GETGRGID_R_RETURNS_STRUCT)
365 dnl ---------------------------------------------------------------------------
366 dnl Work out if getpwuid_r returns an int
367 dnl ---------------------------------------------------------------------------
368 AC_DEFUN(MH_GETPWUID_R_INT_RETURN,
369 [AC_CACHE_CHECK([if getpwuid_r returns an int], mh_cv_getpwuid_r_int,
370 [AC_TRY_COMPILE([#include <sys/types.h>
374 struct passwd *ptr,*result;
378 rc = getpwuid_r(uid,&result,buf,sizeof(buf),&ptr);
380 mh_cv_getpwuid_r_int=yes, mh_cv_getpwuid_r_int=no)])
381 if test $mh_cv_getpwuid_r_int = yes; then
382 AC_DEFINE(HAVE_GETPWUID_R_RETURNS_INT)
386 dnl ---------------------------------------------------------------------------
387 dnl Work out if getpwuid_r returns a struct group *
388 dnl ---------------------------------------------------------------------------
389 AC_DEFUN(MH_GETPWUID_R_STRUCT_RETURN,
390 [AC_CACHE_CHECK([if getpwuid_r returns a struct passwd *], mh_cv_getpwuid_r_struct,
391 [AC_TRY_COMPILE([#include <sys/types.h>
395 struct group *ptr,*result;
399 ptr = getpwuid_r(uid,&result,buf,sizeof(buf));
401 mh_cv_getpwuid_r_struct=yes, mh_cv_getpwuid_r_struct=no)])
402 if test $mh_cv_getpwuid_r_struct = yes; then
403 AC_DEFINE(HAVE_GETPWUID_R_RETURNS_STRUCT)
407 dnl ---------------------------------------------------------------------------
408 dnl Work out if gethostbyname_r returns a struct and has 6 parameters
409 dnl ---------------------------------------------------------------------------
410 AC_DEFUN(MH_GETHOSTBYNAME_R_INT_RETURN_6_PARAMS,
411 [AC_CACHE_CHECK([if gethostbyname_r has 6 args and returns an int], mh_cv_gethostbyname_r_int6,
412 [AC_TRY_COMPILE([#include <sys/types.h>
416 struct hostent *he,*rc;
418 struct hostent retval;
419 rc = gethostbyname_r("fred",&retval,buf,sizeof(buf),&he,&herr);
421 mh_cv_gethostbyname_r_int6=yes, mh_cv_gethostbyname_r_int6=no)])
422 if test $mh_cv_gethostbyname_r_int6 = yes; then
423 AC_DEFINE(HAVE_GETHOSTBYNAME_R_RETURNS_INT_6_PARAMS)
427 dnl ---------------------------------------------------------------------------
428 dnl Work out if gethostbyname_r returns a struct and has 5 parameters
429 dnl ---------------------------------------------------------------------------
430 AC_DEFUN(MH_GETHOSTBYNAME_R_STRUCT_RETURN_5_PARAMS,
431 [AC_CACHE_CHECK([if gethostbyname_r has 5 args and returns a struct], mh_cv_gethostbyname_r_struct5,
432 [AC_TRY_COMPILE([#include <sys/types.h>
436 struct hostent *he,*rc;
438 struct hostent retval;
439 rc = gethostbyname_r("fred",&retval,buf,sizeof(buf),&herr);
441 mh_cv_gethostbyname_r_struct5=yes, mh_cv_gethostbyname_r_struct5=no)])
442 if test $mh_cv_gethostbyname_r_struct5 = yes; then
443 AC_DEFINE(HAVE_GETHOSTBYNAME_R_RETURNS_STRUCT_5_PARAMS)
447 dnl ---------------------------------------------------------------------------
448 dnl Work out if POSIX Threads are supported
449 dnl ---------------------------------------------------------------------------
450 AC_DEFUN([MH_CHECK_POSIX_THREADS],
457 if test "$enable_posix_threads" = yes; then
459 dnl -lrt is needed by posix threads on Solaris
461 AC_CHECK_LIB(rt,main,mh_rt_lib_found=yes,mh_rt_lib_found=no)
462 AC_MSG_CHECKING(whether Posix Threads are supported)
464 save_cflags="$CFLAGS"
465 pthread_libs="pthreads pthread c_r"
468 CFLAGS="$CFLAGS -pthread"
471 for mh_lib in $pthread_libs; do
472 LIBS="$tmpLIBS -l${mh_lib}"
474 [#include <pthread.h>],
475 [pthread_create(NULL,NULL,NULL,NULL)],
476 [mh_has_pthreads=yes],
479 if test "$mh_has_pthreads" = yes; then
480 MH_MT_LIBS="-l${mh_lib}"
481 AC_REQUIRE([AC_CANONICAL_SYSTEM])
482 THREADING_COMPILE="-D_REENTRANT -DPOSIX"
484 THREADSAFE_TARGET="threader${binarybitprefix}${EXEEXT}"
488 if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then
489 THREADING_COMPILE="-D_REENTRANT -DPOSIX"
490 if test "$mh_rt_lib_found" = "yes"; then
491 THREADING_LINK="-lrt"
494 THREADING_COMPILE="-mt -D_REENTRANT -DREENTRANT -D_PTHREAD_SEMANTICS"
499 if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then
500 THREADING_COMPILE="-D_REENTRANT -DPOSIX"
502 if test "$mh_rt_lib_found" = "yes"; then
503 THREADING_LINK="-lrt"
509 THREADING_COMPILE="-pthread -D_REENTRANT -DPOSIX"
510 THREADING_LINK="-pthread"
513 THREADING_COMPILE="-D_REENTRANT -DPOSIX"
517 if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then
518 THREADING_COMPILE="-D_REENTRANT -DPOSIX"
526 CFLAGS="$save_cflags"
527 AC_MSG_RESULT($mh_has_pthreads)
529 AC_SUBST(THREADING_COMPILE)
530 AC_SUBST(THREADING_LINK)
531 AC_SUBST(THREADSAFE_TARGET)
536 dnl ---------------------------------------------------------------------------
537 dnl Work out if functions in dynamically loadable libraries need leading _
538 dnl Tests based on glib code and only valid for dlopen() mechanism
539 dnl ---------------------------------------------------------------------------
540 AC_DEFUN([MH_CHECK_LEADING_USCORE],
542 if test "$ac_cv_header_dlfcn_h" = "yes" -o "$HAVE_DLFCN_H" = "1"; then
543 AC_MSG_CHECKING(if symbols need underscore prepended in loadable modules)
545 save_cflags="$CFLAGS"
546 LIBS="$LIBS $DLFCNLIBDIR"
547 CFLAGS="$CFLAGS $DLFCNINCDIR"
548 AC_CACHE_VAL(mh_cv_uscore,[
551 int mh_underscore_test (void) { return 42; }
553 void *f1 = (void*)0, *f2 = (void*)0, *handle;
554 handle = dlopen ((void*)0, 0);
556 f1 = dlsym (handle, "mh_underscore_test");
557 f2 = dlsym (handle, "_mh_underscore_test");
558 } return (!f2 || f1);
565 AC_MSG_RESULT($mh_cv_uscore)
566 if test "x$mh_cv_uscore" = "xyes"; then
567 AC_DEFINE(MODULES_NEED_USCORE)
570 CFLAGS="$save_cflags"
574 dnl ---------------------------------------------------------------------------
575 dnl Work out how to create a dynamically loaded module
576 dnl ---------------------------------------------------------------------------
577 AC_DEFUN([MH_HOWTO_DYN_LINK],
579 mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&AC_FD_CC'
580 cat > conftest.$ac_ext <<EOF
581 dnl [#]line __oline__ "[$]0"
582 [#]line __oline__ "configure"
588 if AC_TRY_EVAL(mh_compile) && test -s conftest.o; then
589 mh_dyn_link='ld -shared -o conftest.rxlib conftest.o -lc 1>&AC_FD_CC'
590 # mh_dyn_link='${CC} -Wl,-shared -o conftest.rxlib conftest.o -lc 1>&AC_FD_CC'
591 if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.rxlib; then
592 LD_RXLIB_A1="ld -shared -o \$(@)"
593 LD_RXLIB_A2="ld -shared -o \$(@)"
594 LD_RXLIB_UTILA="ld -shared -o \$(@)"
595 # LD_RXLIB1="${CC} -Wl,-shared"
596 LD_RXLIB_B1="-L. -l${SHLFILE}"
597 LD_RXLIB_B2="-L. -l${SHLFILE}"
598 LD_RXLIB_UTILB="-L. -l${SHLFILE}"
602 mh_dyn_link='ld -G -o conftest.rxlib conftest.o 1>&AC_FD_CC'
603 # mh_dyn_link='${CC} -Wl,-G -o conftest.rxlib conftest.o 1>&AC_FD_CC'
604 if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.rxlib; then
605 LD_RXLIB_A1="ld -G -o \$(@)"
606 LD_RXLIB_A2="ld -G -o \$(@)"
607 LD_RXLIB_UTILA="ld -G -o \$(@)"
608 # LD_RXLIB1="${CC} -Wl,-G"
609 LD_RXLIB_B1="-L. -l${SHLFILE}"
610 LD_RXLIB_B2="-L. -l${SHLFILE}"
611 LD_RXLIB_UTILB="-L. -l${SHLFILE}"
629 dnl ---------------------------------------------------------------------------
630 dnl Work out how to create a shared library
631 dnl ---------------------------------------------------------------------------
632 AC_DEFUN(MH_HOWTO_SHARED_LIBRARY,
634 AC_MSG_CHECKING(how to create a shared library)
635 mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&AC_FD_CC'
636 cat > conftest.$ac_ext <<EOF
637 dnl [#]line __oline__ "[$]0"
638 [#]line __oline__ "configure"
644 if AC_TRY_EVAL(mh_compile) && test -s conftest.o; then
645 mh_dyn_link='ld -shared -o conftest.so.1.0 conftest.o -lc 1>&AC_FD_CC'
646 # mh_dyn_link='${CC} -Wl,-shared -o conftest.so.1.0 conftest.o -lc 1>&AC_FD_CC'
647 if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
648 SHL_LD="ld -shared -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'" -lc"
649 # SHL_LD="${CC} -Wl,-shared -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'" -lc"
651 mh_dyn_link='ld -G -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
652 # mh_dyn_link='${CC} -Wl,-G -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
653 if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
654 SHL_LD="ld -G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
655 # SHL_LD="${CC} -Wl,-G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
657 mh_dyn_link='ld -o conftest.so.1.0 -shared -no_archive conftest.o -lc 1>&AC_FD_CC'
658 # mh_dyn_link='${CC} -o conftest.so.1.0 -Wl,-shared,-no_archive conftest.o -lc 1>&AC_FD_CC'
659 if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
660 SHL_LD="ld -o ${SHLPRE}${SHLFILE}${SHLPST} -shared -no_archive "'$('SHOFILES')'" -lc"
661 # SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -Wl,-shared,-no_archive "'$('SHOFILES')'" -lc"
663 mh_dyn_link='ld -b -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
664 # mh_dyn_link='${CC} -Wl,-b -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
665 if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
666 SHL_LD="ld -b -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
667 # SHL_LD="${CC} -Wl,-b -o ${SHLPRE}${SHLFILE}.${SHLPST} "'$('SHOFILES')'
669 mh_dyn_link='ld -Bshareable -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
670 # mh_dyn_link='${CC} -Wl,-Bshareable -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
671 if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
672 SHL_LD="ld -Bshareable -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
673 # SHL_LD="${CC} -Wl,-Bshareable -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
675 mh_dyn_link='ld -assert pure-text -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
676 # mh_dyn_link='${CC} -Wl,-assert pure-text -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
677 if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
678 SHL_LD="ld -assert pure-text -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
679 # SHL_LD="${CC} -Wl,-assert pure-text -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
689 if test "$SHL_LD" = ""; then
690 AC_MSG_RESULT(unknown)
697 dnl ---------------------------------------------------------------------------
698 dnl Check for presence of various libraries
699 dnl ---------------------------------------------------------------------------
700 AC_DEFUN([MH_CHECK_LIB],
704 if test "$on_qnx4" = yes -a "$ac_cv_prog_CC" != "gcc"; then
705 AC_MSG_CHECKING(for library -l${mh_lib})
706 if test -r /usr/lib/${mh_lib}3r.lib; then
708 MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}"
710 AC_MSG_RESULT(not found)
713 AC_CHECK_LIB($mh_lib,main,mh_lib_found=yes,mh_lib_found=no)
714 if test "$mh_lib_found" = yes; then
715 MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}"
721 dnl ---------------------------------------------------------------------------
722 dnl Check for presence of various libraries
723 dnl ---------------------------------------------------------------------------
724 AC_DEFUN([MH_CHECK_CRYPT],
728 if test "$on_qnx4" = no; then
729 AC_CHECK_LIB(crypt,main,mh_crypt_found=yes,mh_crypt_found=no)
730 if test "$mh_crypt_found" = yes; then
731 LIBS="${LIBS} -lcrypt"
735 AC_MSG_CHECKING(for crypt function)
741 [#include <unistd.h>],
742 [crypt("fred","aa")],
743 [mh_cv_func_crypt=yes],
744 [mh_cv_func_crypt=no]
747 AC_MSG_RESULT($mh_cv_func_crypt)
748 if test "$mh_cv_func_crypt" = yes ; then
749 AC_DEFINE(HAVE_CRYPT)
750 if test "$mh_crypt_found" = yes; then
751 MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -lcrypt"
759 dnl ---------------------------------------------------------------------------
760 dnl Determines the file extension for shared libraries
761 dnl ---------------------------------------------------------------------------
762 AC_DEFUN([MH_SHLPST],
764 AC_MSG_CHECKING(shared library/external function extensions)
767 AC_REQUIRE([AC_CANONICAL_SYSTEM])
801 AC_MSG_RESULT($SHLPST/$MODPST)
804 dnl ---------------------------------------------------------------------------
805 dnl Sets SHLPST and MODPST
806 dnl ---------------------------------------------------------------------------
807 AC_DEFUN([MH_SET_SHLPST],
813 dnl ---------------------------------------------------------------------------
814 dnl Determine how to build shared libraries etc..
815 dnl ---------------------------------------------------------------------------
816 AC_DEFUN([MH_SHARED_LIBRARY],
818 AC_REQUIRE([MH_SET_SHLPST])
820 dnl If compiler is gcc, then flags should be the same for all platforms
821 dnl (just guessing on this)
832 OBJECTS='$('OFILES')'
837 AC_REQUIRE([AC_CANONICAL_SYSTEM])
840 SYS_DEFS="-D_HPUX_SOURCE +e" # Extended ANSI mode for c89
841 AC_DEFINE(SELECT_IN_TIME_H)
844 if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then
845 SYS_DEFS="-D_HPUX_SOURCE"
847 SYS_DEFS="-D_HPUX_SOURCE +e" # Extended ANSI mode for c89
850 *ibm-aix3*|*ibm-aix4.1*)
851 SYS_DEFS="-D_ALL_SOURCE -DAIX"
854 SYS_DEFS="-D_ALL_SOURCE -DAIX"
858 if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then
859 SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE"
861 SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE -Olimit 800"
865 SYS_DEFS="-DSUNOS -DSUNOS_STRTOD_BUG"
886 DYN_COMP="-fno-common"
891 dnl set variables for compiling if we don't already have it
893 if test "$DYN_COMP" = ""; then
894 AC_MSG_CHECKING(compiler flags for a dynamic object)
896 cat > conftest.$ac_ext <<EOF
897 dnl [#]line __oline__ "[$]0"
898 [#]line __oline__ "configure"
904 save_cflags="$CFLAGS"
905 mh_cv_flags="-fPIC -KPIC +Z"
906 for a in $mh_cv_flags; do
909 mh_compile='${CC-cc} -c $CFLAGS conftest.$ac_ext > conftest.tmp 2>&1'
910 if AC_TRY_EVAL(mh_compile); then
914 mh_dyncomp="`egrep -c $slash$a conftest.tmp`"
915 if test "$mh_dyncomp" = "0"; then
916 DYN_COMP="$a -DDYNAMIC"
924 if test "$DYN_COMP" = ""; then
925 AC_MSG_RESULT(none of $mh_cv_flags supported)
927 CFLAGS="$save_cflags"
932 dnl set variables for linking
942 # If the build OS can handle version numbers in the shared library name,
943 # then set SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
944 SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
946 # OTHER_INSTALLS is set to install a non-version numbered shared library
947 # by default; ie. no .\$(ABI) suffix. If the regina executable is not built,
948 # then there is no shared library. Set OTHER_INSTALLS="installabilib" if you
949 # are building a version numbered shared library.
950 OTHER_INSTALLS="installlib"
951 BASE_INSTALL="installbase"
952 BASE_BINARY="binarybase"
959 if test "$ac_cv_prog_CC" = "gcc"; then
960 LD_RXLIB_A1="${CC} -fPIC -shared ${LDFLAGS} -o \$(@)"
961 LD_RXLIB_A2="${CC} -fPIC -shared ${LDFLAGS} -o \$(@)"
962 LD_RXLIB_UTILA="${CC} -fPIC -shared ${LDFLAGS} -o \$(@)"
963 LD_RXLIB_B1="-L. -l${SHLFILE}"
964 LD_RXLIB_B2="-L. -l${SHLFILE}"
965 LD_RXLIB_UTILB="-L. -l${SHLFILE}"
966 SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -fPIC -shared ${LDFLAGS} \$(SHOFILES)"
969 LD_RXLIB_A1="ld -b -q -n -o \$(@)"
970 LD_RXLIB_A2="ld -b -q -n -o \$(@)"
971 LD_RXLIB_UTILA="ld -b -q -n -o \$(@)"
975 DYNAMIC_LDFLAGS="-Wl,+s"
976 SHL_LD="ld -b -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
980 STATIC_LDFLAGS="-bnso -bI:/lib/syscalls.exp"
981 LD_RXLIB_A1="ld -bnoentry -bM:SRE -bT:512 -bH:512 -bI:regina.exp -o \$(@)"
982 LD_RXLIB_A2="ld -bnoentry -bM:SRE -bT:512 -bH:512 -bI:regina.exp -o \$(@)"
983 LD_RXLIB_UTILA="ld -bnoentry -bM:SRE -bT:512 -bH:512 -bI:regina.exp -o \$(@)"
984 LD_RXLIB_B1="${SHLPRE}${SHLFILE}${SHLPST} -lc"
985 LD_RXLIB_B2="${SHLPRE}${SHLFILE}${SHLPST} -lc"
986 LD_RXLIB_UTILB="${SHLPRE}${SHLFILE}${SHLPST} -lc"
988 TEST1EXPORTS="-bE:test1.exp"
989 TEST2EXPORTS="-bE:test2.exp"
992 REGINAEXP="regina.exp"
993 REGUTILEXP="regutil.exp"
994 if test "$ac_cv_header_dlfcn_h" = "yes" -o "$HAVE_DLFCN_H" = "1"; then
997 SHL_LD="ld -o ${SHLPRE}${SHLFILE}${SHLPST} -bnoentry -bE:regina.exp -bM:SRE -bT:512 -bH:512 "'$('SHOFILES')'" -lc"
999 SHL_LD=" "'$('LIBEXE')'" "'$('LIBFLAGS')'" "'$('SHOFILES')'
1004 # STATIC_LDFLAGS="-bnso -bI:/lib/syscalls.exp"
1006 if test "$ac_cv_prog_CC" = "gcc"; then
1007 LD_RXLIB_A1="${CC} -shared ${LDFLAGS} -o \$(@)"
1008 LD_RXLIB_A2="${CC} -shared ${LDFLAGS} -o \$(@)"
1009 LD_RXLIB_UTILA="${CC} -shared ${LDFLAGS} -o \$(@)"
1010 LD_RXLIB_B1="-L. -l${SHLFILE}"
1011 LD_RXLIB_B2="-L. -l${SHLFILE}"
1012 LD_RXLIB_UTILB="-L. -l${SHLFILE}"
1014 LD_RXLIB_A1="ld -bnoentry -bM:SRE ${LDFLAGS} -o \$(@)"
1015 LD_RXLIB_A2="ld -bnoentry -bM:SRE ${LDFLAGS} -o \$(@)"
1016 LD_RXLIB_UTILA="ld -bnoentry -bM:SRE ${LDFLAGS} -o \$(@)"
1017 LD_RXLIB_B1="${SHLPRE}${SHLFILE}${SHLPST} -lc"
1018 LD_RXLIB_B2="${SHLPRE}${SHLFILE}${SHLPST} -lc"
1019 LD_RXLIB_UTILB="${SHLPRE}${SHLFILE}${SHLPST} -lc"
1020 TEST1EXPORTS="-bE:test1.exp"
1021 TEST2EXPORTS="-bE:test2.exp"
1022 TEST1EXP="test1.exp"
1023 TEST2EXP="test2.exp"
1024 REGUTILEXPORTS="-bE:regutil.exp"
1025 REGUTILEXP="regutil.exp"
1027 REGINAEXP="regina.exp"
1028 if test "$ac_cv_header_dlfcn_h" = "yes" -o "$HAVE_DLFCN_H" = "1"; then
1030 DYN_COMP="-DDYNAMIC"
1031 if test "$ac_cv_prog_CC" = "gcc"; then
1032 SHL_LD="${CC} -shared -o ${SHLPRE}${SHLFILE}${SHLPST} -Wl,-bnoentry -Wl,-bE:regina.exp -Wl,-bM:SRE ${LDFLAGS} \$(SHOFILES) -lc \$(SHLIBS) \$(MH_MT_LIBS)"
1034 SHL_LD="ld -o ${SHLPRE}${SHLFILE}${SHLPST} -bnoentry -bE:regina.exp -bM:SRE ${LDFLAGS} \$(SHOFILES) -lc \$(SHLIBS) \$(MH_MT_LIBS)"
1037 SHL_LD=" "'$('LIBEXE')'" "'$('LIBFLAGS')'" "'$('SHOFILES')'
1042 LD_RXLIB_A1="ld -shared -o \$(@)"
1043 LD_RXLIB_A2="ld -shared -o \$(@)"
1044 LD_RXLIB_UTILA="ld -shared -o \$(@)"
1045 LD_RXLIB_B1="-lc -L. -l${SHLFILE}"
1046 LD_RXLIB_B2="-lc -L. -l${SHLFILE}"
1047 LD_RXLIB_UTILB="-lc -L. -l${SHLFILE}"
1049 SHL_LD="ld -o ${SHLPRE}${SHLFILE}${SHLPST} -shared -no_archive "'$('SHOFILES')'" -lc"
1052 LD_RXLIB_A1="ld -G -o \$(@)"
1053 LD_RXLIB_A2="ld -G -o \$(@)"
1054 LD_RXLIB_UTILA="ld -G -o \$(@)"
1060 SHL_LD="ld -G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
1063 LD_RXLIB_A1="ld -G -o \$(@)"
1064 LD_RXLIB_A2="ld -G -o \$(@)"
1065 LD_RXLIB_UTILA="ld -G -o \$(@)"
1071 SHL_LD="ld -G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
1074 LD_RXLIB_A1="ld -dy -G -o \$(@)"
1075 LD_RXLIB_A2="ld -dy -G -o \$(@)"
1076 LD_RXLIB_UTILA="ld -dy -G -o \$(@)"
1082 SHL_LD="ld -dy -G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
1085 if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then
1086 LD_RXLIB_A1="$ac_cv_prog_CC -shared ${LDFLAGS} -o \$(@)"
1087 LD_RXLIB_A2="$ac_cv_prog_CC -shared ${LDFLAGS} -o \$(@)"
1088 LD_RXLIB_UTILA="$ac_cv_prog_CC -shared ${LDFLAGS} -o \$(@)"
1089 SHL_LD="$ac_cv_prog_CC -shared ${LDFLAGS} -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
1091 LD_RXLIB_A1="ld -G ${LDFLAGS} -o \$(@)"
1092 LD_RXLIB_A2="ld -G ${LDFLAGS} -o \$(@)"
1093 LD_RXLIB_UTILA="ld -G ${LDFLAGS} -o \$(@)"
1094 SHL_LD="ld -G ${LDFLAGS} -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
1103 LD_RXLIB_A1="ld -o \$(@)"
1104 LD_RXLIB_A2="ld -o \$(@)"
1105 LD_RXLIB_UTILA="ld -o \$(@)"
1110 SHL_LD="ld -assert pure-text -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
1113 LD_RXLIB_A1="ld -Bdynamic -Bshareable ${LDFLAGS} -o \$(@)"
1114 LD_RXLIB_A2="ld -Bdynamic -Bshareable ${LDFLAGS} -o \$(@)"
1115 LD_RXLIB_UTILA="ld -Bdynamic -Bshareable ${LDFLAGS} -o \$(@)"
1116 LD_RXLIB_B1="-lc -L. -l${SHLFILE}"
1117 LD_RXLIB_B2="-lc -L. -l${SHLFILE}"
1118 LD_RXLIB_UTILB="-lc -L. -l${SHLFILE}"
1120 SHL_LD="ld -Bdynamic -Bshareable ${LDFLAGS} -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
1123 LD_RXLIB_A1="${CC} -shared ${LDFLAGS} -o \$(@)"
1124 LD_RXLIB_A2="${CC} -shared ${LDFLAGS} -o \$(@)"
1125 LD_RXLIB_UTILA="${CC} -shared ${LDFLAGS} -o \$(@)"
1126 # LD_RXLIB_B1="-L. -l${SHLFILE}"
1127 # LD_RXLIB_B2="-L. -l${SHLFILE}"
1128 LD_RXLIB_B1="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
1129 LD_RXLIB_B2="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
1130 LD_RXLIB_UTILB="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
1132 SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI) -shared ${LDFLAGS} ${SHL_SCRIPT} \$(SHOFILES) -lc"
1133 SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
1134 OTHER_INSTALLS="installabilib"
1138 LD_RXLIB_A1="${CC} -shared -o \$(@)"
1139 LD_RXLIB_A2="${CC} -shared -o \$(@)"
1140 LD_RXLIB_UTILA="${CC} -shared -o \$(@)"
1141 LD_RXLIB_B1="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
1142 LD_RXLIB_B2="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
1143 LD_RXLIB_UTILB="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
1145 SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI) -shared ${SHL_SCRIPT} -Wl,-soname=${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI_MAJOR) \$(SHOFILES) -lc"
1146 SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
1147 OTHER_INSTALLS="installabilib"
1151 LD_RXLIB_A1="${CC} -shared ${LDFLAGS} -o \$(@)"
1152 LD_RXLIB_A2="${CC} -shared ${LDFLAGS} -o \$(@)"
1153 LD_RXLIB_UTILA="${CC} -shared ${LDFLAGS} -o \$(@)"
1154 LD_RXLIB_B1="-L. -l${SHLFILE} "'$('BOTHLIBS')'
1155 LD_RXLIB_B2="-L. -l${SHLFILE} "'$('BOTHLIBS')'
1156 LD_RXLIB_UTILB="-L. -l${SHLFILE} "'$('BOTHLIBS')'
1158 SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -shared ${LDFLAGS} \$(SHOFILES) "'$('BOTHLIBS')'
1159 SHL_BASE="${LIBPRE}${SHLFILE}${SHLPST}"
1160 BASE_BINARY="atheosbinary"
1163 LD_RXLIB_A1="${CC} -Wl,-shared -nostart -Xlinker -o\$(@)"
1164 LD_RXLIB_A2="${CC} -Wl,-shared -nostart -Xlinker -o\$(@)"
1165 LD_RXLIB_UTILA="${CC} -Wl,-shared -nostart -Xlinker -o\$(@)"
1166 LD_RXLIB_B1="-L. -l${SHLFILE}"
1167 LD_RXLIB_B2="-L. -l${SHLFILE}"
1168 LD_RXLIB_UTILB="-L. -l${SHLFILE}"
1170 SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -Wl,-shared -nostart -Xlinker \$(SHOFILES)"
1171 SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
1173 BASE_INSTALL="beosinstall"
1174 BASE_BINARY="beosbinary"
1178 LD_RXLIB_A1="${CC} -shared -o \$(@)"
1179 LD_RXLIB_A2="${CC} -shared -o \$(@)"
1180 LD_RXLIB_UTILA="${CC} -shared -o \$(@)"
1181 LD_RXLIB_B1="-L. -l${SHLFILE}"
1182 LD_RXLIB_B2="-L. -l${SHLFILE}"
1183 LD_RXLIB_UTILB="-L. -l${SHLFILE}"
1185 SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -shared \$(SHOFILES)"
1186 SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
1189 LD_RXLIB_A1="${CC} -shared -o \$(@)"
1190 LD_RXLIB_A2="${CC} -shared -o \$(@)"
1191 LD_RXLIB_UTILA="${CC} -shared -o \$(@)"
1192 LD_RXLIB_B1="-L. -l${SHLFILE}"
1193 LD_RXLIB_B2="-L. -l${SHLFILE}"
1194 LD_RXLIB_UTILB="-L. -l${SHLFILE}"
1196 SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -shared \$(SHOFILES)"
1197 SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
1207 # set BUNDLE to unique junk names to stop the Makefile
1208 # getting duplicate targets
1212 EEXTRA="-mf -N0x20000 -Q"
1218 LD_RXLIB_A1="dllwrap --target i386-cygwin32 --def ${srcdir}/test1_w32_dll.def --dllname rxtest1.dll -o \$(@)"
1219 LD_RXLIB_A2="dllwrap --target i386-cygwin32 --def ${srcdir}/test2_w32_dll.def --dllname rxtest2.dll -o \$(@)"
1220 LD_RXLIB_UTILA="dllwrap --target i386-cygwin32 --def ${srcdir}/regutil/regutil.def --dllname regutil.dll -o \$(@)"
1221 LD_RXLIB_B1="-L. -lregina"
1222 LD_RXLIB_B2="-L. -lregina"
1223 LD_RXLIB_UTILB="-L. -lregina"
1225 SHL_LD="dllwrap --def ${srcdir}/regina_w32_dll.def --output-lib libregina.a --target i386-cygwin32 --dllname regina.dll -o regina.dll \$(SHOFILES)"
1230 SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
1234 TEST1EXP="${srcdir}/test1_w32_dll.def"
1235 TEST2EXP="${srcdir}/test2_w32_dll.def"
1236 REGINAEXP="${srcdir}/regina_w32_dll.def"
1237 REGUTILEXP="${srcdir}/regutil/regutil.def"
1238 BASE_INSTALL="cygwininstall"
1242 # to test on platform other than real Mac OSX use: --build=ppc-apple-darwin10.1 --target=ppc-apple-darwin10.1
1244 # Link switches for building "bundles"
1246 # MH LD_RXLIB_A1="${CC} -bundle -flat_namespace -undefined suppress -o \$(@)"
1247 # MH LD_RXLIB_A2="${CC} -bundle -flat_namespace -undefined suppress -o \$(@)"
1248 EEXTRA="$valid_arch_flags"
1249 LD_RXLIB_A1="${CC} ${EEXTRA} -dynamiclib ${LDFLAGS} -o \$(@)"
1250 LD_RXLIB_A2="${CC} ${EEXTRA} -dynamiclib ${LDFLAGS} -o \$(@)"
1251 LD_RXLIB_UTILA="${CC} ${EEXTRA} -dynamiclib ${LDFLAGS} -o \$(@)"
1252 LD_RXLIB_B1="-L. -l${SHLFILE} -lc \$(SHLIBS)"
1253 LD_RXLIB_B2="-L. -l${SHLFILE} -lc \$(SHLIBS)"
1254 LD_RXLIB_UTILB="-L. -l${SHLFILE} -lc \$(SHLIBS)"
1255 DYN_COMP="-DDYNAMIC -fno-common"
1259 SHL_LD="${CC} ${EEXTRA} -dynamiclib ${LDFLAGS} -install_name ${SHLPRE}${SHLFILE}${SHLPST} -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
1260 SHL_BASE="${LIBPRE}${SHLFILE}${SHLPST}"
1261 # MH EXTRATARGET="libregina$BUNDLE"
1262 OTHER_INSTALLS="installlib"
1265 MH_HOWTO_SHARED_LIBRARY()
1270 LIBFLAGS="cr ${LIBPRE}${LIBFILE}${LIBPST}"
1271 LIBLINK="-L. -l${LIBFILE}"
1272 LINKSHL="-L. -l${SHLFILE}"
1277 # For HPUX, we must link the "regina" executable with -lregina
1278 # otherwise you can't move the shared library anywhere other
1279 # than where it was built. Fix by PJM
1281 LINKREG="${LINKSHL}"
1285 # For CygWin, we must link with the import library
1286 # not the actual DLL
1288 LINKREG="${LINKSHL}"
1292 # SkyOS requires linking with -L. -lregina format
1294 LINKREG="${LINKSHL}"
1297 LINKSHL="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
1298 LINKREG="${LINKSHL}"
1301 LINKREG="${SHLPRE}${SHLFILE}${SHLPST}"
1305 if test "$SHL_LD" != ""; then
1306 SHL_LD="$SHL_LD \$(BOTHLIBS) \$(MH_MT_LIBS)"
1309 AC_MSG_CHECKING(if dynamic loading of external functions is supported)
1310 if test "$HAVE_DLFCN_H" = "1" -o "$ac_cv_header_dl_h" = "yes" -o "$ac_cv_header_dlfcn_h" = "yes" -o "$AIX_DYN" = "yes" -o "$BEOS_DYN" = "yes"; then
1311 SHL_TARGETS="${SHL_BASE} regina${binarybitprefix}${EXEEXT} ${SHLPRE}regutil${MODPST} ${SHLPRE}rxtest1${MODPST} ${SHLPRE}rxtest2${MODPST} $EXTRATARGET"
1312 EXECISER_DEP="${SHL_BASE}"
1313 OTHER_INSTALLS="regina${binarybitprefix}${EXEEXT} $OTHER_INSTALLS"
1314 AC_MSG_RESULT("yes")
1317 EXECISER_DEP="${STATICLIB}"
1322 if test "$AIX_DYN" = "yes"; then
1326 STATICLIB="${LIBPRE}${LIBFILE}${LIBPST}"
1330 AC_SUBST(BASE_BINARY)
1331 AC_SUBST(BASE_INSTALL)
1335 AC_SUBST(DYNAMIC_LDFLAGS)
1338 AC_SUBST(EXECISER_DEP)
1340 AC_SUBST(LD_RXLIB_A1)
1341 AC_SUBST(LD_RXLIB_A2)
1342 AC_SUBST(LD_RXLIB_UTILA)
1343 AC_SUBST(LD_RXLIB_B1)
1344 AC_SUBST(LD_RXLIB_B2)
1345 AC_SUBST(LD_RXLIB_UTILB)
1361 AC_SUBST(OTHER_INSTALLS)
1369 AC_SUBST(SHL_TARGETS)
1371 AC_SUBST(STATIC_LDFLAGS)
1373 AC_SUBST(TEST1EXPORTS)
1375 AC_SUBST(TEST2EXPORTS)
1376 AC_SUBST(REGUTILEXP)
1377 AC_SUBST(REGUTILEXPORTS)
1379 AC_SUBST(RANLIB_DYNAMIC)
1382 dnl ---------------------------------------------------------------------------
1383 dnl Determine how to build shared libraries etc..
1384 dnl ---------------------------------------------------------------------------
1385 AC_DEFUN([MH_STATIC_LOADING],
1398 OBJECTS='$('OFILES')'
1402 DYN_COMP="-DDYNAMIC"
1405 dnl set variables for linking
1417 # OTHER_INSTALLS is set to install a non-version numbered shared library
1418 # by default; ie. no .\$(ABI) suffix. If the regina executable is not built,
1419 # then there is no shared library. Set OTHER_INSTALLS="installabilib" if you
1420 # are building a version numbered shared library.
1421 OTHER_INSTALLS="installlib"
1422 BASE_INSTALL="installbase"
1423 BASE_BINARY="binarybase"
1427 AC_REQUIRE([AC_CANONICAL_SYSTEM])
1430 SYS_DEFS="-D_HPUX_SOURCE"
1431 AC_DEFINE(SELECT_IN_TIME_H)
1434 SYS_DEFS="-D_HPUX_SOURCE"
1437 SYS_DEFS="-D_ALL_SOURCE -DAIX"
1438 # STATIC_LDFLAGS="-bnso -bI:/lib/syscalls.exp"
1441 if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then
1442 SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE"
1444 SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE -Olimit 800"
1448 SYS_DEFS="-DSUNOS -DSUNOS_STRTOD_BUG"
1451 BASE_BINARY="atheosbinary"
1454 BASE_INSTALL="beosinstall"
1455 BASE_BINARY="beosbinary"
1464 # getting duplicate targets
1466 EEXTRA="-mf -N0x20000 -Q"
1474 BASE_INSTALL="cygwininstall"
1475 BASE_BINARY="cygwinbinary"
1479 # to test use: --build=ppc-apple-darwin10.1 --target=ppc-apple-darwin10.1
1481 # Link switches for building "bundles"
1483 OTHER_INSTALLS="installlib installmacosx"
1488 LD_RXLIB_A1="${LIBEXE} cr \$(@)"
1489 LD_RXLIB_A2="${LIBEXE} cr \$(@)"
1490 LD_RXLIB_UTILA="${LIBEXE} cr \$(@)"
1494 SHL_LD="${LIBEXE} cr ${SHLPRE}${SHLFILE}${SHLPST} \$(SHOFILES)"
1496 STATICLIB="${LIBPRE}${LIBFILE}${LIBPST}"
1498 LIBFLAGS="cr ${LIBPRE}${LIBFILE}${LIBPST}"
1499 LIBLINK="-L. -l${LIBFILE}"
1500 LINKSHL="-L. -l${LIBFILE}" # ensure we link to static library for execiser
1501 DYN_COMP="$DYN_COMP -DDYNAMIC_STATIC"
1503 SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
1504 SHL_TARGETS="${SHL_BASE} ${SHLPRE}regutil${MODPST} regina${binarybitprefix}${EXEEXT} ${SHLPRE}rxtest1${MODPST} ${SHLPRE}rxtest2${MODPST} $EXTRATARGET"
1505 EXECISER_DEP="${STATICLIB}"
1506 OTHER_INSTALLS="regina${binarybitprefix}${EXEEXT} $OTHER_INSTALLS"
1507 RANLIB_DYNAMIC="-\$(RANLIB) \$(@)"
1509 dnl Settings for Regina test package
1511 AC_ARG_WITH(testpackage,
1512 [ --with-testpackage enable static linking with Regina test external function packages],
1513 [with_test=$withval],
1514 [with_testpackage=no],
1517 if test "$with_testpackage" = "yes"; then
1518 MH_FUNC_LIBS="$MH_FUNC_LIBS ${SHLPRE}rxtest1${MODPST} ${SHLPRE}rxtest2${MODPST}"
1519 AC_DEFINE(HAVE_TEST_PACKAGE)
1520 EXECISER_DEP="${EXECISER_DEP} ${SHLPRE}rxtest1${MODPST} ${SHLPRE}rxtest2${MODPST}"
1523 dnl Settings for Patrick McPhee's Regutil (now included with Regina)
1525 AC_ARG_WITH(regutil,
1526 [ --with-regutil enable static linking with RegUtil external function package],
1527 [with_regutil=$withval],
1530 if test "$with_regutil" = "yes" -o "x$1" = "xregutil"; then
1531 MH_FUNC_LIBS="$MH_FUNC_LIBS ${SHLPRE}regutil${MODPST}"
1532 AC_DEFINE(HAVE_REXXUTIL_PACKAGE)
1535 dnl Settings for Rexx/Curses
1537 AC_ARG_WITH(rexxcurses,
1538 [ --with-rexxcurses enable static linking with Rexx/Curses external function package],
1539 [with_rexxcurses=$withval],
1540 [with_rexxcurses=no],
1542 if test "$with_rexxcurses" = "yes"; then
1543 AC_CHECK_PROG(rxcurses_config, [rxcurses-config], yes, no)
1544 if test "$ac_cv_prog_rxcurses_config" = yes; then
1545 EXTRA_LIB=`rxcurses-config --libs`
1546 MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
1547 AC_DEFINE(HAVE_REXXCURSES_PACKAGE)
1549 AC_MSG_ERROR(rxcurses-config not found. Cannot use --with-rexxcurses switch)
1553 dnl Settings for Rexx/Tk
1556 [ --with-rexxtk enable static linking with Rexx/Tk external function package],
1557 [with_rexxtk=$withval],
1560 if test "$with_rexxtk" = "yes"; then
1561 AC_CHECK_PROG(rexxtk_config, [rexxtk-config], yes, no)
1562 if test "$ac_cv_prog_rexxtk_config" = yes; then
1563 EXTRA_LIB=`rexxtk-config --libs`
1564 MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
1565 AC_DEFINE(HAVE_REXXTK_PACKAGE)
1567 AC_MSG_ERROR(rexxtk-config not found. Cannot use --with-rexxtk switch)
1571 dnl Settings for Rexx/Gd
1574 [ --with-rexxgd enable static linking with Rexx/Gd external function package],
1575 [with_rexxgd=$withval],
1578 if test "$with_rexxgd" = "yes"; then
1579 AC_CHECK_PROG(rexxgd_config, [rexxgd-config], yes, no)
1580 if test "$ac_cv_prog_rexxgd_config" = yes; then
1581 EXTRA_LIB=`rexxgd-config --libs`
1582 MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
1583 AC_DEFINE(HAVE_REXXGD_PACKAGE)
1585 AC_MSG_ERROR(rexxgd-config not found. Cannot use --with-rexxgd switch)
1589 dnl Settings for Rexx/CURL
1591 AC_ARG_WITH(rexxcurl,
1592 [ --with-rexxcurl enable static linking with Rexx/CURL external function package],
1593 [with_rexxcurl=$withval],
1596 if test "$with_rexxcurl" = "yes"; then
1597 AC_CHECK_PROG(rexxcurl_config, [rexxcurl-config], yes, no)
1598 if test "$ac_cv_prog_rexxcurl_config" = yes; then
1599 EXTRA_LIB=`rexxcurl-config --libs`
1600 MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
1601 AC_DEFINE(HAVE_REXXCURL_PACKAGE)
1603 AC_MSG_ERROR(rexxcurl-config not found. Cannot use --with-rexxcurl switch)
1607 dnl Settings for Rexx/SQL
1609 AC_ARG_WITH(rexxsql,
1610 [ --with-rexxsql enable static linking with Rexx/SQL external function package],
1611 [with_rexxsql=$withval],
1614 if test "$with_rexxsql" = "yes"; then
1615 AC_CHECK_PROG(rexxsql_config, [rexxsql-config], yes, no)
1616 if test "$ac_cv_prog_rexxsql_config" = yes; then
1617 EXTRA_LIB=`rexxsql-config --libs`
1618 MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
1619 AC_DEFINE(HAVE_REXXSQL_PACKAGE)
1621 AC_MSG_ERROR(rexxsql-config not found. Cannot use --with-rexxsql switch)
1625 dnl Settings for Rexx/EEC
1627 AC_ARG_WITH(rexxeec,
1628 [ --with-rexxeec enable static linking with Rexx/EEC external function package],
1629 [with_rexxeec=$withval],
1632 if test "$with_rexxeec" = "yes"; then
1633 AC_CHECK_PROG(rexxeec_config, [rexxeec-config], yes, no)
1634 if test "$ac_cv_prog_rexxeec_config" = yes; then
1635 EXTRA_LIB=`rexxeec-config --libs`
1636 MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
1637 AC_DEFINE(HAVE_REXXEEC_PACKAGE)
1639 AC_MSG_ERROR(rexxeec-config not found. Cannot use --with-rexxeec switch)
1643 dnl Settings for Rexx/ISAM
1645 AC_ARG_WITH(rexxisam,
1646 [ --with-rexxisam enable static linking with Rexx/ISAM external function package],
1647 [with_rexxisam=$withval],
1650 if test "$with_rexxisam" = "yes"; then
1651 AC_CHECK_PROG(rexxisam_config, [rexxisam-config], yes, no)
1652 if test "$ac_cv_prog_rexxisam_config" = yes; then
1653 EXTRA_LIB=`rexxisam-config --libs`
1654 MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
1655 AC_DEFINE(HAVE_REXXISAM_PACKAGE)
1657 AC_MSG_ERROR(rexxisam-config not found. Cannot use --with-rexxisam switch)
1661 dnl Settings for RxSock
1664 [ --with-rxsock enable static linking with RxSock external function package],
1665 [with_rxsock=$withval],
1668 if test "$with_rxsock" = "yes"; then
1669 AC_CHECK_PROG(rxsock_config, [rxsock-config], yes, no)
1670 if test "$ac_cv_prog_rxsock_config" = yes; then
1671 EXTRA_LIB=`rxsock-config --libs`
1672 MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
1673 AC_DEFINE(HAVE_RXSOCK_PACKAGE)
1675 AC_MSG_ERROR(rxsock-config not found. Cannot use --with-rxsock switch)
1679 dnl Settings for Rexx/DW
1682 [ --with-rexxdw enable static linking with Rexx/DW external function package],
1683 [with_rexxdw=$withval],
1686 if test "$with_rexxdw" = "yes"; then
1687 AC_CHECK_PROG(rexxdw_config, [rexxdw-config], yes, no)
1688 if test "$ac_cv_prog_rexxdw_config" = yes; then
1689 EXTRA_LIB=`rexxdw-config --libs`
1690 MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
1691 AC_DEFINE(HAVE_REXXDW_PACKAGE)
1693 AC_MSG_ERROR(rexxdw-config not found. Cannot use --with-rexxdw switch)
1697 LINKREG="${SHLPRE}${SHLFILE}${SHLPST} ${MH_FUNC_LIBS} ${SHLPRE}${SHLFILE}${SHLPST}"
1699 AC_SUBST(MH_FUNC_LIBS)
1700 AC_SUBST(BASE_BINARY)
1701 AC_SUBST(BASE_INSTALL)
1705 AC_SUBST(DYNAMIC_LDFLAGS)
1708 AC_SUBST(EXECISER_DEP)
1710 AC_SUBST(LD_RXLIB_A1)
1711 AC_SUBST(LD_RXLIB_A2)
1712 AC_SUBST(LD_RXLIB_UTILA)
1713 AC_SUBST(LD_RXLIB_B1)
1714 AC_SUBST(LD_RXLIB_B2)
1715 AC_SUBST(LD_RXLIB_UTILB)
1729 AC_SUBST(OTHER_INSTALLS)
1737 AC_SUBST(SHL_TARGETS)
1739 AC_SUBST(STATIC_LDFLAGS)
1741 AC_SUBST(TEST1EXPORTS)
1743 AC_SUBST(TEST2EXPORTS)
1744 AC_SUBST(REGUTILEXP)
1745 AC_SUBST(REGUTILEXPORTS)
1747 AC_SUBST(RANLIB_DYNAMIC)
1751 dnl ---------------------------------------------------------------------------
1752 dnl Determines where rpm build files are located
1753 dnl ---------------------------------------------------------------------------
1754 AC_DEFUN([MH_CHECK_RPM],
1756 AC_CHECK_PROG(mh_rpm_exists, rpm, yes, no )
1757 if test "$mh_rpm_exists" = yes; then
1758 AC_MSG_CHECKING(where rpms are built)
1759 RPMTOPDIR=`rpm --eval "%{_topdir}"`
1760 AC_MSG_RESULT($RPMTOPDIR)
1765 dnl ---------------------------------------------------------------------------
1766 dnl Determines whether compiler supports long long
1767 dnl ---------------------------------------------------------------------------
1768 AC_DEFUN([MH_C_LONG_LONG],
1769 [AC_CACHE_CHECK(for long long int, mh_cv_c_long_long,
1770 [if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then
1771 mh_cv_c_long_long=yes
1773 AC_TRY_COMPILE(,[long long int i;],
1774 mh_cv_c_long_long=yes,
1775 mh_cv_c_long_long=no)
1777 if test $mh_cv_c_long_long = yes; then
1778 AC_DEFINE(HAVE_LONG_LONG, 1, [compiler understands long long])
1782 dnl ---------------------------------------------------------------------------
1783 dnl Determines if socklen_t is valid
1784 dnl ---------------------------------------------------------------------------
1785 AC_DEFUN([MH_CHECK_TYPE_SOCKLEN_T],
1786 [AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
1789 [#include <sys/types.h>
1790 #include <sys/socket.h>],
1791 [socklen_t len = 42; return 0;],
1792 ac_cv_type_socklen_t=yes,
1793 ac_cv_type_socklen_t=no)
1795 if test $ac_cv_type_socklen_t = yes; then
1796 AC_DEFINE(HAVE_SOCKLEN_T, 1, [compiler has socklen_t])
1800 dnl ---------------------------------------------------------------------------
1801 dnl Determines which -arch flags valid on Mac OSX with gcc
1802 dnl ---------------------------------------------------------------------------
1803 AC_DEFUN([MH_CHECK_OSX_ARCH],
1804 [AC_MSG_CHECKING(for which Mac OSX -arch flags are supported)
1807 arch_flags="ppc ppc64 x86_64 i386"
1808 for a in $arch_flags; do
1809 save_ldflags="$LDFLAGS"
1810 LDFLAGS="$LDFLAGS -arch $a"
1812 [AC_LANG_PROGRAM([#include <stdio.h>],
1814 [valid_arch_flags="$valid_arch_flags -arch $a";found_arch_flags="$found_arch_flags $a"],
1817 LDFLAGS="$save_ldflags"
1819 AC_MSG_RESULT($found_arch_flags)
1820 AC_SUBST(valid_arch_flags)
1823 dnl ---------------------------------------------------------------------------
1824 dnl Determines is struct statvfs contains f_mntfromname member
1825 dnl ---------------------------------------------------------------------------
1826 AC_DEFUN([MH_CHECK_F_MNTFROMNAME],
1827 [AC_CHECKING(if statvfs.f_mntfromname exists)
1829 #include <sys/types.h>
1830 #include <sys/statvfs.h>
1833 char *p = buf.f_mntfromname;
1837 AC_DEFINE(HAVE_STATVFS_F_MNTFROMNAME,, Define if you have statvfs.f_mntfromname)