1 define([AC_CACHE_LOAD], )dnl
2 define([AC_CACHE_SAVE], )dnl
4 AC_CONFIG_HEADER(src/bltConfig.h)
8 # -----------------------------------------------------------------------
10 # Handle command line options
15 # --with-cflags=flags This is probably for me only
18 # -----------------------------------------------------------------------
30 blt_with_cflags="$CFLAGS"
32 blt_with_tcl_includes=""
33 blt_with_tk_includes=""
34 blt_with_tcl_libraries=""
35 blt_with_tk_libraries=""
37 AC_ARG_WITH(tcl, [ --with-tcl=DIR Find tclConfig.sh in DIR],
38 blt_with_tcl=$withval)
39 AC_ARG_WITH(tk, [ --with-tk=DIR Find tkConfig.sh in DIR],
41 AC_ARG_WITH(tclincls, [ --with-tclincls=DIR Find tcl.h in DIR],
42 blt_with_tcl_includes=$withval)
43 AC_ARG_WITH(tkincls, [ --with-tkincls=DIR Find tk.h in DIR],
44 blt_with_tk_includes=$withval)
45 AC_ARG_WITH(tcllibs, [ --with-tcllibs=DIR Find Tcl library in DIR],
46 blt_with_tcl_libraries=$withval)
47 AC_ARG_WITH(tklibs, [ --with-tklibs=DIR Find Tk library in DIR],
48 blt_with_tk_libraries=$withval)
49 AC_ARG_ENABLE(jpeg, [ --enable-jpeg=DIR Find JPEG headers and libraries in DIR], [
50 unset ac_cv_header_jpeglib_h
51 unset ac_cv_lib_jpeg ac_cv_lib_jpeg_jpeg_read_header
52 blt_enable_jpeg=$enableval ])
53 AC_ARG_WITH(cc, [ --with-cc=CC Set C compiler to CC], [
56 unset ac_cv_prog_CPP ])
57 AC_ARG_WITH(cflags, [ --with-cflags=FLAGS Set compiler flags to FLAGS],
58 blt_with_cflags="$with_cflags")
59 AC_ARG_WITH(gnu_ld, [ --with-gnu-ld Use GNU linker],
60 blt_with_gnu_ld="yes")
63 AC_PREFIX_PROGRAM(bltwish)
65 # -----------------------------------------------------------------------
67 # Set a variable containing current working directory if /bin/sh
68 # doesn't do it already.
70 # -----------------------------------------------------------------------
74 # -----------------------------------------------------------------------
76 # C compiler and debugging flags
78 # -----------------------------------------------------------------------
85 # 1. command line (--with-cc)
86 # 2. environment variable ($CC)
87 # 3. cached variable ($blt_cv_prog_cc)
88 # 4. check for program (AC_PROG_CC)
92 AC_MSG_CHECKING([which C compiler])
93 if test "x${blt_with_cc}" != "x" ; then
97 elif test "x${BLT_ENV_CC}" != "x" ; then
100 elif test "x${blt_cv_prog_cc}" != "x" ; then
106 if test "x${CC}" = "x" ; then
112 AC_CACHE_VAL(blt_cv_prog_cc, blt_cv_prog_cc=$CC)
115 if test "x${GCC}" != "x" ; then
118 AC_MSG_CHECKING([if C compiler is really gcc])
119 AC_EGREP_CPP(_cc_is_gcc_, [
123 ], [blt_have_gcc=yes], [blt_have_gcc=no])
124 AC_MSG_RESULT([$blt_have_gcc])
128 # CFLAGS search order
130 # 1. command line (--with-cflags)
131 # 2. cached variable ($blt_cv_prog_cflags)
132 # 3. set to "-O6" if using gcc ($blt_have_gcc)
133 # 4. otherwise, default to "-O"
135 AC_MSG_CHECKING([default compiler flags])
136 if test "x${blt_with_cflags}" != "x" ; then
137 CFLAGS=${blt_with_cflags}
138 elif test "x${blt_cv_prog_cflags}" != "x" ; then
139 CFLAGS=${blt_cv_prog_cflags}
140 elif test "${blt_have_gcc}" = "yes" ; then
146 AC_MSG_RESULT([$CFLAGS])
147 unset blt_cv_prog_cflags
148 AC_CACHE_VAL(blt_cv_prog_cflags, blt_cv_prog_cflags=$CFLAGS)
152 if test "${blt_have_gcc}" = "yes" ; then
154 if test "${CFLAGS}" = "-g" ; then
155 GCCFLAGS="-Wshadow -Winline -Wpointer-arith ${GCCFLAGS}"
161 # -----------------------------------------------------------------------
163 # Programs: Check for existence of ranlib and install programs
165 # -----------------------------------------------------------------------
171 # -----------------------------------------------------------------------
173 # Libraries: Check for libraries used
175 # -----------------------------------------------------------------------
176 AC_CHECK_LIB(socket, main)
177 AC_CHECK_LIB(nsl, main)
178 AC_CHECK_LIB(m, main)
179 # -----------------------------------------------------------------------
181 # Headers: Check for header files used
183 # -----------------------------------------------------------------------
189 AC_CHECK_HEADERS(inttypes.h)
190 if test "${ac_cv_header_inttypes_h}" = "yes" ; then
195 AC_SUBST(HAVE_INTTYPES_H)
197 AC_CHECK_HEADERS(limits.h sys/param.h)
198 AC_CHECK_HEADERS(string.h ctype.h)
199 AC_CHECK_HEADERS(errno.h float.h math.h ieeefp.h)
200 AC_CHECK_HEADERS(sys/time.h waitflags.h sys/wait.h)
201 AC_CHECK_HEADERS(malloc.h memory.h)
202 AC_CHECK_HEADERS(setjmp.h)
204 if test "${blt_enable_jpeg}" != "no" ; then
205 jpeg_save_CPPFLAGS=${CPPFLAGS}
207 if test "${blt_enable_jpeg}" != "yes" ; then
208 CPPFLAGS="-I${blt_enable_jpeg}/include"
210 AC_CHECK_HEADERS(jpeglib.h, [JPEG_INC_SPEC="${CPPFLAGS}"], [JPEG_INC_SPEC=""])
211 CPPFLAGS=${jpeg_save_CPPFLAGS}
214 # Run this check after jpeglib.h because jpeglib.h sets HAVE_STDLIB_H
215 AC_CHECK_HEADERS(stdlib.h unistd.h)
217 # -----------------------------------------------------------------------
219 # Types: Check for existence of types of size_t and pid_t
221 # -----------------------------------------------------------------------
225 AC_MSG_CHECKING([whether union wait is defined correctly])
226 AC_CACHE_VAL(blt_cv_struct_wait_works,
227 AC_TRY_COMPILE([#include <sys/types.h>
228 #include <sys/wait.h>], [
230 * Check whether <sys/wait.h> defines the type "union wait"
231 * correctly. It's needed because of weirdness in HP-UX where
232 * "union wait" is defined in both the BSD and SYS-V environments.
233 * Checking the usability of WIFEXITED seems to do the trick.
236 WIFEXITED(x); /* Generates compiler error if WIFEXITED
239 [blt_cv_struct_wait_works="yes"],
240 [blt_cv_struct_wait_works="no"]))
242 if test "${blt_cv_struct_wait_works}" = "yes"; then
243 AC_DEFINE(HAVE_UNION_WAIT)
245 AC_MSG_RESULT([$blt_cv_struct_wait_works])
247 # -----------------------------------------------------------------------
249 # Compiler characteristics:
250 # Check for existence of types of size_t and pid_t
252 # -----------------------------------------------------------------------
256 AC_CHECK_SIZEOF(long)
257 AC_CHECK_SIZEOF(long long)
258 AC_CHECK_SIZEOF(void *)
260 SIZEOF_LONG="${ac_cv_sizeof_long}"
261 SIZEOF_LONG_LONG="${ac_cv_sizeof_long_long}"
262 SIZEOF_VOID_P="${ac_cv_sizeof_void_p}"
263 SIZEOF_INT="${ac_cv_sizeof_int}"
265 AC_SUBST(SIZEOF_LONG)
266 AC_SUBST(SIZEOF_LONG_LONG)
267 AC_SUBST(SIZEOF_VOID_P)
269 # -----------------------------------------------------------------------
271 # Library Functions: Check for strdup, drand48, and srand48.
273 # -----------------------------------------------------------------------
275 AC_HAVE_FUNCS(strdup strcasecmp strncasecmp drand48 srand48 finite)
277 # For HPUX it's a little more complicated to search for isfinite
278 AC_MSG_CHECKING([for isfinite])
279 AC_CACHE_VAL(blt_cv_have_isfinite,
280 AC_TRY_LINK([#include <math.h>], [
285 ], [blt_cv_have_isfinite="yes"], [blt_cv_have_isfinite="no"]))
287 if test "${blt_cv_have_isfinite}" = "yes"; then
288 AC_DEFINE(HAVE_ISFINITE)
290 AC_MSG_RESULT([$blt_cv_have_isfinite])
292 # -----------------------------------------------------------------------
294 # Check the smallest value such that 1.0 + x != 1.0.
295 # For ANSI compilers this is DBL_EPSILON in float.h
297 #--------------------------------------------------------------------
299 AC_MSG_CHECKING([whether DBL_EPSILON is defined in float.h])
300 AC_CACHE_VAL(blt_cv_found_dbl_epsilon,
309 ], blt_cv_found_dbl_epsilon=yes, blt_cv_found_dbl_epsilon=no)
311 AC_MSG_RESULT([${blt_cv_found_dbl_epsilon}])
313 if test "${blt_cv_found_dbl_epsilon}" = "no" ; then
314 AC_CACHE_VAL(blt_cv_dbl_epsilon,
317 AC_MSG_CHECKING([whether DBL_EPSILON can be computed])
318 AC_TRY_RUN_WITH_OUTPUT(blt_cv_dbl_epsilon, [
322 * Check the smallest value such that 1.0 + x != 1.0.
323 * For ANSI compilers this is DBL_EPSILON in float.h
328 if ((1.0 + u) == 1.0) {
333 printf("%.17e\n", e);
337 AC_DEFINE_UNQUOTED(BLT_DBL_EPSILON, ${blt_cv_dbl_epsilon})
338 AC_MSG_RESULT([${blt_cv_dbl_epsilon}])
343 AC_MSG_CHECKING([whether declaration is needed for strdup])
344 AC_CACHE_VAL(blt_cv_nedd_decl_strdup,
345 AC_EGREP_CPP(strdup, [
354 #endif /* HAVE_UNISTD_H */
355 ], [blt_cv_need_decl_strdup=no], [blt_cv_need_decl_strdup=yes]))
357 if test "${blt_cv_need_decl_strdup}" = "yes"; then
358 AC_DEFINE(NEED_DECL_STRDUP)
360 AC_MSG_RESULT([$blt_cv_need_decl_strdup])
362 AC_MSG_CHECKING([whether declaration is needed for drand48])
363 AC_CACHE_VAL(blt_cv_need_decl_drand48,
364 AC_EGREP_CPP(drand48, [
373 #endif /* HAVE_UNISTD_H */
374 ], [blt_cv_need_decl_drand48=no], [blt_cv_need_decl_drand48=yes]))
376 if test "${blt_cv_need_decl_drand48}" = "yes"; then
377 AC_DEFINE(NEED_DECL_DRAND48)
379 AC_MSG_RESULT([$blt_cv_need_decl_drand48])
381 AC_MSG_CHECKING([whether declaration is needed for srand48])
382 AC_CACHE_VAL(blt_cv_need_decl_srand48,
383 AC_EGREP_CPP(srand48, [
392 #endif /* HAVE_UNISTD_H */
393 ], [blt_cv_need_decl_srand48=no], [blt_cv_need_decl_srand48=yes]))
395 if test "${blt_cv_need_decl_srand48}" = "yes"; then
396 AC_DEFINE(NEED_DECL_SRAND48)
398 AC_MSG_RESULT([$blt_cv_need_decl_srand48])
400 AC_MSG_CHECKING([whether declaration is needed for j1])
401 AC_CACHE_VAL(blt_cv_need_decl_j1,
411 #endif /* HAVE_UNISTD_H */
412 ], [blt_cv_need_decl_j1=no], [blt_cv_need_decl_j1=yes]))
414 if test "${blt_cv_need_decl_j1}" = "yes"; then
415 AC_DEFINE(NEED_DECL_J1)
417 AC_MSG_RESULT([$blt_cv_need_decl_j1])
419 # -----------------------------------------------------------------------
421 # System services: X, Tcl, Tk
423 # -----------------------------------------------------------------------
426 # -----------------------------------------------------------------------
428 # Find the Tcl build configuration file "tclConfig.sh"
430 # -----------------------------------------------------------------------
432 AC_MSG_CHECKING([for tclConfig.sh])
434 if test "x$blt_with_tcl" != "x" ; then
436 # Verify that a tclConfig.sh file exists in the directory specified
442 if test -r "$dir/tclConfig.sh" ; then
443 tcl_config_sh="$dir/tclConfig.sh"
445 elif test -r "$dir/lib/tclConfig.sh" ; then
446 tcl_config_sh="$dir/lib/tclConfig.sh"
448 elif test -r "$dir/unix/tclConfig.sh" ; then
449 tcl_config_sh="$dir/unix/tclConfig.sh"
455 # Otherwise, search for Tcl configuration file.
459 # 1. Search previously named locations.
466 if test -r "$dir/tclConfig.sh" ; then
467 tcl_config_sh="$dir/tclConfig.sh"
469 elif test -r "$dir/lib/tclConfig.sh" ; then
470 tcl_config_sh="$dir/lib/tclConfig.sh"
472 elif test -r "$dir/unix/tclConfig.sh" ; then
473 tcl_config_sh="$dir/unix/tclConfig.sh"
478 # 2. Search source directories.
480 if test "x$tcl_config_sh" = "x" ; then
482 `ls -dr ../tcl[[7-9]].[[0-9]]* 2>/dev/null` \
484 `ls -dr ../../tcl[[7-9]].[[0-9]]* 2>/dev/null` \
486 `ls -dr ../../../tcl[[7-9]].[[0-9]]* 2>/dev/null` \
489 if test -r "$dir/unix/tclConfig.sh" ; then
490 tcl_config_sh="$dir/unix/tclConfig.sh"
496 # 3. Search standard locations.
498 if test "x$tcl_config_sh" = "x" ; then
500 `ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
505 if test -r "$dir/tclConfig.sh" ; then
506 tcl_config_sh="$dir/tclConfig.sh"
508 elif test -r "$dir/lib/tclConfig.sh" ; then
509 tcl_config_sh="$dir/lib/tclConfig.sh"
516 AC_MSG_RESULT([${tcl_config_sh}])
518 if test "x$tcl_config_sh" = "x" ; then
519 echo "can't find Tcl configuration script \"tclConfig.sh\""
523 # -----------------------------------------------------------------------
525 # Find the Tk build configuration file "tkConfig.sh"
527 # -----------------------------------------------------------------------
529 AC_MSG_CHECKING([for tkConfig.sh])
531 if test "x$blt_with_tk" != "x" -o "x$blt_with_tcl" != "x"; then
533 # Verify that a tkConfig.sh file exists in the directory specified
534 # by --with-tcl or --with-tk.
540 if test -r "$dir/tkConfig.sh" ; then
541 tk_config_sh="$dir/tkConfig.sh"
543 elif test -r "$dir/lib/tkConfig.sh" ; then
544 tk_config_sh="$dir/lib/tkConfig.sh"
546 elif test -r "$dir/unix/tkConfig.sh" ; then
547 tk_config_sh="$dir/unix/tkConfig.sh"
553 # Search for Tk configuration file.
557 # 1. Search previously named locations.
565 if test -r "$dir/tkConfig.sh" ; then
566 tk_config_sh="$dir/tkConfig.sh"
568 elif test -r "$dir/lib/tkConfig.sh" ; then
569 tk_config_sh="$dir/lib/tkConfig.sh"
571 elif test -r "$dir/unix/tkConfig.sh" ; then
572 tk_config_sh="$dir/unix/tkConfig.sh"
577 # 2. Search source directories.
579 if test "x$tk_config_sh" = "x" ; then
582 `ls -dr ../tk[[4-9]].[[0-9]]* 2>/dev/null` \
584 `ls -dr ../../tk[[4-9]].[[0-9]]* 2>/dev/null` \
586 `ls -dr ../../../tk[[4-9]].[[0-9]]* 2>/dev/null`
588 if test -r "$dir/unix/tkConfig.sh"; then
589 tk_config_sh="$dir/unix/tkConfig.sh"
595 # 3. Search standard locations.
597 if test "x$tk_config_sh" = "x" ; then
599 `ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
605 if test -r "$dir/tkConfig.sh" ; then
606 tk_config_sh="$dir/tkConfig.sh"
608 elif test -r "$dir/lib/tkConfig.sh" ; then
609 tk_config_sh="$dir/lib/tkConfig.sh"
615 AC_MSG_RESULT([${tk_config_sh}])
617 if test "x$tk_config_sh" = "x" ; then
618 echo "can't find Tk configuration script \"tkConfig.sh\""
622 # -----------------------------------------------------------------------
624 # Source in the Tcl/Tk configuration scripts.
626 # -----------------------------------------------------------------------
634 if test "x${blt_with_tcl_includes}" != "x" ; then
635 if test -r "${blt_with_tcl_includes}/tcl.h" ; then
636 TCL_INC_DIR=${blt_with_tcl_includes}
638 echo "Can't find tcl.h in \"${blt_with_tcl_includes}\""
643 ${TCL_PREFIX}/include/tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION} \
644 ${TCL_PREFIX}/include \
645 ${TCL_SRC_DIR}/generic
647 if test -r "$dir/tcl.h" ; then
652 if test "x${TCL_INC_DIR}" = "x" ; then
653 echo "Can't find tcl.h header file"
658 if test "x${blt_with_tk_includes}" != "x" ; then
659 if test -r "${blt_with_tk_includes}/tk.h" ; then
660 TK_INC_DIR=${blt_with_tk_includes}
662 echo "Can't find tk.h in \"${blt_with_tk_includes}\""
667 ${TK_PREFIX}/include/tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION} \
668 ${TK_PREFIX}/include \
669 ${TK_SRC_DIR}/generic \
672 if test -r "$dir/tk.h" ; then
677 if test "x${TK_INC_DIR}" = "x" ; then
678 echo "Can't find tk.h header file"
684 *-sunos4*|*-*-netbsd|NetBSD-*|FreeBSD-*|OpenBSD-*)
685 TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}"
686 TK_LIB_NAME="tk${TK_MAJOR_VERSION}${TK_MINOR_VERSION}"
689 TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}"
690 TK_LIB_NAME="tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}"
694 TCL_LIB_SPEC="-l${TCL_LIB_NAME}"
695 TK_LIB_SPEC="-l${TK_LIB_NAME}"
706 TCL_LIB_DIR="${TCL_SRC_DIR}/unix"
707 TK_LIB_DIR="${TK_SRC_DIR}/unix"
709 if test "x${blt_with_tcl_libraries}" != "x" ; then
711 "${blt_with_tcl_libraries}/lib${TCL_LIB_NAME}.${SHLIB_SUFFIX}" \
712 "${blt_with_tcl_libraries}/lib${TCL_LIB_NAME}.a"
714 if test -r "$libname" ; then
715 TCL_LIB_DIR="${blt_with_tcl_libraries}"
719 if test "x${TCL_LIB_DIR}" = "x" ; then
720 echo "Can't find tcl library in \"${blt_with_tcl_libraries}\""
725 "${TCL_EXEC_PREFIX}/lib/lib${TCL_LIB_NAME}.${SHLIB_SUFFIX}" \
726 "${TCL_EXEC_PREFIX}/lib/lib${TCL_LIB_NAME}.a"
728 if test -r "$libname" ; then
729 TCL_LIB_DIR="${TCL_EXEC_PREFIX}/lib"
733 if test "x${TCL_LIB_DIR}" = "x" ; then
734 echo "Can't find tcl library"
739 if test "x${blt_with_tk_libraries}" != "x" ; then
741 "${blt_with_tk_libraries}/lib${TK_LIB_NAME}.${SHLIB_SUFFIX}" \
742 "${blt_with_tk_libraries}/lib${TK_LIB_NAME}.a"
744 if test -r "$libname" ; then
745 TK_LIB_DIR="${blt_with_tk_libraries}"
749 if test "x${TK_LIB_DIR}" = "x" ; then
750 echo "Can't find tk library in \"${blt_with_tk_libraries}\""
755 "${TK_EXEC_PREFIX}/lib/lib${TK_LIB_NAME}.${SHLIB_SUFFIX}" \
756 "${TK_EXEC_PREFIX}/lib/lib${TK_LIB_NAME}.a"
758 if test -r "$libname" ; then
759 TK_LIB_DIR="${TK_EXEC_PREFIX}/lib"
763 if test "x${TK_LIB_DIR}" = "x" ; then
764 echo "Can't find tk library"
769 # -----------------------------------------------------------------------
773 # Append to INC_SPECS the various include files specifications
774 # (built fromt the include directory information).
776 # -----------------------------------------------------------------------
779 if test "${blt_enable_jpeg}" != "no" ; then
780 if test "x${JPEG_INC_SPEC}" != "x" ; then
781 INC_SPECS="${INC_SPECS} ${JPEG_INC_SPEC}"
786 if test "x${x_includes}" != "x" -a \
787 "${x_includes}" != "NONE" -a \
788 "${x_includes}" != "/usr/include" -a \
789 "${x_includes}" != "${TK_INC_DIR}" -a \
790 "${x_includes}" != "${TCL_INC_DIR}" ; then
791 INC_SPECS="${INC_SPECS} -I${x_includes}"
795 if test "${TK_INC_DIR}" != "/usr/include" ; then
796 INC_SPECS="${INC_SPECS} -I${TK_INC_DIR}"
801 # Add the include directory specification only if the Tcl
802 # headers reside in a different directory from Tk's.
803 if test "${TCL_INC_DIR}" != "/usr/include" -a \
804 "${TCL_INC_DIR}" != "${TK_INC_DIR}" ; then
805 INC_SPECS="${INC_SPECS} -I${TCL_INC_DIR}"
808 # -----------------------------------------------------------------------
812 # Append to LIB the various library specifications
813 # (built from the library directory information).
815 # -----------------------------------------------------------------------
818 if test "${TK_LIB_DIR}" = "/usr/lib" ; then
819 LIB_SPECS="${LIB_SPECS} ${TK_LIB_SPEC}"
821 LIB_SPECS="${LIB_SPECS} -L${TK_LIB_DIR} ${TK_LIB_SPEC}"
822 if test "x${loader_run_path}" = "x" ; then
823 loader_run_path="${TK_LIB_DIR}"
825 loader_run_path="${TK_LIB_DIR}:${loader_run_path}"
830 if test "${TCL_LIB_DIR}" = "/usr/lib" -o \
831 "${TCL_LIB_DIR}" = "${TK_LIB_DIR}" ; then
832 LIB_SPECS="${LIB_SPECS} ${TCL_LIB_SPEC}"
834 LIB_SPECS="${LIB_SPECS} -L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
835 if test "x${loader_run_path}" = "x" ; then
836 loader_run_path="${TCL_LIB_DIR}"
838 loader_run_path="${TCL_LIB_DIR}:${loader_run_path}"
842 if test "${TCL_LIB_DIR}" = "/usr/lib" ; then
843 TCL_ONLY_LIB_SPECS="${TCL_LIB_SPEC}"
845 TCL_ONLY_LIB_SPECS="-L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
849 # Collect the libraries for AIX that aren't using stubs.
853 if test "x${x_libraries}" = "x" -o \
854 "x${x_libraries}" = "NONE" -o \
855 "${x_libraries}" = "/usr/lib" -o \
856 "${x_libraries}" = "${TK_LIB_DIR}" -o \
857 "${x_libraries}" = "${TCL_LIB_DIR}" ; then
858 LIB_SPECS="${LIB_SPECS} -lX11"
859 aix_lib_specs="${aix_lib_specs} -lX11"
861 LIB_SPECS="${LIB_SPECS} -L${x_libraries} -lX11"
862 aix_lib_specs="${aix_lib_specs} -L${x_libraries} -lX11"
863 if test "x${loader_run_path}" = "x" ; then
864 loader_run_path="${x_libraries}"
866 loader_run_path="${loader_run_path}:${x_libraries}"
871 if test "${blt_enable_jpeg}" != "no" ; then
872 jpeg_save_LDFlags="${LDFLAGS}"
873 JPEG_LIB_SPEC="-ljpeg"
875 if test "${blt_enable_jpeg}" != "yes" ; then
876 JPEG_LIB_DIR="${blt_enable_jpeg}/lib"
877 JPEG_LIB_SPEC="-L${JPEG_LIB_DIR} ${JPEG_LIB_SPEC}"
878 LDFLAGS="-L${JPEG_LIB_DIR} ${LDFLAGS}"
880 AC_CHECK_LIB(jpeg, jpeg_read_header, [found=yes], [found=no], )
881 if test "${found}" = "yes" ; then
882 LIB_SPECS="${LIB_SPECS} ${JPEG_LIB_SPEC}"
883 aix_lib_specs="${aix_lib_specs} ${JPEG_LIB_SPEC}"
884 if test "x${JPEG_LIB_DIR}" != "x" ; then
885 loader_run_path="${loader_run_path}:${JPEG_LIB_DIR}"
888 LDFLAGS=${jpeg_save_LDFlags}
892 LIBS="$LIB_SPECS $LIBS"
893 AC_CHECK_FUNCS(XExtendedMaxRequestSize)
896 # -----------------------------------------------------------------------
898 # Set up a new default prefix to installation path. The ways
899 # the prefix can be set and their precedence are as follows:
901 # 1. --prefix option given to ./configure. (prefix != NONE)
902 # 2. use previously configured Tk prefix
904 # -----------------------------------------------------------------------
906 if test "$prefix" = "NONE" ; then
910 if test "$exec_prefix" = "NONE" ; then
911 exec_prefix=${TCL_EXEC_PREFIX}
914 # -------------------------------------------------------------------------
916 # Extract the BLT version number for the blt.h header
918 # -------------------------------------------------------------------------
919 AC_MSG_CHECKING([BLT_MAJOR_VERSION])
920 AC_CACHE_VAL(blt_cv_major_version,
921 AC_GREP_SYMBOL(blt_cv_major_version, BLT_MAJOR_VERSION, ${srcdir}/src/blt.h)
923 BLT_MAJOR_VERSION=${blt_cv_major_version}
924 AC_MSG_RESULT([$blt_cv_major_version])
926 AC_MSG_CHECKING([BLT_MINOR_VERSION])
927 AC_CACHE_VAL(blt_cv_minor_version,
928 AC_GREP_SYMBOL(blt_cv_minor_version, BLT_MINOR_VERSION, ${srcdir}/src/blt.h)
930 AC_MSG_RESULT([$blt_cv_minor_version])
931 BLT_MINOR_VERSION=${blt_cv_minor_version}
933 BLT_VERSION=${BLT_MAJOR_VERSION}.${BLT_MINOR_VERSION}
935 # Add BLT to the run path
936 libdir=${exec_prefix}/lib
938 if test "x${libdir}" != "x" -a \
939 "${libdir}" != "/usr/lib" -a \
940 "${libdir}" != "${x_libraries}" -a \
941 "${libdir}" != "${TK_LIB_DIR}" -a \
942 "${libdir}" != "${TCL_LIB_DIR}" ; then
943 if test "x${loader_run_path}" = "x" ; then
944 loader_run_path="${libdir}"
946 loader_run_path="${libdir}:${loader_run_path}"
950 aix_lib_specs="${aix_lib_specs} ${LIBS}"
951 LIB_SPECS="${LIB_SPECS} ${LIBS}"
952 TCL_ONLY_LIB_SPECS="${TCL_ONLY_LIB_SPECS} ${LIBS}"
954 # -------------------------------------------------------------------------
956 # Extract the Tcl version number for the tcl.h header
958 # -------------------------------------------------------------------------
959 AC_MSG_CHECKING([TCL_VERSION in tcl.h])
960 AC_CACHE_VAL(blt_cv_tcl_h_version,
961 AC_GREP_SYMBOL(blt_cv_tcl_h_version, [TCL_VERSION], ${TCL_INC_DIR}/tcl.h)
963 eval TCL_H_VERSION=${blt_cv_tcl_h_version}
964 AC_MSG_RESULT([$TCL_H_VERSION])
965 if test "${TCL_H_VERSION}" != "${TCL_VERSION}" ; then
966 echo "Error: Tcl version mismatch. "
967 echo " ${TCL_VERSION} ${tcl_config_sh}"
968 echo " ${TCL_H_VERSION} ${TCL_INC_DIR}/tcl.h"
971 AC_MSG_CHECKING([TK_VERSION in tk.h])
972 AC_CACHE_VAL(blt_cv_tk_h_version,
973 AC_GREP_SYMBOL(blt_cv_tk_h_version, [TK_VERSION], ${TK_INC_DIR}/tk.h)
975 eval TK_H_VERSION=${blt_cv_tk_h_version}
976 AC_MSG_RESULT([$TK_H_VERSION])
977 if test "${TK_H_VERSION}" != "${TK_VERSION}" ; then
978 echo "Error: Tk version mismatch."
979 echo " ${TK_VERSION} ${tk_config_sh}"
980 echo " ${TK_H_VERSION} ${TK_INC_DIR}/tk.h"
984 if test "$TCL_VERSION" = "7.6" -a "$TK_VERSION" = "4.2" ; then
986 elif test "$TCL_VERSION" = "7.5" -a "$TK_VERSION" = "4.1" ; then
988 elif test "$TCL_VERSION" = "$TK_VERSION" ; then
991 echo "Mismatched Tcl/Tk versions ($TCL_VERSION != $TK_VERSION)"
995 #--------------------------------------------------------------------
997 # Check if we can generate shared libraries on this system. Set flags
998 # to generate shared libraries for systems that we know about. Start
999 # with the values found in tclConfig.sh, make changes as we know about
1000 # the different systems.
1002 #--------------------------------------------------------------------
1004 LIB_BASE_NAME=libBLT
1006 # Initialize shared library build variables
1008 SHLIB_CFLAGS="$TCL_SHLIB_CFLAGS"
1009 SHLIB_LD="$TCL_SHLIB_LD"
1010 SHLIB_LD_FLAGS="$TCL_LD_FLAGS"
1011 SHLIB_RUNPATH="$TCL_LD_SEARCH_FLAGS"
1016 SHLIB_LIB_SPECS="${JPEG_LIB_SPEC}"
1017 SHLIB_TCL_ONLY_LIB_SPECS="${TCL_ONLY_LIB_SPECS}"
1018 SHLIB_TCL_ONLY_LIB_SPECS=""
1024 library_name=libBLT${BLT_MAJOR_VERSION}${BLT_MINOR_VERSION}
1028 # No Position-Independent flags needed
1031 # Use the installed export file or the one found in the source directory.
1033 if test -r "${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp" ; then
1034 tcl_exp="${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp"
1036 tcl_exp="${TCL_SRC_DIR}/unix/lib.exp"
1038 if test -r "${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp" ; then
1039 tk_exp="${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp"
1041 tk_exp="${TK_SRC_DIR}/unix/lib.exp"
1044 full_src_path=`cd ${srcdir}; pwd`
1046 # Use shell-script to link shared library
1047 SHLIB_LD="${full_src_path}/cf/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry -bI:${tk_exp} -bI:${tcl_exp}"
1049 SHLIB_LIB_SPECS="${aix_lib_specs} -lc"
1051 LDFLAGS="-L${loader_run_path}"
1052 EXTRA_LIB_SPECS="-ldl"
1056 # No Position-Independent flags needed
1059 # Use the installed export file or the one found in the source directory.
1061 if test -r "${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp" ; then
1062 tcl_exp="${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp"
1064 tcl_exp="${TCL_SRC_DIR}/unix/lib.exp"
1066 if test -r "${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp" ; then
1067 tk_exp="${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp"
1069 tk_exp="${TK_SRC_DIR}/unix/lib.exp"
1072 full_src_path=`cd ${srcdir}/cf; pwd`
1074 # Use shell-script to link shared library
1076 SHLIB_LD="${full_src_path}/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry -bI:${tk_exp} -bI:${tcl_exp}"
1078 SHLIB_LIB_SPECS="${aix_lib_specs} -lc"
1080 LDFLAGS="-L${loader_run_path}"
1081 EXTRA_LIB_SPECS="-lld"
1089 EXTRA_LIB_SPECS="-ldl"
1093 SHLIB_CFLAGS="-export-dynamic -fPIC"
1095 SHLIB_LD_FLAGS='-shared -Wl,-E -Wl,-soname,$@'
1099 SHLIB_CFLAGS="-K PIC"
1103 EXTRA_LIB_SPECS="-ldl"
1107 if test "$blt_have_gcc" = "no" ; then
1108 DEFINES="$DEFINES -D_HPUX_SOURCE"
1110 AC_CHECK_LIB(dld, shl_load, [found=yes], [found=no])
1111 if test "${found}" = "yes" ; then
1114 SHLIB_LD_FLAGS="-b -E -n +s +b,${loader_run_path}:."
1117 # The run path is included in both LDFLAGS and SHLIB_LD_FLAGS
1118 # because SHLIB_LD is ld and LD is cc/gcc.
1120 LDFLAGS="-Wl,-E -Wl,+s,+b,${loader_run_path}:."
1121 EXTRA_LIB_SPECS="-ldld"
1128 SHLIB_LD_FLAGS="-32 -shared -rdata_shared"
1129 LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1132 *-irix-[56].*|*-irix64-*)
1135 SHLIB_LD_FLAGS="-shared -rdata_shared"
1136 LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1138 if test "$blt_have_gcc" = "yes" ; then
1139 SHLIB_CFLAGS="-mabi=n32 $SHLIB_CFLAGS"
1140 SHLIB_LD_FLAGS="-mabi=n32 $SHLIB_LD_FLAGS"
1141 LDFLAGS="-mabi=n32 $LDFLAGS"
1143 CFLAGS="-n32 $CFLAGS"
1144 LDFLAGS="-n32 $LDFLAGS"
1149 SHLIB_CFLAGS="-fPIC"
1151 SHLIB_LD_FLAGS='-rdynamic -shared -Wl,-E -Wl,-soname,$@'
1152 LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1155 EXTRA_LIB_SPECS="-ldl"
1159 SHLIB_CFLAGS="-G -K PIC"
1165 SHLIB_CFLAGS="-G -K PIC"
1167 SHLIB_LD_FLAGS="-Wl,-Bexport"
1171 SHLIB_CFLAGS="-K PIC"
1175 EXTRA_LIB_SPECS="-ldl"
1179 SHLIB_CFLAGS="-K PIC"
1181 SHLIB_LD_FLAGS="-G -Wl,-Bexport"
1183 LDFLAGS="-Wl,-Bexport"
1184 EXTRA_LIB_SPECS="-ldl"
1187 *-netbsd*|*-freebsd*|*-openbsd*)
1188 # Not available on all versions: check for include file.
1189 AC_CHECK_HEADER(dlfcn.h, test_ok=yes, test_ok=no)
1190 if test "$test_ok" = yes; then
1191 SHLIB_CFLAGS="-fpic"
1193 SHLIB_LD_FLAGS="-Bshareable -x"
1200 SHLIB_LD_FLAGS="-nostdlib -r"
1204 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1208 # Warning: Ugly Makefile Hack
1209 # Make package name same as library name
1211 SHLIB_LD='ld -R -export $@:'
1215 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1217 SHLIB_CFLAGS="-fpic"
1218 SHLIB_LD="ld -shared"
1226 SHLIB_LD_FLAGS='-shared -expect_unresolved "*"'
1227 LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1232 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1233 # this test works, since "uname -s" was non-standard in 3.2.4 and
1236 SHLIB_CFLAGS="-Kpic -belf"
1239 LDFLAGS="-belf -Wl,-Bexport"
1244 SHLIB_CFLAGS="-K PIC"
1248 EXTRA_LIB_SPECS="-ldl"
1255 SHLIB_LD_FLAGS="-assert pure-text"
1257 EXTRA_LIB_SPECS="-ldl"
1262 SHLIB_CFLAGS="-KPIC"
1263 if test "${blt_with_gnu_ld}" = "yes" -a "$blt_have_gcc" = "yes" ; then
1265 SHLIB_LD_FLAGS='-rdynamic -shared -Wl,-E -Wl,-soname,$@'
1266 LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1268 SHLIB_LD="/usr/ccs/bin/ld"
1269 SHLIB_LD_FLAGS="-G -z text"
1270 LD_RUN_PATH="-R ${loader_run_path}"
1272 EXTRA_LIB_SPECS="-ldl"
1277 SHLIB_CFLAGS="-KPIC"
1281 EXTRA_LIB_SPECS="-ldl"
1284 *-pc-sysv4* | *-unixware-5*)
1285 SHLIB_CFLAGS="-G -KPIC"
1287 SHLIB_LD_FLAGS=" -Wl,-Bexport"
1296 # If we're running gcc, then set SHLIB_CFLAGS flags for compiling
1297 # shared libraries for gcc, instead of those of the vendor's
1301 if test "$blt_have_gcc" = "yes" ; then
1302 SHLIB_CFLAGS="-fPIC"
1305 # We can't back link against static versions of Tcl/Tk.
1306 # If # ${TCL_SHARED_BUILD} can't be found or isn't "1", assume that
1307 # shared libraies weren't built.
1309 if test "${TCL_SHARED_BUILD}" != "1" ; then
1313 if test "${build_shared}" = "yes" ; then
1314 SHLIB_TARGET="build_shared"
1315 AC_SUBST(SHLIB_CFLAGS)
1316 AC_SUBST(SHLIB_TARGET)
1318 AC_SUBST(SHLIB_LD_FLAGS)
1319 AC_SUBST(SHLIB_LIB_SPECS)
1320 AC_SUBST(SHLIB_TCL_ONLY_LIB_SPECS)
1321 AC_SUBST(SHLIB_SUFFIX)
1325 AC_SUBST(LD_RUN_PATH)
1329 AC_SUBST(TCL_ONLY_LIB_SPECS)
1330 AC_SUBST(EXTRA_LIB_SPECS)
1332 INCLUDES=${INC_SPECS}
1335 AC_SUBST(BLT_MAJOR_VERSION)
1336 AC_SUBST(BLT_MINOR_VERSION)
1337 AC_SUBST(BLT_VERSION)
1339 AC_SUBST(TCL_LIB_DIR)
1340 AC_SUBST(TCL_VERSION)
1342 #--------------------------------------------------------------------
1343 # Propagate prefix argument as installation directory.
1344 #--------------------------------------------------------------------
1346 BLT_LIBRARY="${prefix}/lib/blt${BLT_VERSION}"
1347 AC_SUBST(BLT_LIBRARY)
1349 #--------------------------------------------------------------------
1350 # Print out some of the more important settings
1351 #--------------------------------------------------------------------
1353 echo "Configuration results:"
1355 echo " tcl.h found in $TCL_INC_DIR"
1356 echo " tk.h found in $TK_INC_DIR"
1357 echo " X11/Xlib.h found in $x_includes"
1358 echo " lib${TCL_LIB_NAME} found in $TCL_LIB_DIR"
1359 echo " lib${TK_LIB_NAME} found in $TK_LIB_DIR"
1360 echo " libX11 found in $x_libraries"
1362 echo "Directories where BLT is to be installed:"
1364 echo " \"\$prefix\" is $prefix"
1365 echo " \"\$exec_prefix\" is $exec_prefix"
1367 echo " bltwish to be installed in $bindir"
1368 echo " libBLT.a to be installed in $libdir"
1369 echo " scripts to be installed in $BLT_LIBRARY"
1370 echo " manual pages to be installed in $mandir"
1373 #--------------------------------------------------------------------
1375 # Generate the following Makefiles
1379 # ./src/shared/Makefile
1381 # ./library/Makefile
1384 #--------------------------------------------------------------------
1385 AC_OUTPUT(Makefile src/Makefile src/bltHash.h src/shared/Makefile man/Makefile library/Makefile demos/Makefile)