git.fiddlerwoaroof.com
Browse code

Have autoconf find openssl

Ed Langley authored on 30/05/2017 21:53:55
Showing 3 changed files
... ...
@@ -3,7 +3,7 @@ CRYPTOPP_NAME=cryptopp
3 3
 CXXFLAGS += -fPIC -fno-stack-protector -std=c++11  -g -DCRYPTOPP_NAME=$(CRYPTOPP_NAME)
4 4
 CFLAGS += -fPIC -fno-stack-protector -g
5 5
 #LDFLAGS = -Wl,-Bstatic -l$(CRYPTOPP_NAME) -Wl,-Bdynamic -lpam -Wl,--as-needed
6
-LDFLAGS = -lpam -l$(CRYPTOPP_NAME)
6
+LDFLAGS = -lpam -l$(CRYPTOPP_NAME) @LIBS@
7 7
 
8 8
 INTEGRATION_OBJS = sys_syslog.o sys_fstream.o sys_unistd.o sys_pwd.o sys_pam.o \
9 9
                    sys_stdlib.o sys_time.o
... ...
@@ -49,7 +49,7 @@ distclean: clean
49 49
 -include .depend
50 50
 
51 51
 %_test.out: %_test.o $(OBJS)
52
-	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ -l$(CRYPTOPP_NAME)
52
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^
53 53
 
54 54
 RUN_%: %.out
55 55
 	@echo running $<
... ...
@@ -1386,6 +1386,52 @@ fi
1386 1386
   as_fn_set_status $ac_retval
1387 1387
 
1388 1388
 } # ac_fn_c_try_compile
1389
+
1390
+# ac_fn_c_try_link LINENO
1391
+# -----------------------
1392
+# Try to link conftest.$ac_ext, and return whether this succeeded.
1393
+ac_fn_c_try_link ()
1394
+{
1395
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1396
+  rm -f conftest.$ac_objext conftest$ac_exeext
1397
+  if { { ac_try="$ac_link"
1398
+case "(($ac_try" in
1399
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1400
+  *) ac_try_echo=$ac_try;;
1401
+esac
1402
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1403
+$as_echo "$ac_try_echo"; } >&5
1404
+  (eval "$ac_link") 2>conftest.err
1405
+  ac_status=$?
1406
+  if test -s conftest.err; then
1407
+    grep -v '^ *+' conftest.err >conftest.er1
1408
+    cat conftest.er1 >&5
1409
+    mv -f conftest.er1 conftest.err
1410
+  fi
1411
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1412
+  test $ac_status = 0; } && {
1413
+	 test -z "$ac_c_werror_flag" ||
1414
+	 test ! -s conftest.err
1415
+       } && test -s conftest$ac_exeext && {
1416
+	 test "$cross_compiling" = yes ||
1417
+	 test -x conftest$ac_exeext
1418
+       }; then :
1419
+  ac_retval=0
1420
+else
1421
+  $as_echo "$as_me: failed program was:" >&5
1422
+sed 's/^/| /' conftest.$ac_ext >&5
1423
+
1424
+	ac_retval=1
1425
+fi
1426
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
1427
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
1428
+  # interfere with the next link command; also delete a directory that is
1429
+  # left behind by Apple's compiler.  We do this before executing the actions.
1430
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
1431
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1432
+  as_fn_set_status $ac_retval
1433
+
1434
+} # ac_fn_c_try_link
1389 1435
 cat >config.log <<_ACEOF
1390 1436
 This file contains any messages produced by compilers while
1391 1437
 running configure, to aid debugging if configure makes a mistake.
... ...
@@ -2563,7 +2609,103 @@ else
2563 2609
 fi
2564 2610
 
2565 2611
 
