aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt10
-rw-r--r--cmake/README.txt1
-rwxr-xr-xcmake/basictest1
-rw-r--r--extension/CMakeLists.txt27
4 files changed, 30 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 410c0204..ba43a614 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,8 +99,10 @@ add_definitions(-D PACKAGE_URL=\\"http://www.gnu.org/software/gawk/\\")
add_definitions(-D PACKAGE_VERSION=\\"${GAWK_VERSION}\\")
add_definitions(-D DEFPATH=\\"${CMAKE_BINARY_DIR}/awk\\")
add_definitions(-D DEFLIBPATH=\\"${CMAKE_BINARY_DIR}/lib\\")
-#add_definitions(-D EXTLIB_SUFFIX=\\"lib\\")
-add_definitions(-D SHLIBEXT=\\".so\\")
+#DefineFunctionIfAvailable(dlopen DYNAMIC)
+DefineHFileIfAvailable(dlfcn.h DYNAMIC)
+#add_definitions(-D SHLIBEXT=\\"${CMAKE_SHARED_LIBRARY_SUFFIX}\\")
+add_definitions(-D SHLIBEXT=\\"so\\")
DefineTypeIfAvailable("unsigned int" SIZEOF_UNSIGNED_INT)
DefineTypeIfAvailable("unsigned long" SIZEOF_UNSIGNED_LONG)
#/* Define to 1 if *printf supports %F format */
@@ -224,6 +226,10 @@ DefineLibraryIfAvailable(c socket "" HAVE_SOCKETS)
if (${HAVE_MPFR})
set (EXTRA_LIBS ${EXTRA_LIBS} mpfr gmp)
endif ()
+if (${DYNAMIC})
+ set (EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_DL_LIBS} )
+endif ()
+
include_directories(${CMAKE_SOURCE_DIR})
diff --git a/cmake/README.txt b/cmake/README.txt
index d6e693b8..4e24cc1f 100644
--- a/cmake/README.txt
+++ b/cmake/README.txt
@@ -17,6 +17,7 @@ should do this, read
cmake ..
make
./gawk --version
+ make test
Notice that this git-checkout allows you to read the source code,
track the cmake branch and get updates. You will not be able to
commit anything.
diff --git a/cmake/basictest b/cmake/basictest
index 6fe5db5a..86f6ff66 100755
--- a/cmake/basictest
+++ b/cmake/basictest
@@ -2,6 +2,7 @@
TESTHOME=$(dirname ${0})/../test
export AWKPATH=${TESTHOME}
+export AWKLIBPATH=${TESTHOME}/../build/extension/
export LANG=C
if test -r ${TESTHOME}/${2}.in
then
diff --git a/extension/CMakeLists.txt b/extension/CMakeLists.txt
index a730d8b6..61f407a9 100644
--- a/extension/CMakeLists.txt
+++ b/extension/CMakeLists.txt
@@ -29,9 +29,14 @@ remove_definitions(-DGAWK)
add_library (filefuncs SHARED filefuncs.c stack.c gawkfts.c)
target_link_libraries (filefuncs)
-DefineFunctionIfAvailable(fnmatch HAVE_FNMATCH_H)
-add_library (fnmatch SHARED fnmatch.c)
-target_link_libraries (fnmatch)
+DefineFunctionIfAvailable(fnmatch HAVE_FNMATCH)
+DefineHFileIfAvailable(fnmatch.h HAVE_FNMATCH_H)
+if (${HAVE_FNMATCH} AND ${HAVE_FNMATCH_H})
+ add_library (fnmatch SHARED fnmatch.c)
+ target_link_libraries (fnmatch)
+else()
+ message(WARNING "extension fnmatch cannot be built because function fnmatch or fnmatch.h is missing")
+endif()
add_library (fork SHARED fork.c)
target_link_libraries (fork)
@@ -43,8 +48,12 @@ add_library (ordchr SHARED ordchr.c)
target_link_libraries (ordchr)
DefineHFileIfAvailable(dirent.h HAVE_DIRENT_H)
-add_library (readdir SHARED readdir.c)
-target_link_libraries (readdir)
+if (${HAVE_DIRENT_H})
+ add_library (readdir SHARED readdir.c)
+ target_link_libraries (readdir)
+else()
+ message(WARNING "extension readdir cannot be built because function readdir is missing")
+endif()
add_library (readfile SHARED readfile.c)
target_link_libraries (readfile)
@@ -53,8 +62,12 @@ add_library (revoutput SHARED revoutput.c)
target_link_libraries (revoutput)
DefineFunctionIfAvailable(getdtablesize HAVE_GETDTABLESIZE)
-add_library (revtwoway SHARED revtwoway.c)
-target_link_libraries (revtwoway)
+if (${HAVE_GETDTABLESIZE})
+ add_library (revtwoway SHARED revtwoway.c)
+ target_link_libraries (revtwoway)
+else()
+ message(WARNING "extension revtwoway cannot be built because function getdtablesize is missing")
+endif()
add_library (rwarray SHARED rwarray.c)
target_link_libraries (rwarray)