changeset 1464:969b90b1f2f9

Configuration detects proper header files for database dev libraries
author Adam Chlipala <adam@chlipala.net>
date Sun, 29 May 2011 13:31:53 -0400
parents 607657eb2865
children 2f5fd248588d
files Makefile.in config.h.in configure configure.ac doc/manual.tex src/c/Makefile.in src/config.sig src/config.sml.in src/mysql.sml src/postgres.sml src/sqlite.sml
diffstat 11 files changed, 103 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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@
--- 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 <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
 
--- 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
--- 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
--- 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.
 
--- 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@
--- 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
--- 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
--- 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,
--- 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,
--- 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,