summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-05-29 13:31:53 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-05-29 13:31:53 -0400
commitac03a2629057969e5aaf707c3af3123b74617af3 (patch)
tree76290b06cad4c9de9bc458c5ae7372f666d98226
parentc6b4e9ff771cf8e697ea36dd31230c03cacf5442 (diff)
Configuration detects proper header files for database dev libraries
-rw-r--r--Makefile.in3
-rw-r--r--config.h.in6
-rwxr-xr-xconfigure51
-rw-r--r--configure.ac28
-rw-r--r--doc/manual.tex2
-rw-r--r--src/c/Makefile.in3
-rw-r--r--src/config.sig4
-rw-r--r--src/config.sml.in4
-rw-r--r--src/mysql.sml2
-rw-r--r--src/postgres.sml2
-rw-r--r--src/sqlite.sml2
11 files changed, 103 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in
index e464fc8e..3b195936 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -152,6 +152,7 @@ MKDIR_P = @MKDIR_P@
MLLEX = @MLLEX@
MLTON := mlton
MLYACC = @MLYACC@
+MSHEADER = @MSHEADER@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
@@ -169,12 +170,14 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGHEADER = @PGHEADER@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SITELISP := @SITELISP@
+SQHEADER = @SQHEADER@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
diff --git a/config.h.in b/config.h.in
index 0249849c..abb14fee 100644
--- a/config.h.in
+++ b/config.h.in
@@ -9,6 +9,12 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the <mysql/mysql.h> header file. */
+#undef HAVE_MYSQL_MYSQL_H
+
+/* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */
+#undef HAVE_POSTGRESQL_LIBPQ_FE_H
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
diff --git a/configure b/configure
index 43639cb7..91229159 100755
--- a/configure
+++ b/configure
@@ -612,6 +612,9 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+SQHEADER
+MSHEADER
+PGHEADER
GCCARGS
SITELISP
INCLUDE
@@ -12130,6 +12133,51 @@ else
fi
+if test -z $PGHEADER; then
+ for ac_header in postgresql/libpq-fe.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "postgresql/libpq-fe.h" "ac_cv_header_postgresql_libpq_fe_h" "$ac_includes_default"
+if test "x$ac_cv_header_postgresql_libpq_fe_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_POSTGRESQL_LIBPQ_FE_H 1
+_ACEOF
+ PGHEADER=postgresql/libpq-fe.h
+fi
+
+done
+
+fi
+
+if test -z $PGHEADER; then
+ PGHEADER=libpq-fe.h
+fi
+
+if test -z $MSHEADER; then
+ for ac_header in mysql/mysql.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "mysql/mysql.h" "ac_cv_header_mysql_mysql_h" "$ac_includes_default"
+if test "x$ac_cv_header_mysql_mysql_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_MYSQL_MYSQL_H 1
+_ACEOF
+ MSHEADER=mysql/mysql.h
+fi
+
+done
+
+fi
+
+if test -z $MSHEADER; then
+ MSHEADER=mysql.h
+fi
+
+if test -z $SQHEADER; then
+ SQHEADER=sqlite3.h
+fi
+
+
+
+
@@ -14523,4 +14571,7 @@ Ur/Web configuration:
include directory: INCLUDE $INCLUDE
site-lisp directory: SITELISP $SITELISP
Extra GCC args: GCCARGS $GCCARGS
+ Postgres C header: PGHEADER $PGHEADER
+ MySQL C header: MSHEADER $MSHEADER
+ SQLite C header: SQHEADER $SQHEADER
EOF
diff --git a/configure.ac b/configure.ac
index 633692e6..8006a705 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,11 +57,36 @@ AC_ARG_WITH([emacs],
AM_CONDITIONAL(USE_EMACS, test "x$with_emacs" = xyes)
+if test [-z $PGHEADER]; then
+ AC_CHECK_HEADERS([postgresql/libpq-fe.h],
+ [PGHEADER=postgresql/libpq-fe.h])
+fi
+
+if test [-z $PGHEADER]; then
+ PGHEADER=libpq-fe.h
+fi
+
+if test [-z $MSHEADER]; then
+ AC_CHECK_HEADERS([mysql/mysql.h],
+ [MSHEADER=mysql/mysql.h])
+fi
+
+if test [-z $MSHEADER]; then
+ MSHEADER=mysql.h
+fi
+
+if test [-z $SQHEADER]; then
+ SQHEADER=sqlite3.h
+fi
+
AC_SUBST(BIN)
AC_SUBST(LIB)
AC_SUBST(INCLUDE)
AC_SUBST(SITELISP)
AC_SUBST(GCCARGS)
+AC_SUBST(PGHEADER)
+AC_SUBST(MSHEADER)
+AC_SUBST(SQHEADER)
AC_CONFIG_FILES([
Makefile
@@ -79,4 +104,7 @@ Ur/Web configuration:
include directory: INCLUDE $INCLUDE
site-lisp directory: SITELISP $SITELISP
Extra GCC args: GCCARGS $GCCARGS
+ Postgres C header: PGHEADER $PGHEADER
+ MySQL C header: MSHEADER $MSHEADER
+ SQLite C header: SQHEADER $SQHEADER
EOF
diff --git a/doc/manual.tex b/doc/manual.tex
index 0d7ddf0c..07c80b69 100644
--- a/doc/manual.tex
+++ b/doc/manual.tex
@@ -95,7 +95,7 @@ GCCARGS=-fnested-functions ./configure
Some Mac OS X users have reported needing to use this particular GCCARGS value.
-Since the author is still getting a handle on the GNU Autotools that provide the build system, you may need to do some further work to get started, especially in environments with significant differences from Linux (where most testing is done). One OS X user reported needing to run \texttt{./configure} with \texttt{CFLAGS=-I/opt/local/include}, since this directory wound up holding a header file associated with a \texttt{libmhash} package installed via DarwinPorts. Further, to get libpq to link, another user reported setting \texttt{GCCARGS="-I/opt/local/include -L/opt/local/lib/postgresql84"}, after creating a symbolic link with \texttt{ln -s /opt/local/include/postgresql84 /opt/local/include/postgresql}.
+Since the author is still getting a handle on the GNU Autotools that provide the build system, you may need to do some further work to get started, especially in environments with significant differences from Linux (where most testing is done). The variables \texttt{PGHEADER}, \texttt{MSHEADER}, and \texttt{SQHEADER} may be used to set the proper C header files to include for the development libraries of PostgreSQL, MySQL, and SQLite, respectively. To get libpq to link, one OS X user reported setting \texttt{GCCARGS="-I/opt/local/include -L/opt/local/lib/postgresql84"}, after creating a symbolic link with \texttt{ln -s /opt/local/include/postgresql84 /opt/local/include/postgresql}.
The Emacs mode can be set to autoload by adding the following to your \texttt{.emacs} file.
diff --git a/src/c/Makefile.in b/src/c/Makefile.in
index 813b300c..b13b94f9 100644
--- a/src/c/Makefile.in
+++ b/src/c/Makefile.in
@@ -151,6 +151,7 @@ MKDIR_P = @MKDIR_P@
MLLEX = @MLLEX@
MLTON = @MLTON@
MLYACC = @MLYACC@
+MSHEADER = @MSHEADER@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
@@ -168,12 +169,14 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGHEADER = @PGHEADER@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SITELISP = @SITELISP@
+SQHEADER = @SQHEADER@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
diff --git a/src/config.sig b/src/config.sig
index 6afd9910..28479ef0 100644
--- a/src/config.sig
+++ b/src/config.sig
@@ -10,4 +10,8 @@ signature CONFIG = sig
val gccArgs : string
val openssl : string
+
+ val pgheader : string
+ val msheader : string
+ val sqheader : string
end
diff --git a/src/config.sml.in b/src/config.sml.in
index bb76ea73..fa4bd5fa 100644
--- a/src/config.sml.in
+++ b/src/config.sml.in
@@ -15,4 +15,8 @@ val libJs = OS.Path.joinDirFile {dir = lib,
val gccArgs = "@GCCARGS@"
val openssl = "@OPENSSL_LDFLAGS@ @OPENSSL_LIBS@"
+val pgheader = "@PGHEADER@"
+val msheader = "@MSHEADER@"
+val sqheader = "@SQHEADER@"
+
end
diff --git a/src/mysql.sml b/src/mysql.sml
index 6077eb5c..a8a10da7 100644
--- a/src/mysql.sml
+++ b/src/mysql.sml
@@ -1526,7 +1526,7 @@ fun p_cast (s, _) = s
fun p_blank _ = "?"
val () = addDbms {name = "mysql",
- header = "mysql/mysql.h",
+ header = Config.msheader,
link = "-lmysqlclient",
init = init,
p_sql_type = p_sql_type,
diff --git a/src/postgres.sml b/src/postgres.sml
index f713c753..9b64935c 100644
--- a/src/postgres.sml
+++ b/src/postgres.sml
@@ -1026,7 +1026,7 @@ fun p_cast (s, t) = s ^ "::" ^ p_sql_type t
fun p_blank (n, t) = p_cast ("$" ^ Int.toString n, t)
val () = addDbms {name = "postgres",
- header = "postgresql/libpq-fe.h",
+ header = Config.pgheader,
link = "-lpq",
p_sql_type = p_sql_type,
init = init,
diff --git a/src/sqlite.sml b/src/sqlite.sml
index efa6eb12..d6f5ffec 100644
--- a/src/sqlite.sml
+++ b/src/sqlite.sml
@@ -820,7 +820,7 @@ fun p_cast (s, _) = s
fun p_blank _ = "?"
val () = addDbms {name = "sqlite",
- header = "sqlite3.h",
+ header = Config.sqheader,
link = "-lsqlite3",
init = init,
p_sql_type = p_sql_type,