configure.in 6.28 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], [8])
13 14 15 16 17 18 19 20 21 22 23

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])

24 25
AC_CANONICAL_SYSTEM

26 27 28 29
#mtheo
# AM_INIT_AUTOMAKE(FULL_PACKAGE_NAME,VERSION)
AM_INIT_AUTOMAKE([full_package_name], [version])

30 31 32 33 34 35
NMXP_CFLAGS="-I`pwd`/libnmxp/src"
NMXP_LDFLAGS="-L`pwd`/libnmxp/src"

CFLAGS="$CFLAGS $NMXP_CFLAGS"
LDFLAGS="$LDFLAGS $NMXP_LDFLAGS"

36 37 38 39
# Checks for programs.
AC_PROG_CC

# Checks for libraries.
40 41 42
AC_CHECK_LIB(nsl,gethostent)
AC_SEARCH_LIBS(socket, socket, ,
	           [AC_CHECK_LIB(nsl, socket, LIBS="$LIBS -lsocket -lnsl", , -lsocket)])
43 44 45 46

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

47 48 49
AC_SEARCH_LIBS(ws2_32, puts, ,
		[AC_CHECK_LIB(ws2_32, puts, LIBS="$LIBS -lws2_32", , -lws2_32)])

50 51 52 53
AC_ARG_WITH([libmseed],
	    [AS_HELP_STRING([--without-libmseed], [disable support for libmseed])],
	    [], 
	    [with_libmseed=yes]
54 55
) 

56 57 58 59
AC_ARG_WITH([ew],
	    [AS_HELP_STRING([--without-ew], [disable support for earthworm])],
	    [], 
	    [with_ew=yes]
60 61 62 63 64 65 66 67
) 

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

Matteo Quintiliani's avatar
Matteo Quintiliani committed
68 69 70 71 72
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
AC_CHECK_HEADERS([windows.h winsock2.h])

73 74 75
AS_IF([test "x$with_libmseed" != xno], 
      [AC_CHECK_LIB([mseed], [msr_init],
		    [LIBS="$LIBS -lmseed"
76
		     AC_DEFINE([HAVE_LIBMSEED], [1], [Define if you have libmseed]) 
77
		     AC_CHECK_LIB([nmxp], [nmxp_openSocket], [], [AC_MSG_ERROR([libnmxp not found!])]) 
78 79
		     AC_CHECK_LIB([nmxp], [nmxp_data_msr_pack],
				  [],
80
				  [AC_MSG_FAILURE([libmseed found but libnmxp does not support it. (Try --without-libmseed to disable)])])
81 82 83 84
		     ], 
		     [AC_MSG_WARN([
		      libmseed is not available (--without-libmseed to disable)
		     ])
85
		     AC_CHECK_LIB([nmxp], [nmxp_openSocket], [], [AC_MSG_ERROR([libnmxp not found or it supports libmseed
86 87 88 89 90
				   but libmseed is not available anymore! Try to recompile libnmxp!
				   ])]) 
				   ], 
				   )
      ],
Matteo Quintiliani's avatar
Matteo Quintiliani committed
91
      [
92
       AC_CHECK_LIB([nmxp], [nmxp_openSocket], [], [AC_MSG_ERROR([libnmxp not found or supports libmseed (--with-libmseed to enable)!])]) 
Matteo Quintiliani's avatar
Matteo Quintiliani committed
93 94
       AC_MSG_WARN([Mini-SEED support has been disabled!])
      ]
95
) 
96 97


98
EWOSOURCES=no
99

100
# Earthworm check.
101 102
AS_IF([test "x$with_ew" != xno], 
      [
Matteo Quintiliani's avatar
Matteo Quintiliani committed
103 104
    AS_IF([test "x$EW_HOME" != x], 
	  [
105
	   CFLAGS="$CFLAGS $GLOBALFLAGS"
106 107
	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])],
108
			 AC_MSG_ERROR([Earthworm header files not found!])
109
			 )
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
	EWLIB=$EW_HOME/$EW_VERSION/lib
	EWOBJS="$EWLIB/kom.o $EWLIB/getutil.o $EWLIB/logit_mt.o $EWLIB/socket_ew_common.o $EWLIB/transport.o $EWLIB/sleep_ew.o $EWLIB/socket_ew.o $EWLIB/time_ew.o $EWLIB/threads_ew.o $EWLIB/sema_ew.o $EWLIB/swap.o $EWLIB/mem_circ_queue.o"
	AC_CHECK_FILES([$EWLIB/kom.o $EWLIB/getutil.o $EWLIB/logit_mt.o $EWLIB/socket_ew_common.o $EWLIB/transport.o $EWLIB/sleep_ew.o $EWLIB/socket_ew.o $EWLIB/time_ew.o $EWLIB/threads_ew.o $EWLIB/sema_ew.o $EWLIB/swap.o $EWLIB/mem_circ_queue.o],
		       [ ],
		       [
			AC_MSG_WARN(Earthworm object file is missing! Attempt to compile from source!)
			EWOSOURCES=yes
			]
		       )
	AC_DEFINE([HAVE_EARTHWORMOBJS], [1], [Define if you have all earthworm object files])
	AS_IF([test "x$EWOSOURCES" != xno],
	      [ 
		case "$OSTYPE" in
		solaris*)
		    EWOS=solaris
		;;
		darwin*)
		    EWOS=unix
		;;
		linux*)
		    EWOS=unix
		;;
		win32*)
		    EWOS=winnt
		;;
		msys*)
		    EWOS=winnt
		;;
		*)
		    EWOS=unix
		    AC_MSG_WARN(Unrecognised OS $OSTYPE)
		;;
		esac
		AC_MSG_WARN(EWOS set to $EWOS)
		AC_SUBST(EWOS)
