# HG changeset patch # User Adam Chlipala # Date 1306690313 14400 # Node ID 969b90b1f2f92329104c008fce8c07b427ff6247 # Parent 607657eb28650a9322f61c66baf693e55a8d21cf Configuration detects proper header files for database dev libraries diff -r 607657eb2865 -r 969b90b1f2f9 Makefile.in --- a/Makefile.in Sun May 29 12:44:31 2011 -0400 +++ b/Makefile.in Sun May 29 13:31:53 2011 -0400 @@ -152,6 +152,7 @@ MLLEX = @MLLEX@ MLTON := mlton MLYACC = @MLYACC@ +MSHEADER = @MSHEADER@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -169,12 +170,14 @@ 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 -r 607657eb2865 -r 969b90b1f2f9 config.h.in --- a/config.h.in Sun May 29 12:44:31 2011 -0400 +++ b/config.h.in Sun May 29 13:31:53 2011 -0400 @@ -9,6 +9,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the header file. */ +#undef HAVE_MYSQL_MYSQL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_POSTGRESQL_LIBPQ_FE_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H diff -r 607657eb2865 -r 969b90b1f2f9 configure --- a/configure Sun May 29 12:44:31 2011 -0400 +++ b/configure Sun May 29 13:31:53 2011 -0400 @@ -612,6 +612,9 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +SQHEADER +MSHEADER +PGHEADER GCCARGS SITELISP INCLUDE @@ -12130,6 +12133,51 @@ 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 @@ 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 -r 607657eb2865 -r 969b90b1f2f9 configure.ac --- a/configure.ac Sun May 29 12:44:31 2011 -0400 +++ b/configure.ac Sun May 29 13:31:53 2011 -0400 @@ -57,11 +57,36 @@ 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 @@ 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 -r 607657eb2865 -r 969b90b1f2f9 doc/manual.tex --- a/doc/manual.tex Sun May 29 12:44:31 2011 -0400 +++ b/doc/manual.tex Sun May 29 13:31:53 2011 -0400 @@ -95,7 +95,7 @@ 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 -r 607657eb2865 -r 969b90b1f2f9 src/c/Makefile.in --- a/src/c/Makefile.in Sun May 29 12:44:31 2011 -0400 +++ b/src/c/Makefile.in Sun May 29 13:31:53 2011 -0400 @@ -151,6 +151,7 @@ MLLEX = @MLLEX@ MLTON = @MLTON@ MLYACC = @MLYACC@ +MSHEADER = @MSHEADER@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -168,12 +169,14 @@ 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 -r 607657eb2865 -r 969b90b1f2f9 src/config.sig --- a/src/config.sig Sun May 29 12:44:31 2011 -0400 +++ b/src/config.sig Sun May 29 13:31:53 2011 -0400 @@ -10,4 +10,8 @@ val gccArgs : string val openssl : string + + val pgheader : string + val msheader : string + val sqheader : string end diff -r 607657eb2865 -r 969b90b1f2f9 src/config.sml.in --- a/src/config.sml.in Sun May 29 12:44:31 2011 -0400 +++ b/src/config.sml.in Sun May 29 13:31:53 2011 -0400 @@ -15,4 +15,8 @@ val gccArgs = "@GCCARGS@" val openssl = "@OPENSSL_LDFLAGS@ @OPENSSL_LIBS@" +val pgheader = "@PGHEADER@" +val msheader = "@MSHEADER@" +val sqheader = "@SQHEADER@" + end diff -r 607657eb2865 -r 969b90b1f2f9 src/mysql.sml --- a/src/mysql.sml Sun May 29 12:44:31 2011 -0400 +++ b/src/mysql.sml Sun May 29 13:31:53 2011 -0400 @@ -1526,7 +1526,7 @@ 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 -r 607657eb2865 -r 969b90b1f2f9 src/postgres.sml --- a/src/postgres.sml Sun May 29 12:44:31 2011 -0400 +++ b/src/postgres.sml Sun May 29 13:31:53 2011 -0400 @@ -1026,7 +1026,7 @@ 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 -r 607657eb2865 -r 969b90b1f2f9 src/sqlite.sml --- a/src/sqlite.sml Sun May 29 12:44:31 2011 -0400 +++ b/src/sqlite.sml Sun May 29 13:31:53 2011 -0400 @@ -820,7 +820,7 @@ fun p_blank _ = "?" val () = addDbms {name = "sqlite", - header = "sqlite3.h", + header = Config.sqheader, link = "-lsqlite3", init = init, p_sql_type = p_sql_type,