summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-11-18 14:22:04 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2010-11-18 14:22:04 -0500
commitfb86b2e0894c5c51a30dc38cf530e80ce68a710a (patch)
tree21d925508e3cebab2d7dc4092845a7538df70dac
parent15195cea4dff60d3b0d3355a96e99c81dc37a1aa (diff)
Karn Kallio's patch for static mhash linking
-rw-r--r--Makefile.in1
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure68
-rw-r--r--configure.ac28
-rw-r--r--src/c/Makefile.in1
-rw-r--r--src/compiler.sml10
-rw-r--r--src/config.sig1
-rw-r--r--src/config.sml.in1
8 files changed, 71 insertions, 42 deletions
diff --git a/Makefile.in b/Makefile.in
index 8ccf42fc..59e1c71e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -146,6 +146,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MHASH_LIB_DIR = @MHASH_LIB_DIR@
MKDIR_P = @MKDIR_P@
MLLEX = @MLLEX@
MLTON := mlton
diff --git a/config.h.in b/config.h.in
index bc22e6ec..0249849c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -6,9 +6,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-/* Define to 1 if you have the `mhash' library (-lmhash). */
-#undef HAVE_LIBMHASH
-
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
diff --git a/configure b/configure
index 84da9862..6a154a8d 100755
--- a/configure
+++ b/configure
@@ -743,6 +743,7 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+MHASH_LIB_DIR
GCCARGS
SITELISP
INCLUDE
@@ -866,6 +867,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+with_mhash_dir
'
ac_precious_vars='build_alias
host_alias
@@ -1510,6 +1512,7 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-mhash-dir=DIR mhash directory; default = /usr
Some influential environment variables:
CC C compiler command
@@ -5326,13 +5329,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:5329: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:5332: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:5332: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:5335: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:5335: output\"" >&5)
+ (eval echo "\"\$as_me:5338: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -6537,7 +6540,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6540 "configure"' > conftest.$ac_ext
+ echo '#line 6543 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7799,11 +7802,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7802: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7805: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7806: \$? = $ac_status" >&5
+ echo "$as_me:7809: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8138,11 +8141,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8141: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8144: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8145: \$? = $ac_status" >&5
+ echo "$as_me:8148: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8243,11 +8246,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8246: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8249: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8250: \$? = $ac_status" >&5
+ echo "$as_me:8253: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8298,11 +8301,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8301: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8304: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8305: \$? = $ac_status" >&5
+ echo "$as_me:8308: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10682,7 +10685,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10685 "configure"
+#line 10688 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10778,7 +10781,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10781 "configure"
+#line 10784 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11009,6 +11012,17 @@ CC="$lt_save_CC"
ac_config_headers="$ac_config_headers config.h"
+
+# Check whether --with-mhash-dir was given.
+if test "${with_mhash_dir+set}" = set; then :
+ withval=$with_mhash_dir; with_mhash_dir="$withval"
+else
+ with_mhash_dir="/usr"
+fi
+
+
+LIBS_save="$LIBS"
+LIBS="-L${with_mhash_dir}/lib/ -lmhash"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mhash_get_block_size in -lmhash" >&5
$as_echo_n "checking for mhash_get_block_size in -lmhash... " >&6; }
if test "${ac_cv_lib_mhash_mhash_get_block_size+set}" = set; then :
@@ -11046,19 +11060,17 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mhash_mhash_get_block_size" >&5
$as_echo "$ac_cv_lib_mhash_mhash_get_block_size" >&6; }
if test "x$ac_cv_lib_mhash_mhash_get_block_size" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBMHASH 1
-_ACEOF
-
- LIBS="-lmhash $LIBS"
-
+ MHASH_LIB_DIR="${with_mhash_dir}/lib"
else
echo "You must install libmhash."; exit 1
fi
-ac_fn_c_check_header_mongrel "$LINENO" "mhash.h" "ac_cv_header_mhash_h" "$ac_includes_default"
-if test "x$ac_cv_header_mhash_h" = x""yes; then :
+LIBS="${LIBS_save}"
+as_ac_Header=`$as_echo "ac_cv_header_"${with_mhash_dir}/include/mhash.h"" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" ""${with_mhash_dir}/include/mhash.h"" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ CPPFLAGS="${CPPFLAGS} -I${with_mhash_dir}/include"
else
echo "You must install libmhash dev files."; exit 1
fi
@@ -11220,6 +11232,7 @@ fi
+
ac_config_files="$ac_config_files Makefile src/c/Makefile src/config.sml"
@@ -13565,9 +13578,10 @@ fi
cat <<EOF
Ur/Web configuration:
- bin directory: BIN $BIN
- lib directory: LIB $LIB
- include directory: INCLUDE $INCLUDE
- site-lisp directory: SITELISP $SITELISP
- Extra GCC args: GCCARGS $GCCARGS
+ bin directory: BIN $BIN
+ lib directory: LIB $LIB
+ include directory: INCLUDE $INCLUDE
+ site-lisp directory: SITELISP $SITELISP
+ mhash lib directory: MHASH_LIB_DIR $MHASH_LIB_DIR
+ Extra GCC args: GCCARGS $GCCARGS
EOF
diff --git a/configure.ac b/configure.ac
index 9b7c02a9..fbb75892 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,8 +6,20 @@ AC_PROG_LIBTOOL()
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
-AC_CHECK_LIB(mhash, mhash_get_block_size, [], [echo "You must install libmhash."; exit 1])
-AC_CHECK_HEADER([mhash.h], [], [echo "You must install libmhash dev files."; exit 1])
+dnl Setting the search directory for mhash.
+AC_ARG_WITH(mhash-dir, AS_HELP_STRING([--with-mhash-dir=DIR], [mhash directory; default = /usr]),
+ with_mhash_dir="$withval", with_mhash_dir="/usr")
+
+dnl Check for libmhash
+LIBS_save="$LIBS"
+LIBS="-L${with_mhash_dir}/lib/ -lmhash"
+AC_CHECK_LIB(mhash, mhash_get_block_size,
+ [MHASH_LIB_DIR="${with_mhash_dir}/lib"], [echo "You must install libmhash."; exit 1])
+LIBS="${LIBS_save}"
+
+dnl Check for mhash.h
+AC_CHECK_HEADER(["${with_mhash_dir}/include/mhash.h"],
+ [CPPFLAGS="${CPPFLAGS} -I${with_mhash_dir}/include"], [echo "You must install libmhash dev files."; exit 1])
AC_CHECK_PROG(MLTON, mlton, yes, [])
@@ -55,6 +67,7 @@ AC_SUBST(LIB)
AC_SUBST(INCLUDE)
AC_SUBST(SITELISP)
AC_SUBST(GCCARGS)
+AC_SUBST(MHASH_LIB_DIR)
AC_CONFIG_FILES([
Makefile
@@ -67,9 +80,10 @@ AC_OUTPUT()
cat <<EOF
Ur/Web configuration:
- bin directory: BIN $BIN
- lib directory: LIB $LIB
- include directory: INCLUDE $INCLUDE
- site-lisp directory: SITELISP $SITELISP
- Extra GCC args: GCCARGS $GCCARGS
+ bin directory: BIN $BIN
+ lib directory: LIB $LIB
+ include directory: INCLUDE $INCLUDE
+ site-lisp directory: SITELISP $SITELISP
+ mhash lib directory: MHASH_LIB_DIR $MHASH_LIB_DIR
+ Extra GCC args: GCCARGS $GCCARGS
EOF
diff --git a/src/c/Makefile.in b/src/c/Makefile.in
index 59d7b3e4..afbd033e 100644
--- a/src/c/Makefile.in
+++ b/src/c/Makefile.in
@@ -145,6 +145,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MHASH_LIB_DIR = @MHASH_LIB_DIR@
MKDIR_P = @MKDIR_P@
MLLEX = @MLLEX@
MLTON = @MLTON@
diff --git a/src/compiler.sml b/src/compiler.sml
index 038fa0ff..c4e8977f 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -1225,16 +1225,16 @@ fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
let
val proto = Settings.currentProtocol ()
- val lib = if Settings.getStaticLinking () then
- #linkStatic proto ^ " " ^ Config.lib ^ "/../liburweb.a"
- else
- "-L" ^ Config.lib ^ "/.. -lurweb " ^ #linkDynamic proto
+ val (lib, mhash) = if Settings.getStaticLinking () then
+ (#linkStatic proto ^ " " ^ Config.lib ^ "/../liburweb.a", Config.libMhash ^ "/libmhash.a")
+ else
+ ("-L" ^ Config.lib ^ "/.. -lurweb " ^ #linkDynamic proto, "-L" ^ Config.libMhash ^ " -lmhash")
val compile = "gcc " ^ Config.gccArgs ^ " -Wimplicit -Werror -O3 -fno-inline -I " ^ Config.includ
^ " " ^ #compile proto
^ " -c " ^ cname ^ " -o " ^ oname
- val link = "gcc -Werror -O3 -lm -lmhash -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ oname
+ val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ mhash ^ " " ^ oname
^ " -o " ^ ename
val (compile, link) =
diff --git a/src/config.sig b/src/config.sig
index 90fb72e7..0e8a03c5 100644
--- a/src/config.sig
+++ b/src/config.sig
@@ -9,4 +9,5 @@ signature CONFIG = sig
val libJs : string
val gccArgs : string
+ val libMhash : string
end
diff --git a/src/config.sml.in b/src/config.sml.in
index c7d231d5..24ef2ca2 100644
--- a/src/config.sml.in
+++ b/src/config.sml.in
@@ -13,5 +13,6 @@ val libJs = OS.Path.joinDirFile {dir = lib,
file = "js"}
val gccArgs = "@GCCARGS@"
+val libMhash = "@MHASH_LIB_DIR@"
end