Detect the header <getopt.h> in cmake, enabling the GETOPT_SUPPORT definition that allows the CLI fluidsynth program to use its features (like long arguments) when it is available, for instance in Windows/MinGW.

This commit is contained in:
Pedro Lopez-Cabanillas 2012-03-11 11:49:49 +00:00
parent 6a9b5507e2
commit 0fce00d396
3 changed files with 8 additions and 2 deletions

View File

@ -121,6 +121,7 @@ check_include_file ( arpa/inet.h HAVE_ARPA_INET_H )
check_include_file ( limits.h HAVE_LIMITS_H )
check_include_file ( pthread.h HAVE_PTHREAD_H )
check_include_file ( signal.h HAVE_SIGNAL_H )
check_include_file ( getopt.h HAVE_GETOPT_H )
include ( TestInline )
include ( TestVLA )
include ( TestBigEndian )

View File

@ -127,6 +127,9 @@
/* Define to 1 if you have the <windows.h> header file. */
#cmakedefine HAVE_WINDOWS_H @HAVE_WINDOWS_H@
/* Define to 1 if you have the <getopt.h> header file. */
#cmakedefine HAVE_GETOPT_H @HAVE_GETOPT_H@
/* Define to enable JACK driver */
#cmakedefine JACK_SUPPORT @JACK_SUPPORT@

View File

@ -30,6 +30,9 @@
#if !defined(WIN32) && !defined(MACINTOSH)
#define _GNU_SOURCE
#endif
#if defined(HAVE_GETOPT_H)
#include <getopt.h>
#endif
@ -66,14 +69,13 @@ int option_help = 0; /* set to 1 if "-o help" is specified */
/*
* support for the getopt function
*/
#if !defined(WIN32) && !defined(MACINTOSH)
#if defined(HAVE_GETOPT_H)
#define GETOPT_SUPPORT 1
int getopt(int argc, char * const argv[], const char *optstring);
extern char *optarg;
extern int optind, opterr, optopt;
#endif
/* Process a command line option -o setting=value, for example: -o synth.polyhony=16 */
void process_o_cmd_line_option(fluid_settings_t* settings, char* optarg)
{