configure.in 4.54 KB
Newer Older
1 2 3
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

Matteo Quintiliani's avatar
Matteo Quintiliani committed
4
AC_PREREQ(2.61)
5 6 7 8 9

dnl Name your program here
m4_define([full_package_name], [nmxptool])

dnl These three define the plug-in version number
10
m4_define([major_version], [1])
Matteo Quintiliani's avatar
Matteo Quintiliani committed
11
m4_define([minor_version], [1])
12
m4_define([micro_version], [7])
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

m4_define([version],
	            [major_version.minor_version.micro_version])

m4_define([bug_report_address], [quintiliani@ingv.it])

# AC_INIT(FULL_PACKAGE_NAME, VERSION, BUG_REPORT_ADDRESS)
AC_INIT([full_package_name], [version], [bug_report_address])
AC_CONFIG_SRCDIR([src/nmxptool.c])
AC_CONFIG_HEADER([config.h])

#mtheo
# AM_INIT_AUTOMAKE(FULL_PACKAGE_NAME,VERSION)
AM_INIT_AUTOMAKE([full_package_name], [version])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.
32 33 34
AC_CHECK_LIB(nsl,gethostent)
AC_SEARCH_LIBS(socket, socket, ,
	           [AC_CHECK_LIB(nsl, socket, LIBS="$LIBS -lsocket -lnsl", , -lsocket)])
35 36 37 38

AC_SEARCH_LIBS(rt, nanosleep, ,
	           [AC_CHECK_LIB(rt, nanosleep, LIBS="$LIBS -lrt", , -lrt)])

39 40 41
AC_SEARCH_LIBS(ws2_32, puts, ,
		[AC_CHECK_LIB(ws2_32, puts, LIBS="$LIBS -lws2_32", , -lws2_32)])

42 43 44 45
AC_ARG_WITH([libmseed],
	    [AS_HELP_STRING([--without-libmseed], [disable support for libmseed])],
	    [], 
	    [with_libmseed=yes]
46 47
) 

48 49 50 51
AC_ARG_WITH([ew],
	    [AS_HELP_STRING([--without-ew], [disable support for earthworm])],
	    [], 
	    [with_ew=yes]
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
) 

AC_ARG_WITH([seedlink],
	    [AS_HELP_STRING([--without-seedlink], [disable support for seedlink])],
	    [], 
	    [with_seedlink=yes]
) 

AS_IF([test "x$with_libmseed" != xno], 
      [AC_CHECK_LIB([mseed], [msr_init],
		    [LIBS="$LIBS -lmseed"
		     AC_DEFINE([HAVE_LIBMSEED], [1], [Define if you have libreadline]) 
		     AC_CHECK_LIB([nmxp], [nmxp_data_msr_pack],
				  [],
				  [AC_MSG_FAILURE([libmseed is installed but libnmxp does not support it. (Try --without-libmseed to disable)])])
		     ], 
		     [AC_MSG_WARN([
		      libmseed is not available (--without-libmseed to disable)
		     ])
		     AC_CHECK_LIB([nmxp], [nmxp_openSocket], [], [AC_MSG_ERROR([libnmxp is not installed or it supports libmseed
				   but libmseed is not available anymore! Try to recompile libnmxp!
				   ])]) 
				   ], 
				   )
      ],
      [ AC_CHECK_LIB([nmxp], [nmxp_openSocket], [], [AC_MSG_ERROR([libnmxp is not installed or supports libmseed (--with-libmseed to enable)!])]) ]
) 
79 80 81 82 83


# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
84
AC_CHECK_HEADERS([windows.h winsock2.h])
85

86

87
# Earthworm check.
88 89
AS_IF([test "x$with_ew" != xno], 
      [
Matteo Quintiliani's avatar
Matteo Quintiliani committed
90 91 92 93 94
    AS_IF([test "x$EW_HOME" != x], 
	  [
	# AC_CHECK_HEADERS([earthworm.h kom.h transport.h trace_buf.h],
	#		 [AC_DEFINE([HAVE_EARTHWORMFILES_H], [1], [Define if you have earthworm header file])],
	#		 AC_MSG_WARN([earthworm header files not found!]))
Matteo Quintiliani's avatar
Matteo Quintiliani committed
95
	EWOBJS="$EW_HOME/$EW_VERSION/lib/kom.o $EW_HOME/$EW_VERSION/lib/getutil.o $EW_HOME/$EW_VERSION/lib/logit_mt.o $EW_HOME/$EW_VERSION/lib/socket_ew_common.o $EW_HOME/$EW_VERSION/lib/transport.o $EW_HOME/$EW_VERSION/lib/sleep_ew.o $EW_HOME/$EW_VERSION/lib/socket_ew.o $EW_HOME/$EW_VERSION/lib/time_ew.o $EW_HOME/$EW_VERSION/lib/threads_ew.o $EW_HOME/$EW_VERSION/lib/sema_ew.o $EW_HOME/$EW_VERSION/lib/swap.o $EW_HOME/$EW_VERSION/lib/mem_circ_queue.o"
Matteo Quintiliani's avatar
Matteo Quintiliani committed
96
	AC_CHECK_FILES([$EW_HOME/$EW_VERSION/lib/kom.o $EW_HOME/$EW_VERSION/lib/getutil.o $EW_HOME/$EW_VERSION/lib/logit_mt.o $EW_HOME/$EW_VERSION/lib/socket_ew_common.o $EW_HOME/$EW_VERSION/lib/transport.o $EW_HOME/$EW_VERSION/lib/sleep_ew.o $EW_HOME/$EW_VERSION/lib/socket_ew.o $EW_HOME/$EW_VERSION/lib/time_ew.o $EW_HOME/$EW_VERSION/lib/threads_ew.o $EW_HOME/$EW_VERSION/lib/sema_ew.o $EW_HOME/$EW_VERSION/lib/swap.o $EW_HOME/$EW_VERSION/lib/mem_circ_queue.o], [AC_DEFINE([HAVE_EARTHWORMOBJS], [1], [Define if you have earthworm object files])], [AC_MSG_ERROR(Some earthworm object files is missing!)] )
Matteo Quintiliani's avatar
Matteo Quintiliani committed
97
	LIBS="$LIBS $EWOBJS"
Matteo Quintiliani's avatar
Matteo Quintiliani committed
98 99 100 101 102
	],
	[AC_MSG_WARN([Earthworm files are not available (--without-ew to disable)])]
    )
    ],
    [AC_MSG_WARN([Earthworm support has been disabled!])]
103
)
104

105 106

# Checks for files.
107 108 109 110 111

# Seedlink check.
AS_IF([test "x$with_seedlink" != xno], 
      [AC_CHECK_FILES([./src/seedlink_plugin.c ./src/seedlink_plugin.h], [], AC_MSG_ERROR([seedlink plug-in sources not found!]))]
)
112 113 114 115 116


# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_INT32_T
117
AC_TYPE_PID_T
118 119 120 121 122 123
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_STRUCT_TM
AC_TYPE_UINT32_T

# Checks for library functions.
Matteo Quintiliani's avatar
Matteo Quintiliani committed
124
AC_FUNC_MALLOC
125
AC_CHECK_FUNCS([memset strdup])
126 127 128 129

AC_CONFIG_FILES([Makefile
                 src/Makefile])
AC_OUTPUT