1AC_INIT(native/sqlite_jni.c) 2AC_DISABLE_STATIC 3AM_PROG_LIBTOOL 4AC_PROG_INSTALL 5CC=${CC:-cc} 6AC_SUBST(CC) 7HOSTCC=${HOSTCC:-cc} 8AC_SUBST(HOSTCC) 9AC_SUBST(CFLAGS) 10AC_SUBST(HOST_CFLAGS) 11AC_CANONICAL_TARGET 12 13########## 14# Handle the --prefix option 15# 16if test "${prefix}" = "NONE" ; then 17 prefix=/usr/local 18fi 19if test "${exec_prefix}" = "NONE" ; then 20 exec_prefix=$prefix 21fi 22eval libdir="$libdir" 23 24########## 25# Where to place the .jar file(s) 26# 27AC_ARG_WITH(jardir, [ --with-jardir=DIR where to place .jar files], 28 JAR_DIR=$withval) 29if test "x$JAR_DIR" = "x" ; then 30 JAR_DIR_UNSPEC=yes 31 JAR_DIR=$prefix/share/java 32fi 33 34########## 35# Find SQLite header file and library 36# 37AC_ARG_WITH(sqlite, [ --with-sqlite=DIR use SQLite header/lib from DIR], 38 SQLITE_DIR=$withval) 39if test ! -n "$SQLITE_DIR" -a -d "$SQLITE_DIR" ; then 40 AC_MSG_WARN([SQLite2 directory $SQLITE_DIR does not exist]) 41fi 42 43SQLITE_INC="" 44SQLITE_LIB="" 45HAVE_SQLITE2=0 46 47if test "$with_sqlite" != "no" ; then 48 if test -z "$SQLITE_DIR" ; then 49 SQLITE_DIR="../sqlite /usr /usr/local /opt" 50 fi 51 AC_MSG_CHECKING([for SQLite header and library]) 52 SQLITE_INC=UNKNOWN 53 SQLITE_LIB=UNKNOWN 54 for i in $SQLITE_DIR ; do 55 if test -r $i/sqlite.h ; then 56 if test -r $i/libsqlite.la ; then 57 SQLITE_INC="-I$i" 58 SQLITE_LIB="$i/libsqlite.la" 59 SQLITE_LIBDIR="-L$i" 60 break 61 elif test -r $i/libsqlite.a ; then 62 SQLITE_INC="-I$i" 63 SQLITE_LIB="$i/libsqlite.a" 64 SQLITE_LIBDIR="-L$i" 65 break 66 fi 67 elif test -r $i/include/sqlite.h ; then 68 for lib in lib64 lib ; do 69 if test -r $i/$lib/libsqlite.la ; then 70 SQLITE_INC="-I$i/include" 71 SQLITE_LIB="$i/$lib/libsqlite.la" 72 SQLITE_LIBDIR="-L$i/$lib" 73 break 74 elif test -r $i/$lib/libsqlite.a ; then 75 SQLITE_INC="-I$i/include" 76 SQLITE_LIB="$i/$lib/libsqlite.a" 77 SQLITE_LIBDIR="-L$i/$lib" 78 break 79 elif test -r $i/$lib/libsqlite.so ; then 80 SQLITE_INC="-I$i/include" 81 SQLITE_LIB="-lsqlite" 82 SQLITE_LIBDIR="-L$i/$lib" 83 break 84 fi 85 done 86 if test "$SQLITE_LIB" != "UNKNOWN" ; then 87 break 88 fi 89 fi 90 done 91 if test "$SQLITE_LIB" = "UNKNOWN" ; then 92 lib=`pkg-config sqlite --libs 2>/dev/null` 93 if test -n "$lib" ; then 94 SQLITE_INC=`pkg-config sqlite --cflags-only-I` 95 SQLITE_LIB="$lib" 96 SQLITE_LIBDIR=`pkg-config sqlite --libs-only-L` 97 fi 98 fi 99 if test "$SQLITE_INC" = "UNKNOWN" -o "$SQLITE_LIB" = "UNKNOWN" ; then 100 AC_MSG_RESULT(no) 101 AC_MSG_WARN(SQLite2 header files and/or library not found) 102 SQLITE_INC="" 103 SQLITE_LIB="" 104 HAVE_SQLITE2=0 105 else 106 HAVE_SQLITE2=1 107 AC_MSG_RESULT(yes) 108 fi 109fi 110AC_SUBST(SQLITE_INC) 111AC_SUBST(SQLITE_LIB) 112AC_SUBST(HAVE_SQLITE2) 113 114########## 115# Check SQLite features 116# 117HAVE_SQLITE_FUNCTION_TYPE=0 118HAVE_SQLITE_OPEN_AUX_FILE=0 119HAVE_SQLITE_SET_AUTHORIZER=0 120HAVE_SQLITE_TRACE=0 121HAVE_SQLITE_COMPILE=0 122HAVE_SQLITE_PROGRESS_HANDLER=0 123if test "$HAVE_SQLITE2" = 1 ; then 124 saved_CFLAGS=$CFLAGS 125 CFLAGS="$CFLAGS $SQLITE_INC" 126 saved_LIBS=$LIBS 127 LIBS="$LIBS $SQLITE_LIBDIR" 128 AC_CHECK_LIB(sqlite,sqlite_function_type, 129 HAVE_SQLITE_FUNCTION_TYPE=1,HAVE_SQLITE_FUNCTION_TYPE=0) 130 AC_CHECK_LIB(sqlite,sqlite_open_aux_file, 131 HAVE_SQLITE_OPEN_AUX_FILE=1,HAVE_SQLITE_OPEN_AUX_FILE=0) 132 AC_CHECK_LIB(sqlite,sqlite_set_authorizer, 133 HAVE_SQLITE_SET_AUTHORIZER=1,HAVE_SQLITE_SET_AUTHORIZER=0) 134 AC_CHECK_LIB(sqlite,sqlite_trace, 135 HAVE_SQLITE_TRACE=1,HAVE_SQLITE_TRACE=0) 136 AC_CHECK_LIB(sqlite,sqlite_compile, 137 HAVE_SQLITE_COMPILE=1,HAVE_SQLITE_COMPILE=0) 138 AC_CHECK_LIB(sqlite,sqlite_progress_handler, 139 HAVE_SQLITE_PROGRESS_HANDLER=1,HAVE_SQLITE_PROGRESS_HANDLER=0) 140 LIBS=$saved_LIBS 141 CFLAGS=$saved_CFLAGS 142fi 143AC_SUBST(HAVE_SQLITE_FUNCTION_TYPE) 144AC_SUBST(HAVE_SQLITE_OPEN_AUX_FILE) 145AC_SUBST(HAVE_SQLITE_SET_AUTHORIZER) 146AC_SUBST(HAVE_SQLITE_TRACE) 147AC_SUBST(HAVE_SQLITE_COMPILE) 148AC_SUBST(HAVE_SQLITE_PROGRESS_HANDLER) 149 150########## 151# Find SQLite3 header file and library 152# 153AC_ARG_WITH(sqlite3, 154 [ --with-sqlite3=DIR use SQLite3 header/lib from DIR], 155 SQLITE3_DIR=$withval) 156if test ! -n "$SQLITE3_DIR" -a -d "$SQLITE3_DIR" ; then 157 AC_MSG_WARN([SQLite3 directory $SQLITE3_DIR does not exist]) 158fi 159 160if test -z "$SQLITE3_DIR" ; then 161 SQLITE3_DIR="../sqlite /usr /usr/local /opt" 162fi 163 164AC_MSG_CHECKING([for SQLite3 header and library]) 165SQLITE3_INC=UNKNOWN 166SQLITE3_LIB=UNKNOWN 167for i in $SQLITE3_DIR ; do 168 if test -r $i/sqlite3.h ; then 169 if test -r $i/sqlite3.c ; then 170 SQLITE3_INC="-I$i" 171 SQLITE3_LIB="unknown" 172 SQLITE3_LIBDIR="" 173 SQLITE3_A10N_C="$i/sqlite3.c" 174 SQLITE3_A10N_O="sqlite3.lo" 175 break 176 elif test -r $i/libsqlite3.la ; then 177 SQLITE3_INC="-I$i" 178 SQLITE3_LIB="$i/libsqlite3.la" 179 SQLITE3_LIBDIR="-L$i" 180 break 181 elif test -r $i/libsqlite3.a ; then 182 SQLITE3_INC="-I$i" 183 SQLITE3_LIB="$i/libsqlite3.a" 184 SQLITE3_LIBDIR="-L$i" 185 break 186 elif test -r $i/see-sqlite3.c ; then 187 SQLITE3_INC="-I$i" 188 SQLITE3_LIB="unknown" 189 SQLITE3_LIBDIR="" 190 SQLITE3_A10N_C="$i/see-sqlite3.c" 191 SQLITE3_A10N_O="see-sqlite3.lo" 192 SQLITE3_IS_BUILD_WITH_SEE="yes" 193 HAVE_SQLITE3_KEY=1 194 break 195 fi 196 elif test -r $i/include/sqlite3.h ; then 197 for lib in lib64 lib ; do 198 if test -r $i/$lib/libsqlite3.la ; then 199 SQLITE3_INC="-I$i/include" 200 SQLITE3_LIB="$i/$lib/libsqlite3.la" 201 SQLITE3_LIBDIR="-L$i/$lib" 202 break 203 elif test -r $i/$lib/libsqlite3.a ; then 204 SQLITE3_INC="-I$i/include" 205 SQLITE3_LIB="$i/$lib/libsqlite3.a" 206 SQLITE3_LIBDIR="-L$i/$lib" 207 break 208 elif test -r $i/$lib/libsqlite3.so ; then 209 SQLITE3_INC="-I$i/include" 210 SQLITE3_LIB="-lsqlite3" 211 SQLITE3_LIBDIR="-L$i/$lib" 212 break 213 fi 214 done 215 if test "$SQLITE3_LIB" != "UNKNOWN" ; then 216 break 217 fi 218 fi 219done 220if test "$SQLITE3_LIB" = "UNKNOWN" ; then 221 lib=`pkg-config sqlite3 --libs 2>/dev/null` 222 if test -n "$lib" ; then 223 SQLITE3_INC=`pkg-config sqlite3 --cflags-only-I` 224 SQLITE3_LIB="$lib" 225 SQLITE3_LIBDIR=`pkg-config sqlite3 --libs-only-L` 226 fi 227fi 228if test "$SQLITE3_INC" = "UNKNOWN" -o "$SQLITE3_LIB" = "UNKNOWN" ; then 229 AC_MSG_RESULT(no) 230 AC_MSG_WARN(SQLite3 header files and/or library not found) 231 SQLITE3_INC="" 232 SQLITE3_LIB="" 233 HAVE_SQLITE3=0 234elif test -n "$SQLITE3_A10N_C" ; then 235 SQLITE3_LIB="" 236 SQLITE3_A10N_FLAGS="$SQLITE3_A10N_FLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1" 237 SQLITE3_A10N_FLAGS="$SQLITE3_A10N_FLAGS -DSQLITE_DLL=1" 238 HAVE_SQLITE3=1 239 if test "$SQLITE3_IS_BUILT_WITH_SEE" = "yes" ; then 240 SQLITE3_A10N_FLAGS="$SQLITE3_A10N_FLAGS -DSQLITE_HAS_CODEC=1" 241 AC_MSG_RESULT([yes, using SEE]) 242 else 243 AC_MSG_RESULT(yes) 244 fi 245else 246 HAVE_SQLITE3=1 247 AC_MSG_RESULT(yes) 248fi 249AC_SUBST(SQLITE3_INC) 250AC_SUBST(SQLITE3_LIB) 251AC_SUBST(HAVE_SQLITE3) 252 253########## 254# Check SQLite3 features 255# 256AC_ARG_ENABLE(load-extension, 257 [ --enable-load-extension support for loading SQLite 3.x extensions. 258 ***** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***** 259 *** Note that the --enable-load-extension option makes it *** 260 *** possible for library users to load arbitrary native code *** 261 *** into the JVM bypassing its security manager checks, and *** 262 *** thus should be enabled only if you know what you're doing. *** 263 *******************************************************************]) 264test "x$enable_load_extension" = "xyes" || enable_load_extension=no 265HAVE_SQLITE3_MALLOC=0 266HAVE_SQLITE3_PREPARE_V2=0 267HAVE_SQLITE3_PREPARE16_V2=0 268HAVE_SQLITE3_BIND_ZEROBLOB=0 269HAVE_SQLITE3_CLEAR_BINDINGS=0 270HAVE_SQLITE3_COLUMN_TABLE_NAME16=0 271HAVE_SQLITE3_COLUMN_DATABASE_NAME16=0 272HAVE_SQLITE3_COLUMN_ORIGIN_NAME16=0 273HAVE_SQLITE3_BIND_PARAMETER_COUNT=0 274HAVE_SQLITE3_BIND_PARAMETER_NAME=0 275HAVE_SQLITE3_BIND_PARAMETER_INDEX=0 276HAVE_SQLITE3_RESULT_ZEROBLOB=0 277HAVE_SQLITE3_INCRBLOBIO=0 278HAVE_SQLITE3_KEY=0 279HAVE_SQLITE3_SHARED_CACHE=0 280HAVE_SQLITE3_OPEN_V2=0 281HAVE_SQLITE3_LOAD_EXTENSION=0 282HAVE_SQLITE3_BACKUPAPI=0 283HAVE_SQLITE3_PROFILE=0 284HAVE_SQLITE3_STATUS=0 285HAVE_SQLITE3_DB_STATUS=0 286HAVE_SQLITE3_STMT_STATUS=0 287if test "$HAVE_SQLITE3" = 1 -a -n "$SQLITE3_A10N_C" ; then 288 HAVE_SQLITE3_MALLOC=1 289 HAVE_SQLITE3_PREPARE_V2=1 290 HAVE_SQLITE3_PREPARE16_V2=1 291 HAVE_SQLITE3_BIND_ZEROBLOB=1 292 HAVE_SQLITE3_CLEAR_BINDINGS=1 293 HAVE_SQLITE3_COLUMN_TABLE_NAME16=1 294 HAVE_SQLITE3_COLUMN_DATABASE_NAME16=1 295 HAVE_SQLITE3_COLUMN_ORIGIN_NAME16=1 296 HAVE_SQLITE3_BIND_PARAMETER_COUNT=1 297 HAVE_SQLITE3_BIND_PARAMETER_NAME=1 298 HAVE_SQLITE3_BIND_PARAMETER_INDEX=1 299 HAVE_SQLITE3_RESULT_ZEROBLOB=1 300 HAVE_SQLITE3_INCRBLOBIO=1 301 HAVE_SQLITE3_SHARED_CACHE=1 302 HAVE_SQLITE3_OPEN_V2=1 303 if test "$enable_load_extension" = "yes" ; then 304 HAVE_SQLITE3_LOAD_EXTENSION=1 305 fi 306 HAVE_SQLITE3_BACKUPAPI=1 307 HAVE_SQLITE3_PROFILE=1 308 HAVE_SQLITE3_STATUS=1 309 HAVE_SQLITE3_DB_STATUS=1 310 HAVE_SQLITE3_STMT_STATUS=1 311fi 312if test "$HAVE_SQLITE3" = 1 -a -z "$SQLITE3_A10N_C" ; then 313 saved_CFLAGS=$CFLAGS 314 CFLAGS="$CFLAGS $SQLITE3_INC" 315 saved_LIBS=$LIBS 316 LIBS="$LIBS $SQLITE3_LIBDIR" 317 AC_CHECK_LIB(sqlite3,sqlite3_malloc, 318 HAVE_SQLITE3_MALLOC=1,HAVE_SQLITE3_MALLOC=0) 319 AC_CHECK_LIB(sqlite3,sqlite3_prepare_v2, 320 HAVE_SQLITE3_PREPARE_V2=1,HAVE_SQLITE3_PREPARE_V2=0) 321 AC_CHECK_LIB(sqlite3,sqlite3_prepare16_v2, 322 HAVE_SQLITE3_PREPARE16_V2=1,HAVE_SQLITE3_PREPARE16_V2=0) 323 AC_CHECK_LIB(sqlite3,sqlite3_bind_zeroblob, 324 HAVE_SQLITE3_BIND_ZEROBLOB=1,HAVE_SQLITE3_BIND_ZEROBLOB=0) 325 AC_CHECK_LIB(sqlite3,sqlite3_clear_bindings, 326 HAVE_SQLITE3_CLEAR_BINDINGS=1,HAVE_SQLITE3_CLEAR_BINDINGS=0) 327 AC_CHECK_LIB(sqlite3,sqlite3_column_table_name16, 328 HAVE_SQLITE3_COLUMN_TABLE_NAME16=1, 329 HAVE_SQLITE3_COLUMN_TABLE_NAME16=0) 330 AC_CHECK_LIB(sqlite3,sqlite3_column_database_name16, 331 HAVE_SQLITE3_COLUMN_DATABASE_NAME16=1, 332 HAVE_SQLITE3_COLUMN_DATABASE_NAME16=0) 333 AC_CHECK_LIB(sqlite3,sqlite3_column_origin_name16, 334 HAVE_SQLITE3_COLUMN_ORIGIN_NAME16=1, 335 HAVE_SQLITE3_COLUMN_ORIGIN_NAME16=0) 336 AC_CHECK_LIB(sqlite3,sqlite3_bind_parameter_count, 337 HAVE_SQLITE3_BIND_PARAMETER_COUNT=1, 338 HAVE_SQLITE3_BIND_PARAMETER_COUNT=0) 339 AC_CHECK_LIB(sqlite3,sqlite3_bind_parameter_name, 340 HAVE_SQLITE3_BIND_PARAMETER_NAME=1, 341 HAVE_SQLITE3_BIND_PARAMETER_NAME=0) 342 AC_CHECK_LIB(sqlite3,sqlite3_bind_parameter_index, 343 HAVE_SQLITE3_BIND_PARAMETER_INDEX=1, 344 HAVE_SQLITE3_BIND_PARAMETER_INDEX=0) 345 AC_CHECK_LIB(sqlite3,sqlite3_result_zeroblob, 346 HAVE_SQLITE3_RESULT_ZEROBLOB=1,HAVE_SQLITE3_RESULT_ZEROBLOB=0) 347 AC_CHECK_LIB(sqlite3,sqlite3_blob_open, 348 HAVE_SQLITE3_INCRBLOBIO=1,HAVE_SQLITE3_INCRBLOBIO=0) 349 AC_CHECK_LIB(sqlite3,sqlite3_key, 350 HAVE_SQLITE3_KEY=1,HAVE_SQLITE3_KEY=0) 351 AC_CHECK_LIB(sqlite3,sqlite3_rekey, 352 ,HAVE_SQLITE3_KEY=0) 353 AC_CHECK_LIB(sqlite3,sqlite3_enable_shared_cache, 354 HAVE_SQLITE3_SHARED_CACHE=1,HAVE_SQLITE3_SHARED_CACHE=0) 355 AC_CHECK_LIB(sqlite3,sqlite3_open_v2, 356 HAVE_SQLITE3_OPEN_V2=1,HAVE_SQLITE3_OPEN_V2=0) 357 if test "$enable_load_extension" = "yes" ; then 358 AC_CHECK_LIB(sqlite3,sqlite3_load_extension, 359 HAVE_SQLITE3_LOAD_EXTENSION=1,HAVE_SQLITE3_LOAD_EXTENSION=0) 360 fi 361 AC_CHECK_LIB(sqlite3,sqlite3_backup_init, 362 HAVE_SQLITE3_BACKUPAPI=1,HAVE_SQLITE3_BACKUPAPI=0) 363 AC_CHECK_LIB(sqlite3,sqlite3_profile, 364 HAVE_SQLITE3_PROFILE=1,HAVE_SQLITE3_PROFILE=0) 365 AC_CHECK_LIB(sqlite3,sqlite3_status, 366 HAVE_SQLITE3_STATUS=1,HAVE_SQLITE3_STATUS=0) 367 AC_CHECK_LIB(sqlite3,sqlite3_db_status, 368 HAVE_SQLITE3_DB_STATUS=1,HAVE_SQLITE3_DB_STATUS=0) 369 AC_CHECK_LIB(sqlite3,sqlite3_stmt_status, 370 HAVE_SQLITE3_STMT_STATUS=1,HAVE_SQLITE3_STMT_STATUS=0) 371 LIBS=$saved_LIBS 372 CFLAGS=$saved_CFLAGS 373fi 374AC_SUBST(HAVE_SQLITE3_MALLOC) 375AC_SUBST(HAVE_SQLITE3_PREPARE_V2) 376AC_SUBST(HAVE_SQLITE3_PREPARE16_V2) 377AC_SUBST(HAVE_SQLITE3_BIND_ZEROBLOB) 378AC_SUBST(HAVE_SQLITE3_CLEAR_BINDINGS) 379AC_SUBST(HAVE_SQLITE3_COLUMN_TABLE_NAME16) 380AC_SUBST(HAVE_SQLITE3_COLUMN_DATABASE_NAME16) 381AC_SUBST(HAVE_SQLITE3_COLUMN_ORIGIN_NAME16) 382AC_SUBST(HAVE_SQLITE3_BIND_PARAMETER_COUNT) 383AC_SUBST(HAVE_SQLITE3_BIND_PARAMETER_NAME) 384AC_SUBST(HAVE_SQLITE3_BIND_PARAMETER_INDEX) 385AC_SUBST(HAVE_SQLITE3_RESULT_ZEROBLOB) 386AC_SUBST(HAVE_SQLITE3_INCRBLOBIO) 387AC_SUBST(HAVE_SQLITE3_KEY) 388AC_SUBST(HAVE_SQLITE3_SHARED_CACHE) 389AC_SUBST(HAVE_SQLITE3_OPEN_V2) 390AC_SUBST(HAVE_SQLITE3_LOAD_EXTENSION) 391AC_SUBST(HAVE_SQLITE3_BACKUPAPI) 392AC_SUBST(HAVE_SQLITE3_PROFILE) 393AC_SUBST(HAVE_SQLITE3_STATUS) 394AC_SUBST(HAVE_SQLITE3_DB_STATUS) 395AC_SUBST(HAVE_SQLITE3_STMT_STATUS) 396 397if test -z "$SQLITE3_A10N_C" ; then 398 SQLITE3_A10N_C="native/dummy.c" 399 SQLITE3_A10N_O="dummy.lo" 400fi 401AC_SUBST(SQLITE3_A10N_C) 402AC_SUBST(SQLITE3_A10N_O) 403AC_SUBST(SQLITE3_A10N_FLAGS) 404 405########## 406# Any usable SQLite found ? 407# 408AC_MSG_CHECKING([for usable SQLite]) 409if test "$HAVE_SQLITE2" != "1" -a "$HAVE_SQLITE3" != "1" ; then 410 AC_MSG_ERROR([No SQLite found, please try --with-sqlite/--with-sqlite3]) 411fi 412AC_MSG_RESULT(yes) 413 414########## 415# Find out if char ptr array can be passed in place of 416# a va_list (needed for sqlite_exec_vprintf() and 417# sqlite_vmprintf()) 418# 419AC_MSG_CHECKING([va_list usage]) 420AC_TRY_RUN([ 421#include <stdarg.h> 422#include <stdio.h> 423 424static int 425vatest(char **x, ...) 426{ 427 va_list ap; 428 char *y; 429 int ret; 430 431 va_start(ap, x); 432 y = va_arg(ap, char *); 433 x = (char **) &x + 1; 434 ret = (y != *x); 435 va_end(ap); 436 return ret; 437} 438 439int 440main(int argc, char **argv) 441{ 442 exit(vatest(NULL, vatest, 0.0, 0, NULL)); 443} 444],[USE_VFUNCS=1],[USE_VFUNCS=0],[USE_VFUNCS=0]) 445 446if test "$USE_VFUNCS" = "1" ; then 447 AC_MSG_RESULT(using sqlite_exec_vprintf/sqlite_vmprintf) 448 VALIST_FLAGS="" 449else 450 AC_MSG_RESULT(NOT using sqlite_exec_vprintf/sqlite_vmprintf) 451 VALIST_FLAGS="-DCANT_PASS_VALIST_AS_CHARPTR=1" 452fi 453AC_SUBST(VALIST_FLAGS) 454 455########## 456# Find JRE/JDK things 457# 458AC_CHECK_PROG([READLINK], [readlink], [readlink], []) 459AC_ARG_WITH(jdk, [ --with-jdk=DIR use Java top directory DIR], 460 JAVA_HOME=$withval) 461if test -z "$JAVA_HOME" ; then 462 JAVA_HOME=`which javac` 463 if test -z "$JAVA_HOME" ; then 464 AC_MSG_ERROR([JAVA_HOME directory not found, please use --with-jdk=DIR]) 465 fi 466 if test -n "$READLINK" ; then 467 while test -L $JAVA_HOME ; do 468 JAVA_HOME=`$READLINK $JAVA_HOME` 469 done 470 fi 471 JAVA_HOME=`dirname $JAVA_HOME` 472 JAVA_HOME=`dirname $JAVA_HOME` 473 if test "x$JAR_DIR_UNSPEC" = "xyes" ; then 474 JAR_DIR=$JAVA_HOME/jre/lib/ext 475 AC_MSG_RESULT([will install sqlite.jar into $JAR_DIR]) 476 fi 477 if test "x$NATIVE_LIB_DIR" = "x" ; then 478 if test "$prefix" = "/usr/local" ; then 479 case "$target_cpu" in 480 [i[3-6]86*]) 481 NATIVE_LIB_DIR=$JAVA_HOME/jre/lib/i386 482 ;; 483 x86_64) 484 if test -d $JAVA_HOME/jre/lib/amd64 ; then 485 NATIVE_LIB_DIR=$JAVA_HOME/jre/lib/amd64 486 else 487 NATIVE_LIB_DIR=$JAVA_HOME/jre/lib/$target_cpu 488 fi 489 ;; 490 *) 491 NATIVE_LIB_DIR=$JAVA_HOME/jre/lib/$target_cpu 492 ;; 493 esac 494 fi 495 AC_MSG_RESULT([will install libsqlite_jni into $NATIVE_LIB_DIR]) 496 fi 497fi 498if test ! -d "$JAVA_HOME" ; then 499 AC_MSG_ERROR([JAVA_HOME directory not found, please use --with-jdk=DIR]) 500fi 501 502if test -n "$JAVA_HOME" ; then 503 if test "x$JAVA_RUN" = "x"; then 504 JAVA_RUN=$JAVA_HOME/bin/java 505 else 506 AC_MSG_WARN([Overriding JAVA command with: $JAVA_RUN]) 507 fi 508 JAVAC=$JAVA_HOME/bin/javac 509 JAVAH="$JAVA_HOME/bin/javah -jni" 510 JAR=$JAVA_HOME/bin/jar 511 JAVADOC=$JAVA_HOME/bin/javadoc 512else 513 if test "x$JAVA_RUN" = "x"; then 514 JAVA_RUN=`which java` 515 else 516 AC_MSG_WARN([Overriding JAVA command with: $JAVA_RUN]) 517 fi 518 JAVAC=`which javac` 519 JAVAH="`which javah` -jni" 520 JAR=`which jar` 521 JAVADOC=`which javadoc` 522 JAVA_HOME=`dirname $JAVAC` 523 JAVA_HOME=`dirname $JAVA_HOME` 524fi 525 526AC_SUBST(JAVAH) 527AC_SUBST(JAVA_RUN) 528AC_SUBST(JAVA_FLAGS) 529AC_SUBST(JAVAC) 530AC_SUBST(JAVAC_FLAGS) 531AC_SUBST(JAR) 532AC_SUBST(JAVADOC) 533 534# Set up the JNI include directory specification 535case $build_os in 536 solaris*) 537 JNIINCLUDE="-I$JAVA_HOME/include -I$JAVA_HOME/include/solaris" 538 ;; 539 linux*) 540 JNIINCLUDE="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux" 541 ;; 542 freebsd*) 543 JNIINCLUDE="-I$JAVA_HOME/include -I$JAVA_HOME/include/freebsd" 544 ;; 545 *) 546 JNIINCLUDE="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/${build_os}" 547 AC_MSG_WARN([setting generic JNI include file directives!]) 548 ;; 549esac 550AC_MSG_RESULT([setting JNI include file directives: $JNIINCLUDE]) 551 552# Figure out JDK version 553if test "x$JDBCVER" = "x" ; then 554 JDBCVER=JDBC2 555 $JAVA_RUN -version 2>&1 | grep 'version "1.1' >/dev/null && JDBCVER=JDBC1 556 $JAVA_RUN -version 2>&1 | grep 'version "1.4' >/dev/null && JDBCVER=JDBC2x 557 $JAVA_RUN -version 2>&1 | grep 'version "1.5' >/dev/null && JDBCVER=JDBC2y 558 $JAVA_RUN -version 2>&1 | grep 'version "1.6' >/dev/null && JDBCVER=JDBC2z 559 $JAVA_RUN -version 2>&1 | grep 'version "1.7' >/dev/null && JDBCVER=JDBC2z1 560 $JAVA_RUN -version 2>&1 | grep 'JSR169' >/dev/null && JDBCVER=JDBC0 561else 562 AC_MSG_WARN([overriding JDBC driver: $JDBCVER]) 563fi 564AC_MSG_RESULT([using JDBC driver from $JDBCVER directory]) 565 566# default to pre 1.7 source 567cp SQLite/JDBCDriver.java16 SQLite/JDBCDriver.java 568cp SQLite/JDBCDataSource.javajsr169 SQLite/JDBCDataSource.java 569 570if test "$JDBCVER" = "JDBC2y" ; then 571 # 1.5 gives one unchecked warning on SQLite/TableResult.java 572 JAVAC="$JAVAC -nowarn" 573fi 574if test "$JDBCVER" = "JDBC2z" ; then 575 # 1.6 gives some unchecked warnings, e.g. on SQLite/TableResult.java 576 JAVAC="$JAVAC -nowarn" 577fi 578if test "$JDBCVER" = "JDBC2z1" ; then 579 # 1.7 gives some unchecked warnings, e.g. on SQLite/TableResult.java 580 JAVAC="$JAVAC -nowarn" 581 cp SQLite/JDBCDriver.java17 SQLite/JDBCDriver.java 582 cp SQLite/JDBCDataSource.java17 SQLite/JDBCDataSource.java 583fi 584 585if test "x$NATIVE_LIB_DIR" = "x" ; then 586 NATIVE_LIB_DIR=$libdir 587fi 588 589AC_SUBST(JNIINCLUDE) 590AC_SUBST(JAR_DIR) 591AC_SUBST(JDBCVER) 592AC_SUBST(NATIVE_LIB_DIR) 593 594AC_OUTPUT(Makefile) 595 596