@@ -695,6 +695,7 @@ SHELL'
695
695
ac_subst_files=' '
696
696
ac_user_opts='
697
697
enable_option_checking
698
+ enable_openssl
698
699
with_openssl
699
700
with_zlib
700
701
enable_libconfig
@@ -1326,6 +1327,8 @@ Optional Features:
1326
1327
--disable-option-checking ignore unrecognized --enable/--with options
1327
1328
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
1328
1329
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
1330
+ --disable-openssl disables OpenSSL, and don't link against it
1331
+ (this can't read *.pub files, though.)
1329
1332
--enable-libconfig/--disable-libconfig
1330
1333
--enable-extf/--disable-extf
1331
1334
--enable-liblua/--disable-liblua
@@ -4129,6 +4132,60 @@ EXTRA_LIBS=""
4129
4132
# OPENSSL_LIBS to the -l directives required
4130
4133
# OPENSSL_LDFLAGS to the -L or -R flags required
4131
4134
4135
+ # Check whether --enable-openssl was given.
4136
+ if test " ${enable_openssl+set} " = set ; then :
4137
+ enableval=$enable_openssl ;
4138
+ if test " x$enableval " = " xno" ; then
4139
+
4140
+ $as_echo " #define TGL_AVOID_OPENSSL 1" >> confdefs.h
4141
+
4142
+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for gcry_md_open in -lgcrypt" >&5
4143
+ $as_echo_n " checking for gcry_md_open in -lgcrypt... " >&6 ; }
4144
+ if ${ac_cv_lib_gcrypt_gcry_md_open+: } false ; then :
4145
+ $as_echo_n " (cached) " >&6
4146
+ else
4147
+ ac_check_lib_save_LIBS=$LIBS
4148
+ LIBS=" -lgcrypt $LIBS "
4149
+ cat confdefs.h - << _ACEOF >conftest.$ac_ext
4150
+ /* end confdefs.h. */
4151
+
4152
+ /* Override any GCC internal prototype to avoid an error.
4153
+ Use char because int might match the return type of a GCC
4154
+ builtin and then its argument prototype would still apply. */
4155
+ #ifdef __cplusplus
4156
+ extern "C"
4157
+ #endif
4158
+ char gcry_md_open ();
4159
+ int
4160
+ main ()
4161
+ {
4162
+ return gcry_md_open ();
4163
+ ;
4164
+ return 0;
4165
+ }
4166
+ _ACEOF
4167
+ if ac_fn_c_try_link " $LINENO " ; then :
4168
+ ac_cv_lib_gcrypt_gcry_md_open=yes
4169
+ else
4170
+ ac_cv_lib_gcrypt_gcry_md_open=no
4171
+ fi
4172
+ rm -f core conftest.err conftest.$ac_objext \
4173
+ conftest$ac_exeext conftest.$ac_ext
4174
+ LIBS=$ac_check_lib_save_LIBS
4175
+ fi
4176
+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $ac_cv_lib_gcrypt_gcry_md_open " >&5
4177
+ $as_echo " $ac_cv_lib_gcrypt_gcry_md_open " >&6 ; }
4178
+ if test " x$ac_cv_lib_gcrypt_gcry_md_open " = xyes; then :
4179
+ cat >> confdefs.h << _ACEOF
4180
+ #define HAVE_LIBGCRYPT 1
4181
+ _ACEOF
4182
+
4183
+ LIBS=" -lgcrypt $LIBS "
4184
+
4185
+ fi
4186
+
4187
+ else
4188
+ # Don't be annoying, so don't inform the user about --disable-openssl
4132
4189
4133
4190
found=false
4134
4191
@@ -4267,7 +4324,7 @@ else
4267
4324
4268
4325
{ $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
4269
4326
$as_echo " no" >&6 ; }
4270
- as_fn_error $? " No openssl found" " $LINENO " 5
4327
+ as_fn_error $? " No openssl found. " " $LINENO " 5
4271
4328
4272
4329
fi
4273
4330
rm -f core conftest.err conftest.$ac_objext \
@@ -4280,6 +4337,164 @@ rm -f core conftest.err conftest.$ac_objext \
4280
4337
4281
4338
4282
4339
4340
+ fi
4341
+
4342
+ else
4343
+
4344
+
4345
+ found=false
4346
+
4347
+ # Check whether --with-openssl was given.
4348
+ if test " ${with_openssl+set} " = set ; then :
4349
+ withval=$with_openssl ;
4350
+ case " $withval " in
4351
+ " " | y | ye | yes | n | no)
4352
+ as_fn_error $? " Invalid --with-openssl value" " $LINENO " 5
4353
+ ;;
4354
+ * ) ssldirs=" $withval "
4355
+ ;;
4356
+ esac
4357
+
4358
+ else
4359
+
4360
+ # if pkg-config is installed and openssl has installed a .pc file,
4361
+ # then use that information and don't search ssldirs
4362
+ # Extract the first word of "pkg-config", so it can be a program name with args.
4363
+ set dummy pkg-config; ac_word=$2
4364
+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
4365
+ $as_echo_n " checking for $ac_word ... " >&6 ; }
4366
+ if ${ac_cv_path_PKG_CONFIG+: } false ; then :
4367
+ $as_echo_n " (cached) " >&6
4368
+ else
4369
+ case $PKG_CONFIG in
4370
+ [\\ /]* | ? :[\\ /]* )
4371
+ ac_cv_path_PKG_CONFIG=" $PKG_CONFIG " # Let the user override the test with a path.
4372
+ ;;
4373
+ * )
4374
+ as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
4375
+ for as_dir in $PATH
4376
+ do
4377
+ IFS=$as_save_IFS
4378
+ test -z " $as_dir " && as_dir=.
4379
+ for ac_exec_ext in ' ' $ac_executable_extensions ; do
4380
+ if as_fn_executable_p " $as_dir /$ac_word$ac_exec_ext " ; then
4381
+ ac_cv_path_PKG_CONFIG=" $as_dir /$ac_word$ac_exec_ext "
4382
+ $as_echo " $as_me :${as_lineno-$LINENO } : found $as_dir /$ac_word$ac_exec_ext " >&5
4383
+ break 2
4384
+ fi
4385
+ done
4386
+ done
4387
+ IFS=$as_save_IFS
4388
+
4389
+ ;;
4390
+ esac
4391
+ fi
4392
+ PKG_CONFIG=$ac_cv_path_PKG_CONFIG
4393
+ if test -n " $PKG_CONFIG " ; then
4394
+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $PKG_CONFIG " >&5
4395
+ $as_echo " $PKG_CONFIG " >&6 ; }
4396
+ else
4397
+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
4398
+ $as_echo " no" >&6 ; }
4399
+ fi
4400
+
4401
+
4402
+ if test x" $PKG_CONFIG " ! = x" " ; then
4403
+ OPENSSL_LDFLAGS=` $PKG_CONFIG openssl --libs-only-L 2> /dev/null`
4404
+ if test $? = 0; then
4405
+ OPENSSL_LIBS=` $PKG_CONFIG openssl --libs-only-l 2> /dev/null`
4406
+ OPENSSL_INCLUDES=` $PKG_CONFIG openssl --cflags-only-I 2> /dev/null`
4407
+ found=true
4408
+ fi
4409
+ fi
4410
+
4411
+ # no such luck; use some default ssldirs
4412
+ if ! $found ; then
4413
+ ssldirs=" /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
4414
+ fi
4415
+
4416
+
4417
+ fi
4418
+
4419
+
4420
+
4421
+ # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
4422
+ # an 'openssl' subdirectory
4423
+
4424
+ if ! $found ; then
4425
+ OPENSSL_INCLUDES=
4426
+ for ssldir in $ssldirs ; do
4427
+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for openssl/ssl.h in $ssldir " >&5
4428
+ $as_echo_n " checking for openssl/ssl.h in $ssldir ... " >&6 ; }
4429
+ if test -f " $ssldir /include/openssl/ssl.h" ; then
4430
+ OPENSSL_INCLUDES=" -I$ssldir /include"
4431
+ OPENSSL_LDFLAGS=" -L$ssldir /lib"
4432
+ OPENSSL_LIBS=" -lssl -lcrypto"
4433
+ found=true
4434
+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: yes" >&5
4435
+ $as_echo " yes" >&6 ; }
4436
+ break
4437
+ else
4438
+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
4439
+ $as_echo " no" >&6 ; }
4440
+ fi
4441
+ done
4442
+
4443
+ # if the file wasn't found, well, go ahead and try the link anyway -- maybe
4444
+ # it will just work!
4445
+ fi
4446
+
4447
+ # try the preprocessor and linker with our new flags,
4448
+ # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
4449
+
4450
+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking whether compiling and linking against OpenSSL works" >&5
4451
+ $as_echo_n " checking whether compiling and linking against OpenSSL works... " >&6 ; }
4452
+ echo " Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS ;" \
4453
+ " OPENSSL_LIBS=$OPENSSL_LIBS ; OPENSSL_INCLUDES=$OPENSSL_INCLUDES " >&5
4454
+
4455
+ save_LIBS=" $LIBS "
4456
+ save_LDFLAGS=" $LDFLAGS "
4457
+ save_CPPFLAGS=" $CPPFLAGS "
4458
+ LDFLAGS=" $LDFLAGS $OPENSSL_LDFLAGS "
4459
+ LIBS=" $OPENSSL_LIBS $LIBS "
4460
+ CPPFLAGS=" $OPENSSL_INCLUDES $CPPFLAGS "
4461
+ cat confdefs.h - << _ACEOF >conftest.$ac_ext
4462
+ /* end confdefs.h. */
4463
+ #include <openssl/ssl.h>
4464
+ int
4465
+ main ()
4466
+ {
4467
+ SSL_new(NULL)
4468
+ ;
4469
+ return 0;
4470
+ }
4471
+ _ACEOF
4472
+ if ac_fn_c_try_link " $LINENO " ; then :
4473
+
4474
+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: yes" >&5
4475
+ $as_echo " yes" >&6 ; }
4476
+
4477
+
4478
+ else
4479
+
4480
+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
4481
+ $as_echo " no" >&6 ; }
4482
+ as_fn_error $? " No openssl found. With --disable-openssl, libtgl will use libgcrypt instead." " $LINENO " 5
4483
+
4484
+ fi
4485
+ rm -f core conftest.err conftest.$ac_objext \
4486
+ conftest$ac_exeext conftest.$ac_ext
4487
+ CPPFLAGS=" $save_CPPFLAGS "
4488
+ LDFLAGS=" $save_LDFLAGS "
4489
+ LIBS=" $save_LIBS "
4490
+
4491
+
4492
+
4493
+
4494
+
4495
+
4496
+ fi
4497
+
4283
4498
#
4284
4499
# Handle user hints
4285
4500
#
0 commit comments