Pārlūkot izejas kodu

Immediate fixes after Emanuele's review.

Fixing segfault in gen app.
Adding header check for sys/bsd/queue.h, which can be found in Ubuntu™ in package libbsd-dev.
Moving stuff around with the linker, hoping this works out. Testing after this commit.
Michele Orrù 11 gadi atpakaļ
vecāks
revīzija
71751b2084

+ 6 - 3
configure.ac

@@ -16,7 +16,10 @@ AC_PROG_RANLIB
 
 # Checks for header files.
 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h unistd.h])
-AC_CHECK_HEADERS([openssl/ssl.h])
+AC_CHECK_HEADER(bsd/sys/queue.h, [:],
+                [AC_MSG_ERROR([Could not find or include bsd queues. Please install libbsd-dev.])])
+AC_CHECK_HEADERS([openssl/ssl.h openssl/bn.h openssl/x509.h openssl/rsa.h], [:],
+                 AC_MSG_ERROR([Could not find or include openssl headers. Please install libssl-dev.]))
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_TYPE_SIZE_T
@@ -26,7 +29,7 @@ AC_FUNC_ERROR_AT_LINE
 AC_FUNC_MALLOC
 #AC_CHECK_FUNCS([dup2 setlocale strdup])
 
-# Add compiler flags
+# Add compiler/linker flags
 CFLAGS="$CFLAGS --std=c99 -I$(pwd)/src/include -Wall"
 
 # Adding package options
@@ -38,4 +41,4 @@ AC_OUTPUT([Makefile
            src/Makefile src/questions/Makefile
            src/apps/Makefile
            src/tests/Makefile src/questions/tests/Makefile
-])
+           ])

+ 1 - 3
src/Makefile.am

@@ -1,7 +1,5 @@
 SUBDIRS = questions/ apps/ tests/
 
-AM_LDFLAGS = -lcrypto -lm -lssl
-
 bin_PROGRAMS = qa
 qa_SOURCES = qa.c qa_sock.c cmdline.c
-qa_LDADD = questions/libquestions.a
+qa_LDADD = questions/libquestions.a -lssl -lcrypto

+ 1 - 1
src/apps/Makefile.am

@@ -1,7 +1,7 @@
 bin_PROGRAMS = gen
 
 gen_SOURCES = gen.c
-gen_LDFLAGS = -lcrypto -lssl
+gen_LDADD = -lcrypto -lssl
 
 
 TESTS = tests/test_gen_pub.test \

+ 1 - 1
src/apps/gen.c

@@ -21,7 +21,7 @@ usage(int ret)
     "%s pub [-n MODULUS | -p PRIME -q PRIME] -e PUBLIC_EXPONENT\n"
     "%s priv -p PRIME -q PRIME -e PUBLIC_EXPONENT -d PRIVATE_EXPONENT\n";
   fprintf(stderr, help_message, program_invocation_short_name,
-          program_invocation_name);
+          program_invocation_name, program_invocation_name);
 
   exit(ret);
 }

+ 0 - 2
src/questions/Makefile.am

@@ -1,7 +1,5 @@
 SUBDIRS = tests/
 
-AM_LDFLAGS = -lssl -lcrypto
-
 lib_LIBRARIES = libquestions.a
 libquestions_a_SOURCES = wiener.c pollard.c example.c dixon.c allquestions.c qarith.c qstrings.c
 # da fuck liquestions_a_HEADERS = qwiener.h questions.h

+ 1 - 2
src/questions/tests/Makefile.am

@@ -1,6 +1,5 @@
 # unittesting my ass
-AM_LDFLAGS = -lcrypto -lssl
-LDADD = ../libquestions.a
+LDADD=../libquestions.a -lssl -lcrypto
 
 check_PROGRAMS = test_qarith test_qstrings test_wiener test_pollard
 TESTS = $(check_PROGRAMS)