Commits

Greg Ward  committed c899be0

configure: check for sqlite3 so we can build without it
(albeit without svn >= 1.7 support)

  • Participants
  • Parent commits 9ced90f

Comments (0)

Files changed (4)

 
 CFLAGS = -Wall -Wextra -Wno-unused-parameter -std=gnu99 -g
+LIBS = @LIBS@
 
 headers = $(wildcard src/*.h)
 sources = $(wildcard src/*.c)
 objects = $(subst .c,.o,$(sources))
 
 vcprompt: $(objects)
-	$(CC) -o $@ $(objects) -l sqlite3
+	$(CC) -o $@ $(objects) $(LIBS)
 
 # build a standalone version of capture_child() library for testing
 src/capture: src/capture.c src/capture.h src/common.c src/common.h
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
+#undef HAVE_SQLITE3_H
+
 /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
    <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
    #define below would cause a syntax error. */

File configure.ac

 AC_PROG_MAKE_SET
 
 # Checks for libraries.
+AC_CHECK_LIB(sqlite3, sqlite3_open)
 
 # Checks for header files.
 AC_CHECK_HEADERS([arpa/inet.h stdlib.h string.h sys/time.h unistd.h])
+AC_CHECK_HEADERS([sqlite3.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_TYPE_MODE_T
  * (at your option) any later version.
  */
 
+#include "../config.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <sqlite3.h>
 #include <unistd.h>
+#if HAVE_SQLITE3_H
+# include <sqlite3.h>
+#endif
+
 #include "common.h"
 #include "svn.h"
 
     return isdir(".svn");
 }
 
+#if HAVE_SQLITE3_H
 static int
 svn_read_sqlite(result_t *result)
 {
         sqlite3_close(conn);
     return ok;
 }
+#else
+static int
+svn_read_sqlite(result_t *result)
+{
+    debug("vcprompt built without sqlite3 (cannot support svn >= 1.7)");
+    return 0;
+}
+#endif
 
 static int
 svn_read_custom(FILE *fp, char line[], int size, int line_num, result_t *result)