145 146 147
		AC_SUBST(EW_HOME)
		AC_SUBST(EW_VERSION)
		AC_SUBST(EW_PARAMS)
148 149 150 151 152 153
		EW_LIBSRC=$EW_HOME/$EW_VERSION/src/libsrc
		EW_LIBSRC_UTIL=$EW_LIBSRC/util
		EW_LIBSRC_OS=$EW_LIBSRC/$EWOS
		AC_SUBST(EW_LIBSRC)
		AC_SUBST(EW_LIBSRC_UTIL)
		AC_SUBST(EW_LIBSRC_OS)
154 155 156 157
	       ],
	      [
	       LIBS="$LIBS $EWOBJS"
	       ])
Matteo Quintiliani's avatar
Matteo Quintiliani committed
158 159 160 161 162
	],
	[AC_MSG_WARN([Earthworm files are not available (--without-ew to disable)])]
    )
    ],
    [AC_MSG_WARN([Earthworm support has been disabled!])]
163
)
164
AM_CONDITIONAL(WITHEWSOURCES, test x$EWOS != x)
Matteo Quintiliani's avatar
Matteo Quintiliani committed
165
AM_CONDITIONAL(WITHEW, test x$with_ew != xno)
166

167

168
# Set BINARY_DIST_NAME_SUFFIX
169
BINARY_DIST_NAME_SUFFIX=$host
170 171 172 173
AC_MSG_NOTICE(BINARY_DIST_NAME_SUFFIX set to $BINARY_DIST_NAME_SUFFIX)
AC_SUBST(BINARY_DIST_NAME_SUFFIX)


174
# Checks for files.
175 176 177

# Seedlink check.
AS_IF([test "x$with_seedlink" != xno], 
178 179 180 181 182 183 184 185 186 187 188 189
      [
       AC_CHECK_FILES([./src/seedlink_plugin.c ./src/seedlink_plugin.h], [], AC_MSG_ERROR([seedlink plug-in sources not found!]))

       AS_IF([test "x$SEISCOMPDIR" == x],
	      [
	       SEISCOMPDIR=/home/sysop/seiscomp
	       ]
	      )
       AC_MSG_WARN([SEISCOMPDIR is set to ${SEISCOMPDIR}])
       AC_SUBST(SEISCOMPDIR)

       ],
190
    [AC_MSG_WARN([SeedLink support has been disabled!])]
191
)
192 193
AM_CONDITIONAL(WITHSEEDLINK, test x$with_seedlink != xno)

194 195 196 197

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_INT32_T
198
AC_TYPE_PID_T
199 200 201 202 203 204
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
205
AC_FUNC_MALLOC
206
AC_CHECK_FUNCS([memset strdup])
207 208 209

AC_CONFIG_FILES([Makefile
                 src/Makefile])
Matteo Quintiliani's avatar
Matteo Quintiliani committed
210 211 212

# AC_CONFIG_SUBDIRS([libnmxp])

213
AC_OUTPUT
Matteo Quintiliani's avatar
Matteo Quintiliani committed
214 215

AC_MSG_NOTICE([
216 217
      Compile nmxptool using 'make'.])

Matteo Quintiliani's avatar
Matteo Quintiliani committed
218
AS_IF([test "x$with_ew" != xno], 
219 220 221 222 223 224 225 226 227 228 229 230 231
      [AC_MSG_NOTICE([
      After compilation you can install nmxptool for Earthworm:
            make install-ew-bin
            make install-ew-conf])
      ]
)
AS_IF([test "x$with_seedlink" != xno], 
      [AC_MSG_NOTICE([
      After compilation you can install nmxptool for SeedLink:
            make install-seiscomp-bin
            make install-seiscomp-templates])
      ]
)
Matteo Quintiliani's avatar
Matteo Quintiliani committed
232