2566
-#and check crypto++
2612
+
2613
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5
2614
+$as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
2615
+if ${ac_cv_lib_ssl_SSL_library_init+:} false; then :
2616
+  $as_echo_n "(cached) " >&6
2617
+else
2618
+  ac_check_lib_save_LIBS=$LIBS
2619
+LIBS="-lssl  $LIBS"
2620
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2621
+/* end confdefs.h.  */
2622
+
2623
+/* Override any GCC internal prototype to avoid an error.
2624
+   Use char because int might match the return type of a GCC
2625
+   builtin and then its argument prototype would still apply.  */
2626
+#ifdef __cplusplus
2627
+extern "C"
2628
+#endif
2629
+char SSL_library_init ();
2630
+int
2631
+main ()
2632
+{
2633
+return SSL_library_init ();
2634
+  ;
2635
+  return 0;
2636
+}
2637
+_ACEOF
2638
+if ac_fn_c_try_link "$LINENO"; then :
2639
+  ac_cv_lib_ssl_SSL_library_init=yes
2640
+else
2641
+  ac_cv_lib_ssl_SSL_library_init=no
2642
+fi
2643
+rm -f core conftest.err conftest.$ac_objext \
2644
+    conftest$ac_exeext conftest.$ac_ext
2645
+LIBS=$ac_check_lib_save_LIBS
2646
+fi
2647
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5
2648
+$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; }
2649
+if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then :
2650
+  cat >>confdefs.h <<_ACEOF
2651
+#define HAVE_LIBSSL 1
2652
+_ACEOF
2653
+
2654
+  LIBS="-lssl $LIBS"
2655
+
2656
+else
2657
+  as_fn_error $? "\"Can't find -lssl\"" "$LINENO" 5
2658
+fi
2659
+
2660
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_EncryptInit in -lcrypto" >&5
2661
+$as_echo_n "checking for EVP_EncryptInit in -lcrypto... " >&6; }
2662
+if ${ac_cv_lib_crypto_EVP_EncryptInit+:} false; then :
2663
+  $as_echo_n "(cached) " >&6
2664
+else
2665
+  ac_check_lib_save_LIBS=$LIBS
2666
+LIBS="-lcrypto  $LIBS"
2667
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2668
+/* end confdefs.h.  */
2669
+
2670
+/* Override any GCC internal prototype to avoid an error.
2671
+   Use char because int might match the return type of a GCC
2672
+   builtin and then its argument prototype would still apply.  */
2673
+#ifdef __cplusplus
2674
+extern "C"
2675
+#endif
2676
+char EVP_EncryptInit ();
2677
+int
2678
+main ()
2679
+{
2680
+return EVP_EncryptInit ();
2681
+  ;
2682
+  return 0;
2683
+}
2684
+_ACEOF
2685
+if ac_fn_c_try_link "$LINENO"; then :
2686
+  ac_cv_lib_crypto_EVP_EncryptInit=yes
2687
+else
2688
+  ac_cv_lib_crypto_EVP_EncryptInit=no
2689
+fi
2690
+rm -f core conftest.err conftest.$ac_objext \
2691
+    conftest$ac_exeext conftest.$ac_ext
2692
+LIBS=$ac_check_lib_save_LIBS
2693
+fi
2694
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_EVP_EncryptInit" >&5
2695
+$as_echo "$ac_cv_lib_crypto_EVP_EncryptInit" >&6; }
2696
+if test "x$ac_cv_lib_crypto_EVP_EncryptInit" = xyes; then :
2697
+  cat >>confdefs.h <<_ACEOF
2698
+#define HAVE_LIBCRYPTO 1
2699
+_ACEOF
2700
+
2701
+  LIBS="-lcrypto $LIBS"
2702
+
2703
+else
2704
+  as_fn_error $? "\"Can't find -lcrypto\"" "$LINENO" 5
2705
+fi
2706
+
2707
+
2708
+
2567 2709
 ac_config_files="$ac_config_files Makefile"
2568 2710
 
2569 2711
 cat >confcache <<\_ACEOF
... ...
@@ -3839,6 +3981,8 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
3839 3981
 fi
3840 3982
 
3841 3983
 
3984
+
3985
+
3842 3986
 if test "$PAM_MODULE_DIRECTORY" = "$DEFAULT_PAM_MODULE_DIRECTORY"; then
3843 3987
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
3844 3988
         **
... ...
@@ -32,10 +32,15 @@ AC_ARG_WITH([cryptopp],
32 32
 	[WITH_CRYPTOPP=$withval],
33 33
 	[WITH_CRYPTOPP=yes])
34 34
 
35
-#and check crypto++
35
+AC_CHECK_LIB([ssl], [SSL_library_init],,[AC_MSG_ERROR("Can't find -lssl")])
36
+AC_CHECK_LIB([crypto], [EVP_EncryptInit],,[AC_MSG_ERROR("Can't find -lcrypto")])
37
+
38
+
36 39
 AC_CONFIG_FILES([Makefile])
37 40
 AC_OUTPUT
38 41
 
42
+
43
+
39 44
 if test "$PAM_MODULE_DIRECTORY" = "$DEFAULT_PAM_MODULE_DIRECTORY"; then
40 45
     AC_MSG_WARN([
41 46
         **